Skip to content

Commit d8f690e

Browse files
committed
use regex list to skip.
1 parent 7c174bb commit d8f690e

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

Tests/kaas/sonobuoy_handler/sonobuoy_handler.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from collections import Counter
2-
import json
32
import logging
3+
import re
44
import os
55
import sys
66
import os.path
@@ -134,13 +134,32 @@ def sonobuoy_parse_result(plugin, sonobuoy_results_yaml_path):
134134
for item in item2.get("items", ()):
135135
# testcase ... or so
136136
status = item.get("status", "skipped")
137-
counter[status] += 1
138137
if status == "failed":
139-
logger.error(f"FAILED: {item['name']}")
138+
if ok_to_fail(item["name"]):
139+
status = "failed_ok"
140+
else:
141+
logger.error(f"FAILED: {item['name']}")
142+
counter[status] += 1
143+
140144
logger.info(f"{plugin} results: {_fmt_result(counter)}")
141145
return counter
142146

143147

148+
def ok_to_fail(test_name):
149+
# TODO: Make this configurable
150+
regexs = [
151+
"HostPort validates that there is no conflict between pods with same hostPort but different hostIP and protocol",
152+
"Services should be able to switch session affinity for NodePort service",
153+
"Services should have session affinity work for NodePort service",
154+
"validates that there exists conflict between pods with same hostPort and protocol but one using 0.0.0.0 hostIP",
155+
]
156+
name = test_name
157+
for regex in regexs:
158+
if re.search(regex, name):
159+
return True
160+
return False
161+
162+
144163
def usage():
145164
print(
146165
f"""{sys.argv[0]} path-to/sonobuoy_results.yaml

0 commit comments

Comments
 (0)