Add skip list for mcp pike.
Add ability to run tempest with skip list
Upstream patch https://review.openstack.org/#/c/522768/
Change-Id: Ifca6192188546b2177745bd80983101339408481
Closes-Issue: https://mirantis.jira.com/browse/PROD-19171
diff --git a/bin/patches/regex_builder.patch b/bin/patches/regex_builder.patch
new file mode 100644
index 0000000..b29bf4a
--- /dev/null
+++ b/bin/patches/regex_builder.patch
@@ -0,0 +1,77 @@
+--- os_testr/regex_builder.py 2018-04-25 11:33:36.330640993 +0300
++++ os_testr/regex_builder.py 2018-04-25 11:33:54.878627168 +0300
+@@ -71,34 +71,46 @@
+ return '|'.join(lines)
+
+
+-def construct_regex(blacklist_file, whitelist_file, regex, print_exclude):
+- """Deprecated, please use testlist_builder.construct_list instead."""
+- if not blacklist_file:
++def get_regex_from_blacklist_file(file_path, print_exclude=False):
++ exclude_regex = ''
++ with open(file_path, 'r') as black_file:
+ exclude_regex = ''
+- else:
+- with open(blacklist_file, 'r') as black_file:
+- exclude_regex = ''
+- for line in black_file:
+- raw_line = line.strip()
+- split_line = raw_line.split('#')
+- # Before the # is the regex
+- line_regex = split_line[0].strip()
+- if len(split_line) > 1:
+- # After the # is a comment
+- comment = split_line[1].strip()
++ for line in black_file:
++ raw_line = line.strip()
++ split_line = raw_line.split('#')
++ # Before the # is the regex
++ line_regex = split_line[0].strip()
++ if len(split_line) > 1:
++ # After the # is a comment
++ comment = split_line[1].strip()
++ else:
++ comment = ''
++ if line_regex:
++ if print_exclude:
++ print_skips(line_regex, comment)
++ if exclude_regex:
++ exclude_regex = '|'.join([line_regex, exclude_regex])
+ else:
+- comment = ''
+- if line_regex:
+- if print_exclude:
+- print_skips(line_regex, comment)
+- if exclude_regex:
+- exclude_regex = '|'.join([line_regex, exclude_regex])
+- else:
+- exclude_regex = line_regex
+- if exclude_regex:
+- exclude_regex = "^((?!" + exclude_regex + ").)*$"
+- if regex:
+- exclude_regex += regex
+- if whitelist_file:
+- exclude_regex += '%s' % get_regex_from_whitelist_file(whitelist_file)
++ exclude_regex = line_regex
++ if exclude_regex:
++ exclude_regex = "(?!" + exclude_regex + ")"
+ return exclude_regex
++
++
++def construct_regex(blacklist_file, whitelist_file, regex, print_exclude):
++ """Deprecated, please use testlist_builder.construct_list instead."""
++ bregex = ''
++ wregex = ''
++ pregex = ''
++
++ if blacklist_file:
++ bregex = get_regex_from_blacklist_file(blacklist_file, print_exclude)
++ if whitelist_file:
++ wregex = get_regex_from_whitelist_file(whitelist_file)
++ if regex:
++ pregex = regex
++ combined_regex = '^%s.*(%s).*$' % (bregex, '|'.join(
++ filter(None, [pregex, wregex])
++ ))
++
++ return combined_regex
diff --git a/bin/run_tempest.sh b/bin/run_tempest.sh
index 2c2138e..0bcec09 100755
--- a/bin/run_tempest.sh
+++ b/bin/run_tempest.sh
@@ -13,15 +13,17 @@
report='report_'`date +%F_%H-%M`
fi
-log=$LOG_DIR/$report.log
+log=$LOG_DIR/${report}.log
cd $LOG_DIR
rm -rf env
tempest init env | tee -a $log
cd env
-tempest run $ARGS | tee -a $log
-if [[ "$ARGS" =~ '-r ' || "$ARGS" =~ '--regex' || "$ARGS" =~ '-s' || "$ARGS" =~ '-w' || "$ARGS" =~ '' ]]; then
+cp /var/lib/tempest/skiplists/*.list $LOG_DIR/env
+
+tempest run $ARGS | tee -a ${log}
+
+if [[ "$ARGS" =~ '-r ' || "$ARGS" =~ '--regex' || "$ARGS" =~ '-s' || "$ARGS" =~ '--smoke' || "$ARGS" =~ '--blacklist-file' || "$ARGS" =~ '-w' || "$ARGS" == '' ]]; then
testr last --subunit | subunit2junitxml > $LOG_DIR/$report.xml || true
fi
-
diff --git a/bin/skiplists/mcp_pike_lvm_skip.list b/bin/skiplists/mcp_pike_lvm_skip.list
new file mode 100644
index 0000000..564201c
--- /dev/null
+++ b/bin/skiplists/mcp_pike_lvm_skip.list
@@ -0,0 +1 @@
+manila_tempest_tests.tests.api.admin.test_share_types_negative.ShareTypesAdminNegativeTest.test_create_share_type_with_description_in_wrong_version