forked from Icinga/icingaweb2-module-director
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: refactor bootstrapping, initial Gitlab-CI..
...support. Currently expects three test-runners offering Debian Jessie, Ubuntu 16.04 LTS (Xenial) and CentOS 7. Removed all dependencies on the Icinga Web 2 test module, installing phpunit should suffice to run tests in a normal environment. This is a first attempt to make things easier, more to come.
- Loading branch information
1 parent
6c23a02
commit b996a68
Showing
8 changed files
with
159 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
stages: | ||
- Unit-Tests with DB | ||
|
||
CentOS 7/MySQL: | ||
stage: Unit-Tests with DB | ||
tags: | ||
- centos7 | ||
- director | ||
variables: | ||
DIRECTOR_TESTDB: "director_test_${CI_BUILD_ID}_${CI_RUNNER_ID}" | ||
DIRECTOR_TESTDB_RES: "Director MySQL TestDB" | ||
before_script: | ||
- mysql -u root -e "CREATE DATABASE $DIRECTOR_TESTDB" | ||
after_script: | ||
- mysql -u root -e "DROP DATABASE $DIRECTOR_TESTDB" | ||
script: | ||
- phpunit | ||
|
||
CentOS 7/PostgreSQL: | ||
stage: Unit-Tests with DB | ||
tags: | ||
- centos7 | ||
- director | ||
variables: | ||
DIRECTOR_TESTDB: "director_test_${CI_BUILD_ID}_${CI_RUNNER_ID}" | ||
DIRECTOR_TESTDB_RES: "Director PostgreSQL TestDB" | ||
DIRECTOR_TESTDB_USER: "director_${CI_BUILD_ID}_${CI_RUNNER_ID}" | ||
before_script: | ||
- psql postgres -q -c "CREATE DATABASE $DIRECTOR_TESTDB WITH ENCODING 'UTF8';" | ||
- psql $DIRECTOR_TESTDB -q -c "CREATE USER $DIRECTOR_TESTDB_USER WITH PASSWORD 'testing'; GRANT ALL PRIVILEGES ON DATABASE $DIRECTOR_TESTDB TO $DIRECTOR_TESTDB_USER; CREATE EXTENSION pgcrypto;" | ||
after_script: | ||
- psql postgres -c "DROP DATABASE $DIRECTOR_TESTDB" | ||
- psql postgres -c "DROP USER $DIRECTOR_TESTDB_USER" | ||
script: | ||
- phpunit | ||
|
||
Jessie/MySQL: | ||
stage: Unit-Tests with DB | ||
tags: | ||
- jessie | ||
- director | ||
variables: | ||
DIRECTOR_TESTDB: "director_test_${CI_BUILD_ID}_${CI_RUNNER_ID}" | ||
DIRECTOR_TESTDB_RES: "Director MySQL TestDB" | ||
before_script: | ||
- mysql -u root -e "CREATE DATABASE $DIRECTOR_TESTDB" | ||
after_script: | ||
- mysql -u root -e "DROP DATABASE $DIRECTOR_TESTDB" | ||
script: | ||
- phpunit | ||
|
||
Jessie/PostgreSQL: | ||
stage: Unit-Tests with DB | ||
tags: | ||
- jessie | ||
- director | ||
variables: | ||
DIRECTOR_TESTDB: "director_test_${CI_BUILD_ID}_${CI_RUNNER_ID}" | ||
DIRECTOR_TESTDB_RES: "Director PostgreSQL TestDB" | ||
DIRECTOR_TESTDB_USER: "director_${CI_BUILD_ID}_${CI_RUNNER_ID}" | ||
before_script: | ||
- psql postgres -q -c "CREATE DATABASE $DIRECTOR_TESTDB WITH ENCODING 'UTF8';" | ||
- psql $DIRECTOR_TESTDB -q -c "CREATE USER $DIRECTOR_TESTDB_USER WITH PASSWORD 'testing'; GRANT ALL PRIVILEGES ON DATABASE $DIRECTOR_TESTDB TO $DIRECTOR_TESTDB_USER; CREATE EXTENSION pgcrypto;" | ||
after_script: | ||
- psql postgres -c "DROP DATABASE $DIRECTOR_TESTDB" | ||
- psql postgres -c "DROP USER $DIRECTOR_TESTDB_USER" | ||
script: | ||
- phpunit | ||
|
||
Xenial/MySQL: | ||
stage: Unit-Tests with DB | ||
tags: | ||
- xenial | ||
- director | ||
variables: | ||
DIRECTOR_TESTDB: "director_test_${CI_BUILD_ID}_${CI_RUNNER_ID}" | ||
DIRECTOR_TESTDB_RES: "Director MySQL TestDB" | ||
before_script: | ||
- mysql -u root -e "CREATE DATABASE $DIRECTOR_TESTDB" | ||
after_script: | ||
- mysql -u root -e "DROP DATABASE $DIRECTOR_TESTDB" | ||
script: | ||
- phpunit | ||
|
||
Xenial/PostgreSQL: | ||
stage: Unit-Tests with DB | ||
tags: | ||
- ubuntu | ||
- director | ||
variables: | ||
DIRECTOR_TESTDB: "director_test_${CI_BUILD_ID}_${CI_RUNNER_ID}" | ||
DIRECTOR_TESTDB_RES: "Director PostgreSQL TestDB" | ||
DIRECTOR_TESTDB_USER: "director_${CI_BUILD_ID}_${CI_RUNNER_ID}" | ||
before_script: | ||
- psql postgres -q -c "CREATE DATABASE $DIRECTOR_TESTDB WITH ENCODING 'UTF8';" | ||
- psql $DIRECTOR_TESTDB -q -c "CREATE USER $DIRECTOR_TESTDB_USER WITH PASSWORD 'testing'; GRANT ALL PRIVILEGES ON DATABASE $DIRECTOR_TESTDB TO $DIRECTOR_TESTDB_USER; CREATE EXTENSION pgcrypto;" | ||
after_script: | ||
- psql postgres -c "DROP DATABASE $DIRECTOR_TESTDB" | ||
- psql postgres -c "DROP USER $DIRECTOR_TESTDB_USER" | ||
script: | ||
- phpunit | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit backupGlobals="false" | ||
backupStaticAttributes="false" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
syntaxCheck="false" | ||
bootstrap="test/bootstrap.php" | ||
> | ||
<testsuites> | ||
<testsuite name="Director PHP Unit tests"> | ||
<directory suffix=".php">test/php</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[Director MySQL TestDB] | ||
type = "db" | ||
db = "mysql" | ||
host = "localhost" | ||
username = "root" | ||
charset = "utf8" | ||
|
||
[Director PostgreSQL TestDB] | ||
type = "db" | ||
db = "pgsql" | ||
host = "localhost" | ||
password = "testing" | ||
charset = "utf8" |
Empty file.