Skip to content

Commit 61967ac

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

File tree

9 files changed

+217
-181
lines changed

9 files changed

+217
-181
lines changed

.github/workflows/integration-testing.yml

+18-10
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,19 @@ 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
124121
env:
125122
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }}
126123
run: |
127124
echo "host=localhost;port=$MYSQL_PORT;user=testuser;pwd=passw0rd;db=testdb" > testConnectionStr.txt
128-
dub run ":integration-tests"
125+
126+
- name: Run unittests with Vibe.d
127+
run: |
128+
dub run ":integration-tests-vibe"
129+
130+
- name: Run unittests with Phobos
131+
run: |
132+
dub run ":integration-tests-phobos"
129133
130134
- name: Build The Example Project
131135
working-directory: ./examples/homePage
@@ -182,15 +186,19 @@ jobs:
182186
if: startsWith(matrix.os, 'ubuntu')
183187
run: sudo apt-get update && sudo apt-get install libevent-dev -y
184188

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
189+
- name: Set up test connection string
189190
env:
190191
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }}
191192
run: |
192193
echo "host=localhost;port=$MYSQL_PORT;user=testuser;pwd=passw0rd;db=testdb" > testConnectionStr.txt
193-
dub run ":integration-tests"
194+
195+
- name: Run unittests with Vibe.d
196+
run: |
197+
dub run ":integration-tests-vibe"
198+
199+
- name: Run unittests with Phobos
200+
run: |
201+
dub run ":integration-tests-phobos"
194202
195203
- name: Build The Example Project
196204
working-directory: ./examples/homePage

dub.sdl

+2
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

+8
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

+9
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

+7-14
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

+13
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)