TT#81700 generate_test_tt2.pl: add -F option

* this will filter common headers
* fix Content-Length substitution
* run_tests.sh: PROFILE environment as default

Change-Id: Ib0f42f3be6a378e8bfd5e32d7982687fc9869e4e
changes/95/41395/1
Victor Seva 6 years ago
parent d17f8e04b8
commit b459ef3f42

@ -29,14 +29,18 @@ use English;
use utf8;
use JSON;
use Scalar::Util qw(reftype);
use List::MoreUtils qw(uniq);
my @common_hdrs = qw(Via Route Call-ID Expires Max-Forwards);
sub usage
{
my $output = "usage: generate_test_tt2.pl [-h] [-f Header] file\n";
$output .= "\tOptions:\n";
$output .= "-h --help: this help\n";
$output .= "-f --filter: remove this header ( can be used multiple times )\n";
$output .= "-i --ids: subst ids present in scenarios_ids.yml file\n";
$output .= "Options:\n";
$output .= "\t-h --help: this help\n";
$output .= "\t-f --filter: remove this header ( can be used multiple times )\n";
$output .= "\t-F --filter-common: filter common headers:\n";
$output .= "\t\t@common_hdrs\n";
$output .= "\t-i --ids: subst ids present in scenarios_ids.yml file\n";
return $output
}
@ -91,8 +95,8 @@ sub subst_common
$line =~ s/nonce=".+"/nonce=".+"/;
} elsif($line =~ /^Server: Sipwise/i) {
$line =~ s/^: Sipwise .+/: Sipwise NGCP Proxy/;
} elsif($line =~ /^Content-Length: [1-9]/i) {
$line =~ s/: \d+/: \\d+/;
} elsif($line =~ /^Content-Length:[ ]+[1-9]/i) {
$line =~ s/:[ ]+\d+/: \\d+/;
} elsif($line =~ /^P-LB-Uptime: /i) {
$line =~ s/: \d+/: \\d+/;
}
@ -129,14 +133,24 @@ sub filter_header
}
my $help = 0;
my $f_common = 0;
my $f_ids;
GetOptions ("h|help" => \$help, "f|filter=s" => \@headers, "i|ids=s" => \$f_ids)
or die("Error in command line arguments\n".usage());
GetOptions (
"h|help" => \$help,
"f|filter=s" => \@headers,
"F|filter-common" => \$f_common,
"i|ids=s" => \$f_ids,
) or die("Error in command line arguments\n".usage());
if($#ARGV!=0 || $help)
{
die(usage())
}
if($f_common) {
@headers = uniq(@headers, @common_hdrs);
}
my $filename = abs_path($ARGV[0]);
my $json;
{

@ -14,7 +14,7 @@ SEMS_PBX_LOG=${SEMS_PBX_LOG:-"/var/log/ngcp/sems-pbx.log"}
TMP_LOG_DIR="/tmp"
KAM_DIR="/tmp/cfgtest"
COREDUMP_DIR="/ngcp-data/coredumps"
PROFILE="CE"
PROFILE="${PROFILE:-CE}"
OPTS=(-P -T -M) #SKIP_PARSE=true, SKIP_TESTS=true, SKIP_MOVE_JSON_KAM=true
DOMAIN="spce.test"
TIMEOUT=${TIMEOUT:-300}

Loading…
Cancel
Save