From b81c66ffc2fb4e767765682e145a0bbf4bf44973 Mon Sep 17 00:00:00 2001 From: Kirill Solomko Date: Thu, 7 Jul 2022 12:05:00 +0200 Subject: [PATCH] TT#182101 add api-rest/testrunner CE support * testrunner can now be run with "stable-ce" or "fast-ce" commands that exclude endpoints that are not available in CE Change-Id: I9c40a82c11b5bd2e88102b545d6ead4a64087326 --- t/api-rest/api-root.t | 16 +++++++++++----- t/api-rest/testrunner | 14 ++++++++++++-- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/t/api-rest/api-root.t b/t/api-rest/api-root.t index 5019b07010..9d88efa468 100644 --- a/t/api-rest/api-root.t +++ b/t/api-rest/api-root.t @@ -6,6 +6,7 @@ use JSON qw(); use Test::More; my $uri = $ENV{CATALYST_SERVER} || ('https://'.hostfqdn.':4443'); +my $ngcp_type = $ENV{NGCP_TYPE} || "sppro"; my ($ua, $req, $res); @@ -94,10 +95,6 @@ $ua = Test::Collection->new()->ua(); interceptions => 1, invoices => 1, invoicetemplates => 1, - headerrulesets => 1, - headerrules => 1, - headerruleconditions => 1, - headerruleactions => 1, lnpcarriers => 1, lnpnumbers => 1, ncoslnppatterns => 1, @@ -132,7 +129,6 @@ $ua = Test::Collection->new()->ua(); peeringserverpreferencedefs => 1, peeringserverpreferences => 1, peeringservers => 1, - phonebookentries => 1, resellerbrandings => 1, resellerpreferencedefs => 1, resellerpreferences => 1, @@ -175,6 +171,16 @@ $ua = Test::Collection->new()->ua(); voicemailsettings => 1, vouchers => 1, }; + + # PRO/Carrier only links + if ($ngcp_type eq 'sppro' || $ngcp_type eq 'carrier') { + $rels->{phonebookentries} = 1; + $rels->{headerrulesets} = 1; + $rels->{headerrules} = 1; + $rels->{headerruleconditions} = 1; + $rels->{headerruleactions} = 1; + } + foreach my $link(@links) { my $rex = qr!^; rel="collection http://purl\.org/sipwise/ngcp-api/#rel-([a-z]+s|topupcash|managersecretary|userinfo|passwordre(set|covery))"$!; like($link, $rex, "check for valid link syntax"); diff --git a/t/api-rest/testrunner b/t/api-rest/testrunner index 06e16473a2..dba2376511 100755 --- a/t/api-rest/testrunner +++ b/t/api-rest/testrunner @@ -12,6 +12,7 @@ SERVER="${1:-}" SELECT="${2:-all}" OUTPUT_DIRECTORY="${3:-/code/}" FORMAT="${4:-pretty}" +NGCP_TYPE="sppro" if [ -z "${SERVER}" ] ; then echo "Usage: $0 [] [] [junit]" >&2 @@ -24,11 +25,19 @@ if [ -z "${SERVER}" ] ; then fi if [ "${SELECT}" = "stable" ] ; then - echo "Test selection: ${SELECT}" + echo "Test selection (${NGCP_TYPE}): ${SELECT}" SELECT=$(echo ./t/api-rest/api-{all-links,balanceintervals,bannedips,bannedusers,billingfees,billingnetworks,billingprofiles,billingzones,calllists,calls,cert-auth,cfdestinationsets,contracts,conversations,customercontacts,customers,emailtemplates,faxes,journals,headerrulesets,lnp,ncoslevels,pbxdevicemodels,pbxdevices,peeringgroups,peeringrules,peeringinboundrules,peeringservers,preferences,profilepackages,resellers,rewriterules,rewriterulesets,root,soundsets,subscriberregistrations,subscribers,systemcontacts,threads,topuplogs,trustedsources,valid-patch,vouchers,method-override}.t) +elif [ "${SELECT}" = "stable-ce" ] ; then + NGCP_TYPE="spce" + echo "Test selection (${NGCP_TYPE}): ${SELECT}" + SELECT=$(echo ./t/api-rest/api-{all-links,balanceintervals,bannedips,bannedusers,billingfees,billingnetworks,billingprofiles,billingzones,calllists,calls,cert-auth,cfdestinationsets,contracts,conversations,customercontacts,customers,emailtemplates,faxes,journals,lnp,ncoslevels,pbxdevicemodels,pbxdevices,peeringgroups,peeringrules,peeringinboundrules,peeringservers,preferences,profilepackages,resellers,rewriterules,rewriterulesets,root,soundsets,subscriberregistrations,subscribers,systemcontacts,threads,topuplogs,trustedsources,valid-patch,vouchers,method-override}.t) elif [ "${SELECT}" = "fast" ] ; then - echo "Test selection: ${SELECT}" + echo "Test selection (${NGCP_TYPE}): ${SELECT}" SELECT=$(echo ./t/api-rest/api-{bannedips,bannedusers,billingnetworks,billingzones,calls,cert-auth,cfdestinationsets,headerrulesets,ncoslevels,peeringgroups,peeringrules,peeringinboundrules,peeringservers,resellers,rewriterules,root,soundsets,systemcontacts,valid-patch,vouchers,method-override}.t) +elif [ "${SELECT}" = "fast-ce" ] ; then + NGCP_TYPE="spce" + echo "Test selection (${NGCP_TYPE}): ${SELECT}" + SELECT=$(echo ./t/api-rest/api-{bannedips,bannedusers,billingnetworks,billingzones,calls,cert-auth,cfdestinationsets,ncoslevels,peeringgroups,peeringrules,peeringinboundrules,peeringservers,resellers,rewriterules,root,soundsets,systemcontacts,valid-patch,vouchers,method-override}.t) elif [ "${SELECT}" = "all" ] ; then echo "Test selection: all" SELECT=$(echo ./t/api-rest/*.t) @@ -42,6 +51,7 @@ echo "Finished main setup, now running tests ..." export CATALYST_SERVER_SUB="https://${SERVER}:443" export CATALYST_SERVER="https://${SERVER}:1443" export NGCP_SESSION_ID="$(printf %03d $((RANDOM % 1000)))$(date +%s)" +export NGCP_TYPE RC=0 if [ "${FORMAT}" = "junit" ] ; then