[Rt-commit] rt branch, 4.4/docker-test-debian, created. rt-4.4.4-92-ged92fa39c

Jim Brandt jbrandt at bestpractical.com
Thu Mar 12 13:49:48 EDT 2020


The branch, 4.4/docker-test-debian has been created
        at  ed92fa39c5b7efb903664edb1bf522b6a458a95d (commit)

- Log -----------------------------------------------------------------
commit d34d59696f0d1acc2df8a821fc5cf4a110bcba75
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri Feb 28 10:38:53 2020 -0500

    Set undef for test plan
    
    Calling done_testing without tests => undef cause a warning
    about multiple TAP plans:
    
    More than one plan found in TAP output

diff --git a/t/web/shredder.t b/t/web/shredder.t
index 67e6c823e..47ea111c5 100644
--- a/t/web/shredder.t
+++ b/t/web/shredder.t
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use RT::Test;
+use RT::Test tests => undef;
 
 RT::Config->Set('ShredderStoragePath', RT::Test->temp_directory . '');
 

commit 504e2e244a29df9fb714ee42b7ee46b6a9138392
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Thu Mar 12 13:42:11 2020 -0400

    Allow RT_HOST to be set via environment variable for testing
    
    When running tests against a MySQL or MariaDB database
    running on a separate server, $DatabaseRTHost must be
    set so the rights for test users can be properly set
    like 'urt4test_11284'@'172.17.0.3' in the test DB. If
    this isn't set, test users can't connect to the remote
    test database tests will fail.

diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index db2f25dc0..9c2d58dcd 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -324,6 +324,10 @@ Set( \$ShowHistory, "always");
     if ( $ENV{'RT_TEST_DB_HOST'} ) {
         print $config "Set( \$DatabaseHost , '$ENV{'RT_TEST_DB_HOST'}');\n";
     }
+    if ( $ENV{'RT_TEST_RT_HOST'} ) {
+        # Used to add rights for test users in the DB when testing mysql/mariadb
+        print $config "Set( \$DatabaseRTHost , '$ENV{'RT_TEST_RT_HOST'}');\n";
+    }
 
     if ( $args{'plugins'} ) {
         print $config "Set( \@Plugins, qw(". join( ' ', @{ $args{'plugins'} } ) .") );\n";

commit ed92fa39c5b7efb903664edb1bf522b6a458a95d
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Thu Mar 12 13:48:48 2020 -0400

    Add configuration for testing on Travis with Docker

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 000000000..1331c1b92
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,16 @@
+language: bash
+services: docker
+
+env:
+  - RT_TEST_PARALLEL=1 RT_DBA_USER=root RT_DBA_PASSWORD=password DB_VERSION_TAG=10.3
+
+# $TRAVIS_BUILD_DIR will have a clone of the current branch
+before_install:
+  - docker run --name mariadb -e MYSQL_ROOT_PASSWORD=password -d mariadb:$DB_VERSION_TAG
+  - docker build -t rt-base .
+  - docker run -d -v $TRAVIS_BUILD_DIR:/rt --name rt --link mariadb:db rt-base
+  - docker ps -a
+  - docker exec -it rt bash -c "cd /rt && ./configure.ac --with-db-type=mysql --with-my-user-group --enable-layout=inplace --enable-developer --enable-externalauth --disable-gpg --disable-smime && mkdir -p /rt/var && make testdeps"
+
+script:
+    - docker exec -it rt bash -c "cd /rt && prove -lj9 t/*"
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 000000000..98bafcd6c
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,12 @@
+# This Dockerfile is for testing only.
+
+FROM bpssysadmin/rt-base-debian-stretch
+
+ENV RT_TEST_PARALLEL 1
+ENV RT_TEST_DEVEL 1
+ENV RT_DBA_USER root
+ENV RT_DBA_PASSWORD password
+ENV RT_TEST_DB_HOST=172.17.0.2
+ENV RT_TEST_RT_HOST=172.17.0.3
+
+CMD tail -f /dev/null
diff --git a/docs/hacking.pod b/docs/hacking.pod
index c8c3fb107..15742fb75 100644
--- a/docs/hacking.pod
+++ b/docs/hacking.pod
@@ -168,9 +168,15 @@ line) is to be loc'd.  This is useful for inline hashes:
 
 =head2 Test suite
 
-RT also comes with a fairly complete test suite.  To run it, you will
-need to set environment variables to a database user and password which
-can create and drop databases:
+RT also comes with a fairly complete test suite. The C<*-trunk> and
+C<master> branches are expected to always be passing all tests.  While
+it is acceptable to break tests in an intermediate commit, a branch
+which does not pass tests will not be merged.  Ideally, commits which
+fix a bug should also include a test case which fails before the fix
+and succeeds after.
+
+To run RT's test suite, first set environment variables to a database
+user and password which can create and drop databases:
 
     export RT_DBA_USER=root
     export RT_DBA_PASSWORD=
@@ -189,16 +195,18 @@ To run the test suite:
 
     make test
 
-If you have multiple processors, you can run the test suite in parallel,
-which will be significantly faster:
-
-    make test-parallel
-
 If you want to run only a subset of the tests, you can use Perl's standard
 C<prove> utility.
 
     prove -l t/api/ticket.t t/web/ticket_display.t
 
+=head2 Parallel Tests
+
+If you have multiple processors, you can run the test suite in parallel,
+which will be significantly faster:
+
+    make test-parallel
+
 If you want to run a subset of the tests in parallel, you can pass the C<-j>
 flag to C<prove> with the number of processes to use. Make sure to also set the
 C<RT_TEST_PARALLEL> environment variable to a true value to tell RT you're
@@ -206,13 +214,21 @@ running the tests in parallel.
 
     RT_TEST_PARALLEL=1 prove -l -j4 t/customfields/*.t
 
-The C<*-trunk> and C<master> branches are expected to always be passing
-all tests.  While it is acceptable to break tests in an intermediate
-commit, a branch which does not pass tests will not be merged.  Ideally,
-commits which fix a bug should also include a testcase which fails
-before the fix and succeeds after.
-
-
+=head2 Tests with Docker
+
+RT has a Dockerfile that can be used to run the test suite for some configurations.
+To run it you need a system that can run docker natively or run the docker desktop
+client. Once installed, you can look in the .travis.yml file for the set of commands
+to run to kick off the tests inside docker containers. Run all commands in the
+before_install and script sections, replacing any variables with appropriate
+values for your system.
+
+You can replace $TRAVIS_BUILD_DIR with you current working directory if you are
+in a branch. Note that the docker commands in the Travis configuration mount
+your directory inside the docker container. This means any stray files you have
+in your working directory will also be visible to the processes inside the
+docker container. This can cause test failures if unexpected files are
+there.
 
 =head1 git quickstart
 

-----------------------------------------------------------------------


More information about the rt-commit mailing list