From 80a020c408229efa8cbcf9a6f8dcb70f6a516e6e Mon Sep 17 00:00:00 2001 From: Lars Dieckow Date: Thu, 2 May 2013 16:36:39 +0200 Subject: [PATCH] consistency check --- Build.PL | 6 +++ t/compile.t | 24 ++++++++++ t/test.conf | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 161 insertions(+) create mode 100644 t/compile.t create mode 100644 t/test.conf diff --git a/Build.PL b/Build.PL index d3116373..f112fe3c 100644 --- a/Build.PL +++ b/Build.PL @@ -22,6 +22,12 @@ my $builder = Module::Build->new( 'Throwable::Error' => 0, 'XML::Simple' => 0, }, + test_requires => { + 'Module::Runtime' => 0, + 'Sipwise::Base' => 0, + 'Test::Fatal' => 0, + 'Test::More' => 0, + }, add_to_cleanup => ['NGCP-Schema-*'], ); $builder->create_build_script; diff --git a/t/compile.t b/t/compile.t new file mode 100644 index 00000000..002e1123 --- /dev/null +++ b/t/compile.t @@ -0,0 +1,24 @@ +use Sipwise::Base; +use Module::Runtime qw(use_module); +use Test::Fatal qw(exception); +use Test::More import => [qw(done_testing ok)]; + +ok use_module('NGCP::Schema::Config')->instance->config_file('t/test.conf'), 'config'; + +for my $class_name (qw( + accounting + billing + carrier + kamailio + ngcp + provisioning + sipstats +)) { + ok(my $class = use_module("NGCP::Schema::$class_name"), "+ load $class_name"); + ok(my $schema = $class->connect, "+ connect $class_name"); + for my $source (sort $schema->sources) { + ok(!exception { $schema->resultset($source)->first }, "select $source"); + } +} + +done_testing; diff --git a/t/test.conf b/t/test.conf new file mode 100644 index 00000000..c7fa7d3f --- /dev/null +++ b/t/test.conf @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + error + unknown + cfu_on + cfu_off + cfb_on + cfb_off + cft_on + cft_off + cfna_on + cfna_off + reminder_on + reminder_off + + + example.com + 1000 + nobody@example.com + + + voicebox + emergency_.* + + Billing + Voip +