aboutsummaryrefslogtreecommitdiffstats
path: root/t/00-check-config.t
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-10-11 09:27:21 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-10-11 09:27:21 +0100
commit2404b1954614d9cd93c44e42a13449b7a7efaae1 (patch)
treee98ff3989d37c120a7f1294d2bf914dc5e89cae3 /t/00-check-config.t
parentdfe953289cc7e3c49ee547110b953b48c2948aab (diff)
parent5934b383754a2d298100a674a1ccefc2cb9e50af (diff)
Merge branch 'bit-of-yaml-tidying'
Diffstat (limited to 't/00-check-config.t')
-rw-r--r--t/00-check-config.t51
1 files changed, 0 insertions, 51 deletions
diff --git a/t/00-check-config.t b/t/00-check-config.t
deleted file mode 100644
index 00e782e74..000000000
--- a/t/00-check-config.t
+++ /dev/null
@@ -1,51 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More;
-use YAML;
-
-use FixMyStreet;
-
-# check that all the fields listed in general.yml-example are also present in
-# general.yml - helps prevent later test failures due to un-noticed additions to the
-# config file.
-
-# This code will bail_out to prevent the test suite proceeding to save time if
-# issues are found.
-
-# load the config file and store the contents in a readonly hash
-
-my $example_config = YAML::LoadFile( FixMyStreet->path_to("conf/general.yml-example") );
-my $CONF_FILE = $ENV{FMS_OVERRIDE_CONFIG} || 'general';
-my $local_config = YAML::LoadFile( FixMyStreet->path_to("conf/${CONF_FILE}.yml") );
-
-# find all keys missing from each config
-my @missing_from_example = find_missing( $example_config, $local_config );
-my @missing_from_local = find_missing( $local_config, $example_config );
-
-if ( @missing_from_example || @missing_from_local ) {
-
- fail "Missing from 'general.yml': $_" for @missing_from_local;
- fail "Missing from 'general.yml-example': $_" for @missing_from_example;
-
- # bail out to prevent other tests failing due to config issues
- BAIL_OUT( "Config has changed"
- . " - update your 'general.yml' and add/remove the keys listed above" );
-}
-else {
- pass "configs contain the same keys";
-}
-
-done_testing();
-
-sub find_missing {
- my $reference = shift;
- my $config = shift;
- my @missing = ();
-
- foreach my $key ( sort keys %$config ) {
- push @missing, $key unless exists $reference->{$key};
- }
-
- return @missing;
-}