aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2019-05-08 22:10:06 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2019-05-13 11:53:24 +0100
commitf7873a97d3be13251da30f12705c3dafa5468995 (patch)
treec79a9e1ebae538eefc2cb74e1ecf46fbc50bfc31
parent0796a2b6821e75e22ec6eacd3950ef916b16303d (diff)
[Travis] Split coverage tests, fix coverage ignore
-rw-r--r--.travis.yml30
-rw-r--r--perllib/FixMyStreet/TestAppProve.pm2
-rw-r--r--t/open311/getservicerequestupdates.t9
-rw-r--r--t/open311/post-service-request-updates.t4
4 files changed, 30 insertions, 15 deletions
diff --git a/.travis.yml b/.travis.yml
index 6f3b3808a..9e3b2c107 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -11,14 +11,8 @@ notifications:
urls:
secure: "x6M1u9SFv2oQpo28wDSpURV0Rnk+jTA5VCXIjlo0ccbEV1IOp36KSJT3A2lSbf2BDlwGlKcbgtMP9dk83So2dhvPow7ogemouW+Rx1olYJgzoTR3v5cZt9pn7g6y0O1M+AkDIzabzT90oRD4//YVY5OS16ZjePcBWwp9yHEEQ7I="
+# Put the versions in the matrix below so that we're ordered better
language: perl
-perl:
- - "5.18" # trusty
- - "5.20" # jessie
- - "5.22" # xenial
- - "5.24" # stretch
- - "5.26" # bionic
- - "5.28" # buster
cache:
directories:
@@ -27,13 +21,23 @@ cache:
matrix:
include:
+ - perl: "5.24" # stretch
+ - perl: "5.26" # bionic
+ env: "COVERAGE_PART=1" # Running the tests with coverage is much slower, so split the test run in two
+ - perl: "5.26"
+ env: "COVERAGE_PART=2"
- perl: "5.22"
- env: "CYPRESS=1"
+ env: "CYPRESS=1" # Run headless browser tests
+ - perl: "5.22" # xenial
+ - perl: "5.18" # trusty
+ - perl: "5.20" # jessie
+ - perl: "5.28" # buster
env:
global:
- "S3_BUCKET=fixmystreet-bundle-cache"
- "CYPRESS=0"
+ - "COVERAGE_PART=0"
- secure: "llgWNfR/8pH0HjYpg+xhVxuqTaLC0GGUugfuINiUap7JxzjCZ2rlryxCXA4BCM8GUHa9wlYKhrKCSx+DM3EHRE0cLei7LNxAK1JSXLj3NihFQhqnq64tjDwGCSA4l7mlqErA7DK4Dpmh+hBp5f680akITAInM92CbwQZxLDYaCU="
- secure: "qW+WCgAF68itADxcbcq+nCnKx3vf3GX73HMfjfbkFFUsYmIR+ZaJ9yQMnGJwxIpCHTWLAeqyx4KO8N8T3GmNdKYzIMZemOzp4ED29YC31QOQeq1CwNp2hD5sq/o47d2BzXWwMYNvNXfxz1K6r2c6EMPUtu8X3B8ExZq1RzSFdXs="
@@ -48,14 +52,16 @@ addons:
install:
- .travis/install
- - 'if [ "$TRAVIS_PERL_VERSION" = "5.24" ]; then cpanm --quiet --notest Devel::Cover::Report::Codecov; fi'
+ - 'if [ "$COVERAGE_PART" != "0" ]; then cpanm --quiet --notest Devel::Cover::Report::Codecov; fi'
- 'if [ "$CYPRESS" = "1" ]; then npm install cypress; fi'
before_script:
- commonlib/bin/gettext-makemo FixMyStreet
- - 'if [ "$TRAVIS_PERL_VERSION" = "5.24" ]; then export HARNESS_PERL_SWITCHES="-MDevel::Cover=+ignore,local/lib/perl5,commonlib,perllib/Catalyst/[^A],perllib/DBIx,perllib/Email,perllib/Template,^t"; fi'
+ - 'if [ "$COVERAGE_PART" != "0" ]; then export HARNESS_PERL_SWITCHES="-MDevel::Cover=+ignore,local/lib/perl5,commonlib,perllib/Catalyst/[^A],perllib/Email,^t"; fi'
script:
- - 'if [ "$CYPRESS" = "0" ]; then script/test --jobs 3 t; fi'
+ - 'if [ "$CYPRESS" = "0" ] && [ "$COVERAGE_PART" = "0" ]; then script/test --jobs 3 t; fi'
+ - 'if [ "$COVERAGE_PART" = "1" ]; then script/test --jobs 3 `find t/app/controller -name "*.t"`; fi'
+ - 'if [ "$COVERAGE_PART" = "2" ]; then script/test --jobs 3 `find t -name "*.t" ! -path "t/app/controller*"`; fi'
- 'if [ "$CYPRESS" = "1" ]; then PATH=$(npm bin):$PATH bin/browser-tests run ${CYPRESS_RECORD_KEY:+--record}; fi'
after_success:
- .travis/after_script
- - 'if [ "$TRAVIS_PERL_VERSION" = "5.24" ]; then cover --report codecov; fi'
+ - 'if [ "$COVERAGE_PART" != "0" ]; then cover --report codecov; fi'
diff --git a/perllib/FixMyStreet/TestAppProve.pm b/perllib/FixMyStreet/TestAppProve.pm
index 3786efaac..ec245e72c 100644
--- a/perllib/FixMyStreet/TestAppProve.pm
+++ b/perllib/FixMyStreet/TestAppProve.pm
@@ -113,7 +113,7 @@ sub run {
# If no arguments, test everything
$prove->argv(['t']) unless @{$prove->argv};
# verbose if we have a single file
- $prove->verbose(1) if @{$prove->argv} and -f $prove->argv->[-1];
+ $prove->verbose(1) if @{$prove->argv} and -f $prove->argv->[-1] && !$ENV{CI};
# we always want to recurse
$prove->recurse(1);
# we always want to save state
diff --git a/t/open311/getservicerequestupdates.t b/t/open311/getservicerequestupdates.t
index c3ce2118a..e53921156 100644
--- a/t/open311/getservicerequestupdates.t
+++ b/t/open311/getservicerequestupdates.t
@@ -12,6 +12,7 @@ use_ok( 'Open311' );
use_ok( 'Open311::GetServiceRequestUpdates' );
use DateTime;
use DateTime::Format::W3CDTF;
+use File::Temp 'tempdir';
use FixMyStreet::DB;
my $user = FixMyStreet::DB->resultset('User')->find_or_create(
@@ -508,6 +509,13 @@ for my $test (
}
subtest 'Update with media_url includes image in update' => sub {
+ my $UPLOAD_DIR = tempdir( CLEANUP => 1 );
+ FixMyStreet::override_config {
+ PHOTO_STORAGE_BACKEND => 'FileSystem',
+ PHOTO_STORAGE_OPTIONS => {
+ UPLOAD_DIR => $UPLOAD_DIR,
+ },
+ }, sub {
my $guard = LWP::Protocol::PSGI->register(t::Mock::Static->to_psgi_app, host => 'example.com');
my $local_requests_xml = setup_xml($problem->external_id, 1, "");
@@ -527,6 +535,7 @@ subtest 'Update with media_url includes image in update' => sub {
is $c->external_id, 638344;
is $c->photo, '74e3362283b6ef0c48686fb0e161da4043bbcc97.jpeg', 'photo exists';
$problem->comments->delete;
+ };
};
subtest 'Update with customer_reference adds reference to problem' => sub {
diff --git a/t/open311/post-service-request-updates.t b/t/open311/post-service-request-updates.t
index 57b8f9a2a..6a7bc6ff2 100644
--- a/t/open311/post-service-request-updates.t
+++ b/t/open311/post-service-request-updates.t
@@ -15,8 +15,8 @@ my $params = {
endpoint => 'endpoint',
jurisdiction => 'home',
};
-my $bromley = $mech->create_body_ok(2482, 'Bromley', { %$params, send_extended_statuses => 1, id => 5 });
-my $oxon = $mech->create_body_ok(2237, 'Oxfordshire', { %$params, id => 55 });
+my $bromley = $mech->create_body_ok(2482, 'Bromley', { %$params, send_extended_statuses => 1 });
+my $oxon = $mech->create_body_ok(2237, 'Oxfordshire', { %$params, id => "5" . $bromley->id });
my $bucks = $mech->create_body_ok(2217, 'Buckinghamshire', $params);
my $lewisham = $mech->create_body_ok(2492, 'Lewisham', $params);