Skip to content

Commit e20a3ea

Browse files
committed
Add phobos tests. Work around dub bug that doesn't allow dependencies
based on configuration.
1 parent 51aa526 commit e20a3ea

File tree

9 files changed

+223
-183
lines changed

9 files changed

+223
-183
lines changed

.github/workflows/integration-testing.yml

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,21 @@ jobs:
117117
if: startsWith(matrix.os, 'ubuntu')
118118
run: sudo apt-get update && sudo apt-get install libevent-dev -y
119119

120-
## Turns out the unittest-vibe-ut tried to connect to an actualy MySQL on 172.18.0.1 so it's not
121-
## actually a unit test at all. It's an integration test and should be pulled out from the main
122-
## codebase into a separate sub module
123-
- name: Run unittest-vibe
120+
- name: Set up test connection string
121+
run: |
122+
echo "host=localhost;port=$MYSQL_PORT;user=testuser;pwd=passw0rd;db=testdb" > testConnectionStr.txt
123+
124+
- name: Run unittests with Vibe.d
124125
env:
125126
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }}
126127
run: |
127-
echo "host=localhost;port=$MYSQL_PORT;user=testuser;pwd=passw0rd;db=testdb" > testConnectionStr.txt
128-
dub run ":integration-tests"
128+
dub run ":integration-tests-vibe"
129+
130+
- name: Run unittests with Phobos
131+
env:
132+
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }}
133+
run: |
134+
dub run ":integration-tests-phobos"
129135
130136
- name: Build The Example Project
131137
working-directory: ./examples/homePage
@@ -182,15 +188,21 @@ jobs:
182188
if: startsWith(matrix.os, 'ubuntu')
183189
run: sudo apt-get update && sudo apt-get install libevent-dev -y
184190

185-
## Turns out the unittest-vibe-ut tried to connect to an actualy MySQL on 172.18.0.1 so it's not
186-
## actually a unit test at all. It's an integration test and should be pulled out from the main
187-
## codebase into a separate sub module
188-
- name: Run unittest-vibe-ut
191+
- name: Set up test connection string
192+
run: |
193+
echo "host=localhost;port=$MYSQL_PORT;user=testuser;pwd=passw0rd;db=testdb" > testConnectionStr.txt
194+
195+
- name: Run unittests with Vibe.d
189196
env:
190197
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }}
191198
run: |
192-
echo "host=localhost;port=$MYSQL_PORT;user=testuser;pwd=passw0rd;db=testdb" > testConnectionStr.txt
193-
dub run ":integration-tests"
199+
dub run ":integration-tests-vibe"
200+
201+
- name: Run unittests with Phobos
202+
env:
203+
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }}
204+
run: |
205+
dub run ":integration-tests-phobos"
194206
195207
- name: Build The Example Project
196208
working-directory: ./examples/homePage

dub.sdl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ dependency "vibe-core" version="~>1.16.0" optional=true
99
toolchainRequirements frontend=">=2.068"
1010

1111
subPackage "./integration-tests"
12+
subPackage "./integration-tests-vibe"
13+
subPackage "./integration-tests-phobos"
1214
subPackage "./testconn"

integration-tests-phobos/dub.sdl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name "integration-tests-phobos"
2+
description "Phobos tests for mysql-native"
3+
license "BSL-1.0"
4+
copyright "Copyright (c) 2011-2021 Steve Teale, James W. Oliphant, Simen Endsjø, Sönke Ludwig, Sergey Shamov, Nick Sabalausky, and Steven Schveighoffer"
5+
authors "Steve Teale" "James W. Oliphant" "Simen Endsjø" "Sönke Ludwig" "Sergey Shamov" "Nick Sabalausky" "Steven Schveighoffer"
6+
7+
dependency "mysql-native:integration-tests" path="../"
8+
targetType "executable"

integration-tests-phobos/source/app.d

Whitespace-only changes.

integration-tests-vibe/dub.sdl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name "integration-tests-vibe"
2+
description "Vibe tests for mysql-native"
3+
license "BSL-1.0"
4+
copyright "Copyright (c) 2011-2021 Steve Teale, James W. Oliphant, Simen Endsjø, Sönke Ludwig, Sergey Shamov, Nick Sabalausky, and Steven Schveighoffer"
5+
authors "Steve Teale" "James W. Oliphant" "Simen Endsjø" "Sönke Ludwig" "Sergey Shamov" "Nick Sabalausky" "Steven Schveighoffer"
6+
7+
dependency "mysql-native:integration-tests" path="../"
8+
dependency "vibe-core" version="~>1.16.0"
9+
targetType "executable"

integration-tests-vibe/source/app.d

Whitespace-only changes.

integration-tests/dub.sdl

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
11
name "integration-tests"
22
description "Test harness for integration tests"
33
license "BSL-1.0"
4-
copyright "Copyright (c) 2011-2021 Steve Teale, James W. Oliphant, Simen Endsjø, Sönke Ludwig, Sergey Shamov, and Nick Sabalausky"
4+
copyright "Copyright (c) 2011-2021 Steve Teale, James W. Oliphant, Simen Endsjø, Sönke Ludwig, Sergey Shamov, Nick Sabalausky, and Steven Schveighoffer"
55
authors "Steve Teale" "James W. Oliphant" "Simen Endsjø" "Sönke Ludwig" "Sergey Shamov" "Nick Sabalausky" "Steven Schveighoffer"
66

77
dependency "mysql-native" path="../"
8-
dependency "unit-threaded" version="~>0.7.45"
9-
dependency "vibe-core" version="~>1.0"
8+
dependency "unit-threaded" version="~>1.0.15"
9+
debugVersions "MYSQLN_TESTS"
10+
versions "unitUnthreaded"
11+
targetType "library"
1012

11-
configuration "unittest" {
12-
targetType "executable"
13-
debugVersions "MYSQLN_TESTS"
14-
versions "MYSQLN_TESTS_NO_MAIN"
15-
versions "unitUnthreaded"
16-
sourceFiles "bin/ut.d"
17-
importPaths "bin/"
18-
buildOptions "unittests"
19-
20-
preBuildCommands "dub run unit-threaded -c gen_ut_main -- -f bin/ut.d"
21-
}
13+
// this is needed to make the unittests compile, even though there's a warning
14+
buildOptions "unittests" "debugMode" "debugInfo"

integration-tests/source/app.d

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,16 @@ import mysql.test.common;
22
import mysql.test.integration;
33
import mysql.test.regression;
44
import mysql.maintests;
5+
6+
import unit_threaded;
7+
8+
// manual unit-threaded main function
9+
int main(string[] args)
10+
{
11+
return args.runTests!(
12+
"mysql.maintests",
13+
"mysql.test.common",
14+
"mysql.test.integration",
15+
"mysql.test.regression"
16+
);
17+
}

0 commit comments

Comments
 (0)