Skip to content

#233 integration tests are not unit tests #234

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Builds
# Overall MySQL Native should work on the last 10 minor compiler releases (same as Vibe.d).
# For simplicity and speed of the CI, the latest versions of dmd and ldc must are tested on
# all platforms (Windows, Linux, and Mac) with older compilers only being tested on Windows/Linux.
# The integration testing (via examples) is done on Linux against Mysql 5.7
# The integration testing is done on Linux against Mysql 5.7

on:
schedule:
Expand Down
45 changes: 26 additions & 19 deletions .github/workflows/integration-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,13 @@ jobs:
# echo "host=localhost;port=$MYSQL_PORT;user=testuser;pwd=passw0rd;db=testdb" > testConnectionStr.txt
# dub run -c unittest-vibe-ut -- -t

# - name: Build The Example Project
# working-directory: ./examples/homePage
# run: dub build

# - name: Run Example (MySQL 8)
# working-directory: ./examples/homePage
# - name: Test (MySQL 8)
# working-directory: ./tests
# env:
# MYSQL_PORT: ${{ job.services.mysql.ports[3306] }}
# run: |
# ./example "host=localhost;port=$MYSQL_PORT;user=testuser;pwd=passw0rd;db=testdb"
# dub build
# ./integration-tests --port=$MYSQL_PORT

mysql57-tests:
name: MySQL 5.7 Tests ${{ matrix.compiler }}
Expand Down Expand Up @@ -127,16 +124,21 @@ jobs:
echo "host=localhost;port=$MYSQL_PORT;user=testuser;pwd=passw0rd;db=testdb" > testConnectionStr.txt
dub run -c unittest-vibe-ut -- -t

- name: Build The Example Project
working-directory: ./examples/homePage
run: dub build
- name: Test (MySQL 5.7)
working-directory: ./tests
env:
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }}
run: |
dub build
./integration-tests --port=$MYSQL_PORT

- name: Run Example (MySQL 5.7)
working-directory: ./examples/homePage
- name: Test (MySQL 5.7) vibe-core
working-directory: ./tests
env:
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }}
run: |
./example "host=localhost;port=$MYSQL_PORT;user=testuser;pwd=passw0rd;db=testdb"
dub build --config=use-vibe
./integration-tests --port=$MYSQL_PORT

mariadb10-tests:
name: MariaDB 10 Tests ${{ matrix.compiler }}
Expand Down Expand Up @@ -192,13 +194,18 @@ jobs:
echo "host=localhost;port=$MYSQL_PORT;user=testuser;pwd=passw0rd;db=testdb" > testConnectionStr.txt
dub run -c unittest-vibe-ut -- -t

- name: Build The Example Project
working-directory: ./examples/homePage
run: dub build
- name: Test (mariadb 10)
working-directory: ./tests
env:
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }}
run: |
dub build
./integration-tests --port=$MYSQL_PORT

- name: Run Example (mariadb 10)
working-directory: ./examples/homePage
- name: Test (mariadb 10) vibe-core
working-directory: ./tests
env:
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }}
run: |
./example "host=localhost;port=$MYSQL_PORT;user=testuser;pwd=passw0rd;db=testdb"
dub build --config=use-vibe
./integration-tests --port=$MYSQL_PORT
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ dub.selections.json

# Executable file name when 'dub' is run on linux
mysql-native
tests/integration-tests
examples/homePage/example

ddoc/packageVersion.ddoc
Expand Down
3 changes: 0 additions & 3 deletions ddox/dub.sdl
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@ dependency "libdparse" version="~>0.17.0"

configuration "application" {
targetType "executable"
// Temporarily disabled to work around dlang/dub#1407
// mainSourceFile "source/app.d"
versions "JsonLineNumbers" "VibeNoSSL"
}

configuration "library" {
targetType "library"
excludedSourceFiles "source/app.d"
}
4 changes: 0 additions & 4 deletions dub.sdl
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ configuration "application" {

configuration "library" {
targetType "library"
excludedSourceFiles "source/app.d"
}

// Do not use this. Use "run_tests" insetad.
configuration "unittest" {
excludedSourceFiles "source/app.d"
preBuildCommands \
"echo \"ERROR: Don't use 'dub test' to test mysql-native. Use 'run_tests' instead.\"" \
"echo Bailing..." \
Expand All @@ -35,7 +33,6 @@ configuration "unittest-vibe" {
targetType "executable"
targetPath "bin/"
targetName "mysqln-tests-vibe"
excludedSourceFiles "source/app.d"

dependency "vibe-core" version="~>1.16.0" optional=false

Expand All @@ -48,7 +45,6 @@ configuration "unittest-vibe-ut" {
targetType "executable"
targetPath "bin/"
targetName "mysqln-tests-vibe"
excludedSourceFiles "source/app.d"
sourceFiles "bin/ut.d"
importPaths "bin/"
buildOptions "unittests"
Expand Down
12 changes: 0 additions & 12 deletions examples/homePage/dub.sdl

This file was deleted.

65 changes: 0 additions & 65 deletions examples/homePage/example.d

This file was deleted.

99 changes: 0 additions & 99 deletions source/app.d

This file was deleted.

28 changes: 26 additions & 2 deletions source/mysql/connection.d
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,33 @@ debug(MYSQLN_TESTS)
unittest
{
import mysql.test.common;
import mysql.test.integration;

mixin(scopedCn);
initBaseTestTables(cn);

cn.exec("DROP TABLE IF EXISTS `basetest`");
cn.exec(
"CREATE TABLE `basetest` (
`boolcol` bit(1),
`bytecol` tinyint(4),
`ubytecol` tinyint(3) unsigned,
`shortcol` smallint(6),
`ushortcol` smallint(5) unsigned,
`intcol` int(11),
`uintcol` int(10) unsigned,
`longcol` bigint(20),
`ulongcol` bigint(20) unsigned,
`charscol` char(10),
`stringcol` varchar(50),
`bytescol` tinyblob,
`datecol` date,
`timecol` time,
`dtcol` datetime,
`doublecol` double,
`floatcol` float,
`nullcol` int(11),
`decimalcol` decimal(11,4)
) ENGINE=InnoDB DEFAULT CHARSET=latin1"
);

exec(cn, `DROP PROCEDURE IF EXISTS insert2`);
exec(cn, `
Expand Down
1 change: 0 additions & 1 deletion source/mysql/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ version(DoCoreTests)
public import mysql.protocol.sockets;

public import mysql.test.common;
public import mysql.test.integration;
public import mysql.test.regression;

version(MYSQLN_TESTS_NO_MAIN) {} else
Expand Down
Loading