Skip to content

Commit

Permalink
Merge pull request #70 from shashank-boyapally/requirements-update
Browse files Browse the repository at this point in the history
changed tests and trivial bug fix
  • Loading branch information
vishnuchalla authored Sep 13, 2024
2 parents 796c087 + db6d0b0 commit 7219dc1
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 15 deletions.
2 changes: 1 addition & 1 deletion orion.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def cmd_analysis(**kwargs):
with open(output_file_name, 'w', encoding="utf-8") as file:
file.write(str(result_table))
if regression_flag:
sys.exit(1)
sys.exit(2) ## regression detected



Expand Down
2 changes: 1 addition & 1 deletion pkg/algorithms/algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def output_junit(self) -> Tuple[str,str, bool]:
Returns:
_type_: return
"""
test_name, data_json = self.output_json()
test_name, data_json, _ = self.output_json()
data_json = json.loads(data_json)
data_junit = json_to_junit(
test_name=test_name,
Expand Down
6 changes: 4 additions & 2 deletions pkg/runTest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
run test
"""
import sys
from typing import Any, Dict
from fmatch.matcher import Matcher
from fmatch.logrus import SingletonLogger
Expand Down Expand Up @@ -43,15 +44,16 @@ def run(**kwargs: dict[str, Any]) -> dict[str, Any]: #pylint: disable = R0914
kwargs,
start_timestamp,
)

if fingerprint_matched_df is None:
return None
sys.exit(3) # No data present

if kwargs["hunter_analyze"]:
algorithm_name = cnsts.EDIVISIVE
elif kwargs["anomaly_detection"]:
algorithm_name = cnsts.ISOLATION_FOREST
else:
return None
return None, None

algorithmFactory = AlgorithmFactory()
algorithm = algorithmFactory.instantiate_algorithm(
Expand Down
44 changes: 33 additions & 11 deletions test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,21 @@
run_cmd(){
echo "$@"
${@}
EXIT_CODE=$?

if [ $EXIT_CODE -eq 2 ]; then
echo "Exit code 2 encountered, regression detected, treating as success"
return 0
elif [ $EXIT_CODE -eq 3 ]; then
echo "Exit code 3 encountered, not enough data"
return 0
else
return $EXIT_CODE
fi
}

setup() {
# Make a note of daemon PID
orion daemon --port 8080 &
DAEMON_PID=$!
echo "Orion daemon started with PID $DAEMON_PID"
export ES_SERVER="$QE_ES_SERVER"
export es_metadata_index="perf_scale_ci*"
export es_benchmark_index="ripsaw-kube-burner*"
Expand All @@ -24,11 +32,11 @@ setup() {
}

@test "orion cmd payload scale 4.15 " {
run_cmd orion cmd --config "examples/payload-scale-415.yaml" --lookback 5d
run_cmd orion cmd --config "examples/payload-scale-415.yaml" --lookback 5d --hunter-analyze
}

@test "orion cmd payload scale 4.16 without lookback period " {
run_cmd orion cmd --config "examples/payload-scale-416.yaml"
run_cmd orion cmd --config "examples/payload-scale-416.yaml" --hunter-analyze
}

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


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

Expand Down Expand Up @@ -73,23 +82,36 @@ setup() {
}

@test "orion daemon small scale cluster density with anomaly detection " {
orion daemon --port 8080 &
DAEMON_PID=$!
echo "Orion daemon started with PID $DAEMON_PID"
run_cmd curl http://127.0.0.1:8080/daemon/anomaly?convert_tinyurl=True&test_name=small-scale-cluster-density
if [ ! -z "$DAEMON_PID" ]; then
kill $DAEMON_PID
echo "Orion daemon with PID $DAEMON_PID killed"
fi
}

@test "orion daemon small scale node density cni with changepoint detection " {
orion daemon --port 8080 &
DAEMON_PID=$!
echo "Orion daemon started with PID $DAEMON_PID"
run_cmd curl http://127.0.0.1:8080/daemon/changepoint?filter_changepoints=true&test_name=small-scale-node-density-cni
if [ ! -z "$DAEMON_PID" ]; then
kill $DAEMON_PID
echo "Orion daemon with PID $DAEMON_PID killed"
fi
}

@test "orion daemon trt payload cluster density with version parameter " {
orion daemon --port 8080 &
DAEMON_PID=$!
echo "Orion daemon started with PID $DAEMON_PID"
run_cmd curl http://127.0.0.1:8080/daemon/changepoint?version=4.17&filter_changepoints=false&test_name=trt-payload-cluster-density
}

teardown() {
# Kill the daemon using its PID
if [ ! -z "$DAEMON_PID" ]; then
kill $DAEMON_PID
echo "Orion daemon with PID $DAEMON_PID killed"
else
echo "No daemon PID found"
fi
}


0 comments on commit 7219dc1

Please sign in to comment.