Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Add test name before and after the test in console output #1962

Merged
merged 1 commit into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions spec/5g/core_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe "Core" do
$?.success?.should be_true
response_s = `./cnf-testsuite smf_upf_heartbeat verbose`
Log.info {"response: #{response_s}"}
(/PASSED: Chaos service degradation is less than 50%/ =~ response_s).should_not be_nil
(/(PASSED).*(Chaos service degradation is less than 50%)/ =~ response_s).should_not be_nil
ensure
Log.info {`./cnf-testsuite cnf_cleanup cnf-config=sample-cnfs/sample_open5gs/cnf-testsuite.yml`}
$?.success?.should be_true
Expand All @@ -30,7 +30,7 @@ describe "Core" do
$?.success?.should be_true
response_s = `./cnf-testsuite smf_upf_heartbeat verbose baseline_count=300`
Log.info {"response: #{response_s}"}
(/FAILED: Chaos service degradation is more than 50%/ =~ response_s).should_not be_nil
(/(FAILED).*(Chaos service degradation is more than 50%)/ =~ response_s).should_not be_nil
ensure
Log.info {`./cnf-testsuite cnf_cleanup cnf-config=sample-cnfs/sample_open5gs/cnf-testsuite.yml`}
$?.success?.should be_true
Expand All @@ -43,7 +43,7 @@ describe "Core" do
$?.success?.should be_true
response_s = `./cnf-testsuite suci_enabled verbose`
Log.info {"response: #{response_s}"}
(/PASSED: Core uses SUCI 5g authentication/ =~ response_s).should_not be_nil
(/(PASSED).*(Core uses SUCI 5g authentication)/ =~ response_s).should_not be_nil
ensure
Log.info {`./cnf-testsuite cnf_cleanup cnf-config=sample-cnfs/sample_open5gs/cnf-testsuite.yml`}
$?.success?.should be_true
Expand All @@ -56,7 +56,7 @@ describe "Core" do
$?.success?.should be_true
response_s = `./cnf-testsuite suci_enabled verbose`
Log.info {"response: #{response_s}"}
(/FAILED: Core does not use SUCI 5g authentication/ =~ response_s).should_not be_nil
(/(FAILED).*(Core does not use SUCI 5g authentication)/ =~ response_s).should_not be_nil
ensure
Log.info {`./cnf-testsuite cnf_cleanup cnf-config=sample-cnfs/sample_open5gs_no_auth/cnf-testsuite.yml`}
$?.success?.should be_true
Expand Down
4 changes: 2 additions & 2 deletions spec/5g/ran_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe "5g" do
$?.success?.should be_true
response_s = `./cnf-testsuite oran_e2_connection verbose`
Log.info {"response: #{response_s}"}
(/PASSED: RAN connects to a RIC using the e2 standard interface/ =~ response_s).should_not be_nil
(/(PASSED).*(RAN connects to a RIC using the e2 standard interface)/ =~ response_s).should_not be_nil
ensure
Log.info {`./cnf-testsuite cnf_cleanup cnf-config=sample-cnfs/sample-oran-ric/cnf-testsuite.yml`}
$?.success?.should be_true
Expand All @@ -38,7 +38,7 @@ describe "5g" do
$?.success?.should be_true
response_s = `./cnf-testsuite oran_e2_connection verbose`
Log.info {"response: #{response_s}"}
(/FAILED: RAN does not connect to a RIC using the e2 standard interface/ =~ response_s).should_not be_nil
(/(FAILED).*(RAN does not connect to a RIC using the e2 standard interface)/ =~ response_s).should_not be_nil
ensure
Log.info {`./cnf-testsuite cnf_cleanup cnf-config=sample-cnfs/sample_open5gs/cnf-testsuite.yml`}
$?.success?.should be_true
Expand Down
2 changes: 1 addition & 1 deletion spec/platform/hardware_and_scheduler_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe "Platform" do
it "'oci_compliant' should pass if all runtimes are oci_compliant", tags: ["platform:oci_compliant"] do
response_s = `./cnf-testsuite platform:oci_compliant`
LOGGING.info response_s
(/(PASSED){1}.*(which are OCI compliant runtimes){1}/ =~ response_s).should_not be_nil
(/(PASSED).*(which are OCI compliant runtimes)/ =~ response_s).should_not be_nil
end
end

8 changes: 4 additions & 4 deletions spec/platform/observability_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe "Platform Observability" do

response_s = `./cnf-testsuite platform:kube_state_metrics poc`
LOGGING.info response_s
(/(PASSED){1}.*(Your platform is using the){1}.*(release for kube state metrics){1}/ =~ response_s).should_not be_nil
(/(PASSED).*(Your platform is using the).*(release for kube state metrics)/ =~ response_s).should_not be_nil
ensure
resp = `#{helm} delete kube-state-metrics`
LOGGING.info resp
Expand All @@ -47,7 +47,7 @@ describe "Platform Observability" do
response_s = `./cnf-testsuite platform:node_exporter poc`
LOGGING.info response_s
if check_containerd
(/(PASSED){1}.*(Your platform is using the node exporter){1}/ =~ response_s).should_not be_nil
(/(PASSED).*(Your platform is using the node exporter)/ =~ response_s).should_not be_nil
else
(/skipping node_exporter: This test only supports the Containerd Runtime./ =~ response_s).should_not be_nil
end
Expand All @@ -71,7 +71,7 @@ describe "Platform Observability" do

response_s = `./cnf-testsuite platform:prometheus_adapter poc`
Log.info { response_s }
(/(PASSED){1}.*(Your platform is using the prometheus adapter){1}/ =~ response_s).should_not be_nil
(/(PASSED).*(Your platform is using the prometheus adapter)/ =~ response_s).should_not be_nil
ensure
resp = Helm.uninstall("prometheus-adapter")
end
Expand All @@ -90,7 +90,7 @@ describe "Platform Observability" do
KubectlClient::Get.wait_for_install(deployment_name: "metrics-server")
response_s = `./cnf-testsuite platform:metrics_server poc`
LOGGING.info response_s
(/(PASSED){1}.*(Your platform is using the metrics server){1}/ =~ response_s).should_not be_nil
(/(PASSED).*(Your platform is using the metrics server)/ =~ response_s).should_not be_nil
ensure
resp = Helm.uninstall("metrics-server")
LOGGING.info resp
Expand Down
2 changes: 1 addition & 1 deletion spec/platform/platform_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe "Platform" do
it "'k8s_conformance' should pass if the sonobuoy tests pass", tags: ["platform"] do
response_s = `./cnf-testsuite k8s_conformance`
LOGGING.info response_s
(/PASSED: K8s conformance test has no failures/ =~ response_s).should_not be_nil
(/(PASSED).*(K8s conformance test has no failures)/ =~ response_s).should_not be_nil
end

it "individual tasks like 'platform:control_plane_hardening' should not require an installed cnf to run", tags: ["platform"] do
Expand Down
2 changes: 1 addition & 1 deletion spec/platform/resilience_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe "Platform" do
puts "Tests running in destructive mode".colorize(:red)
response_s = `./cnf-testsuite platform:worker_reboot_recovery destructive`
LOGGING.info response_s
(/(PASSED: Node came back online)/ =~ response_s).should_not be_nil
(/(PASSED).*(Node came back online)/ =~ response_s).should_not be_nil
else
response_s = `./cnf-testsuite platform:worker_reboot_recovery`
LOGGING.info response_s
Expand Down
8 changes: 4 additions & 4 deletions spec/platform/security_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe "Platform" do
it "'control_plane_hardening' should pass if the control plane has been hardened", tags: ["platform:security"] do
response_s = `./cnf-testsuite platform:control_plane_hardening`
Log.info { response_s }
(/(PASSED: Insecure port of Kubernetes API server is not enabled)/ =~ response_s).should_not be_nil
(/(PASSED).*(Insecure port of Kubernetes API server is not enabled)/ =~ response_s).should_not be_nil
end

it "'cluster_admin' should fail on a cnf that uses a cluster admin binding", tags: ["platform:security"] do
Expand All @@ -21,7 +21,7 @@ describe "Platform" do
response_s = `./cnf-testsuite platform:cluster_admin`
LOGGING.info response_s
$?.success?.should be_true
(/FAILED: Users with cluster-admin RBAC permissions found/ =~ response_s).should_not be_nil
(/(FAILED).*(Users with cluster-admin RBAC permissions found)/ =~ response_s).should_not be_nil
# ensure
# `./cnf-testsuite cnf_cleanup cnf-config=./sample-cnfs/sample-privilege-escalation/cnf-testsuite.yml`
end
Expand All @@ -32,7 +32,7 @@ describe "Platform" do
KubectlClient::Get.resource_wait_for_install("pod", "tiller")
response_s = `./cnf-testsuite platform:helm_tiller`
$?.success?.should be_true
(/FAILED: Containers with the Helm Tiller image are running/ =~ response_s).should_not be_nil
(/(FAILED).*(Containers with the Helm Tiller image are running)/ =~ response_s).should_not be_nil
ensure
KubectlClient::Delete.command("pod/tiller")
KubectlClient::Get.resource_wait_for_uninstall("pod", "tiller")
Expand All @@ -42,6 +42,6 @@ describe "Platform" do
# By default we have nothing to setup for this task to pass since Helm v3 does not use Tiller.
response_s = `./cnf-testsuite platform:helm_tiller`
$?.success?.should be_true
(/PASSED: No Helm Tiller containers are running/ =~ response_s).should_not be_nil
(/(PASSED).*(No Helm Tiller containers are running)/ =~ response_s).should_not be_nil
end
end
6 changes: 3 additions & 3 deletions spec/utils/utils_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ describe "Utils" do
Log.info {response_s}
response_s = `./cnf-testsuite cnf_setup cnf-config=sample-cnfs/sample_privileged_cnf/cnf-testsuite.yml`
Log.info {response_s}
resp = `./cnf-testsuite privileged`
Log.info { resp }
(resp).includes?("FAILED: Found 1 privileged containers").should be_true
response_s = `./cnf-testsuite privileged`
Log.info { response_s}
(/(FAILED).*(Found 1 privileged containers)/ =~ response_s).should_not be_nil
ensure
response_s = `./cnf-testsuite cnf_cleanup cnf-config=sample-cnfs/sample-generic-cnf/cnf-testsuite.yml`
Log.info { response_s }
Expand Down
4 changes: 2 additions & 2 deletions spec/workload/compatibility_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe "Compatibility" do
retries = retries + 1
end
Log.info {"Status: #{response_s}"}
(/PASSED: CNF compatible with both Calico and Cilium/ =~ response_s).should_not be_nil
(/(PASSED).*(CNF compatible with both Calico and Cilium)/ =~ response_s).should_not be_nil
ensure
`./cnf-testsuite cnf_cleanup cnf-config=sample-cnfs/sample-coredns-cnf/cnf-testsuite.yml`
$?.success?.should be_true
Expand All @@ -40,7 +40,7 @@ describe "Compatibility" do
response_s = `./cnf-testsuite increase_decrease_capacity verbose`
LOGGING.info response_s
$?.success?.should be_true
(/PASSED: Replicas increased to/ =~ response_s).should_not be_nil
(/(PASSED).*(Replicas increased to)/ =~ response_s).should_not be_nil
ensure
`./cnf-testsuite cnf_cleanup cnf-config=./sample-cnfs/sample_coredns/cnf-testsuite.yml`
end
Expand Down
Loading
Loading