Skip to content

Commit db6d0b0

Browse files
changed tests and trivial bug fix
Signed-off-by: Shashank Reddy Boyapally <sboyapal@redhat.com>
1 parent 090d3c5 commit db6d0b0

File tree

4 files changed

+39
-15
lines changed

4 files changed

+39
-15
lines changed

orion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def cmd_analysis(**kwargs):
128128
with open(output_file_name, 'w', encoding="utf-8") as file:
129129
file.write(str(result_table))
130130
if regression_flag:
131-
sys.exit(1)
131+
sys.exit(2) ## regression detected
132132

133133

134134

pkg/algorithms/algorithm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def output_junit(self) -> Tuple[str,str, bool]:
8585
Returns:
8686
_type_: return
8787
"""
88-
test_name, data_json = self.output_json()
88+
test_name, data_json, _ = self.output_json()
8989
data_json = json.loads(data_json)
9090
data_junit = json_to_junit(
9191
test_name=test_name,

pkg/runTest.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
run test
33
"""
4+
import sys
45
from typing import Any, Dict
56
from fmatch.matcher import Matcher
67
from fmatch.logrus import SingletonLogger
@@ -43,15 +44,16 @@ def run(**kwargs: dict[str, Any]) -> dict[str, Any]: #pylint: disable = R0914
4344
kwargs,
4445
start_timestamp,
4546
)
47+
4648
if fingerprint_matched_df is None:
47-
return None
49+
sys.exit(3) # No data present
4850

4951
if kwargs["hunter_analyze"]:
5052
algorithm_name = cnsts.EDIVISIVE
5153
elif kwargs["anomaly_detection"]:
5254
algorithm_name = cnsts.ISOLATION_FOREST
5355
else:
54-
return None
56+
return None, None
5557

5658
algorithmFactory = AlgorithmFactory()
5759
algorithm = algorithmFactory.instantiate_algorithm(

test.bats

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,21 @@
66
run_cmd(){
77
echo "$@"
88
${@}
9+
EXIT_CODE=$?
10+
11+
if [ $EXIT_CODE -eq 2 ]; then
12+
echo "Exit code 2 encountered, regression detected, treating as success"
13+
return 0
14+
elif [ $EXIT_CODE -eq 3 ]; then
15+
echo "Exit code 3 encountered, not enough data"
16+
return 0
17+
else
18+
return $EXIT_CODE
19+
fi
920
}
1021

1122
setup() {
1223
# Make a note of daemon PID
13-
orion daemon --port 8080 &
14-
DAEMON_PID=$!
15-
echo "Orion daemon started with PID $DAEMON_PID"
1624
export ES_SERVER="$QE_ES_SERVER"
1725
export es_metadata_index="perf_scale_ci*"
1826
export es_benchmark_index="ripsaw-kube-burner*"
@@ -24,11 +32,11 @@ setup() {
2432
}
2533

2634
@test "orion cmd payload scale 4.15 " {
27-
run_cmd orion cmd --config "examples/payload-scale-415.yaml" --lookback 5d
35+
run_cmd orion cmd --config "examples/payload-scale-415.yaml" --lookback 5d --hunter-analyze
2836
}
2937

3038
@test "orion cmd payload scale 4.16 without lookback period " {
31-
run_cmd orion cmd --config "examples/payload-scale-416.yaml"
39+
run_cmd orion cmd --config "examples/payload-scale-416.yaml" --hunter-analyze
3240
}
3341

3442
@test "orion cmd readout control plane cdv2 with text output " {
@@ -45,6 +53,7 @@ setup() {
4553

4654

4755
@test "orion cmd readout netperf tcp with junit output " {
56+
export es_benchmark_index="k8s-netperf"
4857
run_cmd orion cmd --config "examples/readout-netperf-tcp.yaml" --output-format junit --hunter-analyze --save-output-path=output.xml
4958
}
5059

@@ -73,23 +82,36 @@ setup() {
7382
}
7483

7584
@test "orion daemon small scale cluster density with anomaly detection " {
85+
orion daemon --port 8080 &
86+
DAEMON_PID=$!
87+
echo "Orion daemon started with PID $DAEMON_PID"
7688
run_cmd curl http://127.0.0.1:8080/daemon/anomaly?convert_tinyurl=True&test_name=small-scale-cluster-density
89+
if [ ! -z "$DAEMON_PID" ]; then
90+
kill $DAEMON_PID
91+
echo "Orion daemon with PID $DAEMON_PID killed"
92+
fi
7793
}
7894

7995
@test "orion daemon small scale node density cni with changepoint detection " {
96+
orion daemon --port 8080 &
97+
DAEMON_PID=$!
98+
echo "Orion daemon started with PID $DAEMON_PID"
8099
run_cmd curl http://127.0.0.1:8080/daemon/changepoint?filter_changepoints=true&test_name=small-scale-node-density-cni
100+
if [ ! -z "$DAEMON_PID" ]; then
101+
kill $DAEMON_PID
102+
echo "Orion daemon with PID $DAEMON_PID killed"
103+
fi
81104
}
82105

83106
@test "orion daemon trt payload cluster density with version parameter " {
107+
orion daemon --port 8080 &
108+
DAEMON_PID=$!
109+
echo "Orion daemon started with PID $DAEMON_PID"
84110
run_cmd curl http://127.0.0.1:8080/daemon/changepoint?version=4.17&filter_changepoints=false&test_name=trt-payload-cluster-density
85-
}
86-
87-
teardown() {
88-
# Kill the daemon using its PID
89111
if [ ! -z "$DAEMON_PID" ]; then
90112
kill $DAEMON_PID
91113
echo "Orion daemon with PID $DAEMON_PID killed"
92-
else
93-
echo "No daemon PID found"
94114
fi
95115
}
116+
117+

0 commit comments

Comments
 (0)