test compilation of all scripts and modules (#537)

* test compilation of all scripts and modules passes

* try adding NetSNMP::default_store

* try adding NetSNMP::default_store

* travis test all branches

* make Configuration.pm safe for tests

* remove dep

* try adding net-snmp

* dist: xenial

* try building Net-SNMP locally

* no need for Try::Tiny

* allow test to pass for DPP:p

* better testing setup for session cookies

* yay! working compile tests for ALL!
This commit is contained in:
Oliver Gorwits
2019-03-12 13:02:35 +00:00
committed by GitHub
parent a138325175
commit 65f695410e
5 changed files with 46 additions and 9 deletions

View File

@@ -6,11 +6,12 @@ addons:
- phantomjs
hosts:
- localhost
#branches:
# only:
# - /^2\.\d{6}$/
# - 'master'
install: true
branches:
only:
- /^2\.\d{6}$/
- 'master'
install:
- cpanm --quiet --notest PkgConfig Test::CChecker Alien::zlib::Static Alien::OpenSSL::Static Alien::SNMP
script: |
perl Build.PL && \
./Build && \

View File

@@ -96,6 +96,7 @@ Module::Build->new(
test_requires => {
'Test::More' => '1.302083',
'Env::Path' => '0',
'Test::Compile' => '0',
'Test::File::ShareDir::Dist' => '0',
},
script_files => [

View File

@@ -66,9 +66,13 @@ if (setting('template_paths') and ref [] eq ref setting('template_paths')) {
# load cookie key from database
setting('session_cookie_key' => undef);
my $sessions = schema('netdisco')->resultset('Session');
my $skey = $sessions->find({id => 'dancer_session_cookie_key'});
setting('session_cookie_key' => $skey->get_column('a_session')) if $skey;
setting('session_cookie_key' => 'this_is_for_testing_only')
if $ENV{HARNESS_ACTIVE};
eval {
my $sessions = schema('netdisco')->resultset('Session');
my $skey = $sessions->find({id => 'dancer_session_cookie_key'});
setting('session_cookie_key' => $skey->get_column('a_session')) if $skey;
};
Dancer::Session::Cookie::init(session);
# workaround for https://github.com/PerlDancer/Dancer/issues/935

View File

@@ -11,7 +11,8 @@ register_worker({ phase => 'main' }, sub {
my $extra = $job->extra;
my $config = config();
p ($extra ? $config->{$extra} : $config);
my $dump = ($extra ? $config->{$extra} : $config);
p $dump;
return Status->done('Dumped config');
});

30
xt/00-compile.t Normal file
View File

@@ -0,0 +1,30 @@
#!/usr/bin/env perl
use strict;
use warnings;
BEGIN {
use FindBin;
FindBin::again();
use Path::Class;
# stuff useful locations into @INC and $PATH
unshift @INC,
dir($FindBin::RealBin)->parent->subdir('lib')->stringify,
dir($FindBin::RealBin, 'lib')->stringify;
}
# for netdisco app config
use App::Netdisco;
use Test::Compile;
my $test = Test::Compile->new();
my @plfiles = grep {$_ !~ m/(?:sshcollector|graph)/i} $test->all_pl_files();
my @pmfiles = grep {$_ !~ m/(?:sshcollector|graph)/i} $test->all_pm_files();
$test->ok($test->pl_file_compiles($_), "$_ compiles") for @plfiles;
$test->ok($test->pm_file_compiles($_), "$_ compiles") for @pmfiles;
$test->done_testing();