forked from cnti-testcatalog/testsuite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
spec: remove backticks and use new logging
REF: cnti-testcatalog#1495 Replace all backtick command execution with ShellCmd module. Use Log instead of LOGGING module. Fix edgecase issues caused by logging refactor. Remove commented-out code. Signed-off-by: Konstantin Yarovoy <[email protected]>
- Loading branch information
Konstantin Yarovoy
committed
Apr 22, 2024
1 parent
675c9de
commit 98d16cb
Showing
45 changed files
with
1,219 additions
and
1,864 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,110 +1,8 @@ | ||
require "./spec_helper" | ||
require "colorize" | ||
# require "../src/tasks/utils/utils.cr" | ||
require "../src/tasks/utils/utils.cr" | ||
require "file_utils" | ||
require "sam" | ||
|
||
describe "AirGap" do | ||
|
||
# before_all do | ||
# Helm.helm_repo_add("chaos-mesh", "https://charts.chaos-mesh.org") | ||
# # AirGap::LOGGING.info `./cnf-testsuite airgapped output-file=/tmp/airgapped.tar.gz` unless File.exists?("/tmp/airgapped.tar.gz") | ||
# Log.info { `./cnf-testsuite airgapped output-file=/tmp/airgapped.tar.gz` } | ||
# (File.exists?("/tmp/airgapped.tar.gz")).should be_true | ||
# end | ||
# | ||
# after_all do | ||
# AirGap.tmp_cleanup | ||
# (File.exists?("/tmp/airgapped.tar.gz")).should_not be_true | ||
# end | ||
|
||
# it "'setup' task should create an airgapped tarball with the necessary files", tags: ["airgap-setup"] do | ||
# file_list = `tar -tvf /tmp/airgapped.tar.gz` | ||
# Log.info { "file_list: #{file_list}" } | ||
# (file_list).match(/kubectl.tar/).should_not be_nil | ||
# (file_list).match(/chaos-mesh.tar/).should_not be_nil | ||
# (file_list).match(/chaos-daemon.tar/).should_not be_nil | ||
# (file_list).match(/chaos-dashboard.tar/).should_not be_nil | ||
# (file_list).match(/chaos-kernel.tar/).should_not be_nil | ||
# (file_list).match(/prometheus.tar/).should_not be_nil | ||
# (file_list).match(/rbac.yaml/).should_not be_nil | ||
# (file_list).match(/disk-fill-rbac.yaml/).should_not be_nil | ||
# (file_list).match(/litmus-operator/).should_not be_nil | ||
# (file_list).match(/download\/sonobuoy.tar.gz/).should_not be_nil | ||
# (file_list).match(/crictl-v1.17.0-linux-amd64.tar.gz/).should_not be_nil | ||
# (file_list).match(/containerd-1.5.0-linux-amd64.tar.gz/).should_not be_nil | ||
# end | ||
# | ||
# it "'setup' task should install the necessary cri tools in the cluster", tags: ["airgap-setup"] do | ||
# response_s = `./cnf-testsuite -l info setup offline=/tmp/airgapped.tar.gz` | ||
# Log.info { response_s } | ||
# $?.success?.should be_true | ||
# pods = KubectlClient::Get.pods_by_nodes(KubectlClient::Get.schedulable_nodes_list) | ||
# pods = KubectlClient::Get.pods_by_label(pods, "name", "cri-tools") | ||
# # Get the generated name of the cri-tools per node | ||
# pods.map do |pod| | ||
# pod_name = pod.dig?("metadata", "name") | ||
# sh = KubectlClient.exec("-ti #{pod_name} -- cat /usr/local/bin/crictl > /dev/null") | ||
# sh[:status].success? | ||
# sh = KubectlClient.exec("-ti #{pod_name} -- cat /usr/local/bin/ctr > /dev/null") | ||
# sh[:status].success? | ||
# end | ||
# (/All prerequisites found./ =~ response_s).should_not be_nil | ||
# (/Setup complete/ =~ response_s).should_not be_nil | ||
# end | ||
# | ||
# it "'cnf_setup/cnf_cleanup' should install/cleanup a cnf helm chart in airgapped mode", tags: ["airgap-repo"] do | ||
# begin | ||
# response_s = `./cnf-testsuite cnf_setup cnf-config=sample-cnfs/sample_rolling/cnf-testsuite.yml airgapped=/tmp/airgapped.tar.gz` | ||
# Log.info { response_s } | ||
# file_list = `tar -tvf /tmp/airgapped.tar.gz` | ||
# Log.info { "file_list: #{file_list}" } | ||
# (file_list).match(/coredns_1.8.0.tar/).should_not be_nil | ||
# (file_list).match(/coredns_1.6.7.tar/).should_not be_nil | ||
# response_s = `./cnf-testsuite cnf_setup cnf-config=sample-cnfs/sample_rolling/cnf-testsuite.yml input-file=/tmp/airgapped.tar.gz` | ||
# $?.success?.should be_true | ||
# Log.info { response_s } | ||
# (/Successfully setup coredns/ =~ response_s).should_not be_nil | ||
# ensure | ||
# response_s = `./cnf-testsuite cnf_cleanup cnf-config=sample-cnfs/sample_rolling/cnf-testsuite.yml wait_count=0` | ||
# $?.success?.should be_true | ||
# Log.info { response_s } | ||
# (/Successfully cleaned up/ =~ response_s).should_not be_nil | ||
# end | ||
# end | ||
# | ||
# it "'cnf_setup/cnf_cleanup' should install/cleanup a cnf helm directory in airgapped mode", tags: ["airgap-directory"] do | ||
# begin | ||
# response_s = `./cnf-testsuite cnf_setup cnf-config=sample-cnfs/sample_coredns/cnf-testsuite.yml airgapped=/tmp/airgapped.tar.gz` | ||
# Log.info { response_s } | ||
# response_s = `./cnf-testsuite cnf_setup cnf-config=sample-cnfs/sample_coredns/cnf-testsuite.yml input-file=/tmp/airgapped.tar.gz` | ||
# Log.info { response_s } | ||
# $?.success?.should be_true | ||
# (/Successfully setup coredns/ =~ response_s).should_not be_nil | ||
# ensure | ||
# response_s = `./cnf-testsuite cnf_cleanup cnf-config=sample-cnfs/sample_coredns/cnf-testsuite.yml wait_count=0` | ||
# $?.success?.should be_true | ||
# Log.info { response_s } | ||
# (/Successfully cleaned up/ =~ response_s).should_not be_nil | ||
# end | ||
# end | ||
# | ||
# it "'cnf_setup/cnf_cleanup' should install/cleanup a cnf manifest directory in airgapped mode", tags: ["airgap-manifest"] do | ||
# begin | ||
# response_s = `./cnf-testsuite cnf_setup cnf-config=sample-cnfs/k8s-non-helm/cnf-testsuite.yml airgapped=/tmp/airgapped.tar.gz` | ||
# Log.info { response_s } | ||
# response_s = `./cnf-testsuite cnf_setup cnf-config=sample-cnfs/k8s-non-helm/cnf-testsuite.yml input-file=/tmp/airgapped.tar.gz` | ||
# Log.info { response_s } | ||
# $?.success?.should be_true | ||
# Log.info { response_s } | ||
# (/Successfully setup nginx-webapp/ =~ response_s).should_not be_nil | ||
# (/exported_chart\" not found/ =~ response_s).should be_nil | ||
# ensure | ||
# response_s = `LOG_LEVEL=debug ./cnf-testsuite cnf_cleanup cnf-config=sample-cnfs/k8s-non-helm/cnf-testsuite.yml wait_count=0` | ||
# $?.success?.should be_true | ||
# Log.info { response_s } | ||
# (/Successfully cleaned up/ =~ response_s).should_not be_nil | ||
# end | ||
# end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 5 additions & 27 deletions
32
spec/cnf_testsuite_all/cnf_testsuite_config_lifecycle_spec.cr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,7 @@ | ||
#TODO Update Test | ||
# require "../spec_helper" | ||
# require "../../src/tasks/utils/utils.cr" | ||
# require "colorize" | ||
require "../spec_helper" | ||
require "../../src/tasks/utils/utils.cr" | ||
require "colorize" | ||
|
||
# describe CnfTestSuite do | ||
# before_all do | ||
# `./cnf-testsuite setup` | ||
# $?.success?.should be_true | ||
# end | ||
|
||
# after_all do | ||
# `./cnf-testsuite samples_cleanup` | ||
# $?.success?.should be_true | ||
# end | ||
|
||
# it "'testsuite all' should run the configuration lifecycle tests", tags: ["testsuite-config-lifecycle"] do | ||
# `./cnf-testsuite samples_cleanup` | ||
# response_s = `./cnf-testsuite all ~reasonable_startup_time ~reasonable_image_size ~disk_fill ~pod_delete ~pod_io_stress ~pod_network_latency ~pod_network_corruption ~pod_network_duplication ~pod_memory_hog ~chaos_network_loss ~node_drain ~pod_dns_error ~chaos_cpu_hog ~chaos_container_kill ~platform ~volume_hostpath_not_found ~privileged ~increase_capacity ~decrease_capacity ~helm_chart_valid ~helm_chart_published "cnf-config=./sample-cnfs/sample-coredns-cnf/cnf-testsuite.yml" verbose` | ||
# LOGGING.info response_s | ||
# (/PASSED: Helm readiness probe found/ =~ response_s).should_not be_nil | ||
# (/PASSED: Helm liveness probe/ =~ response_s).should_not be_nil | ||
# (/Final workload score:/ =~ response_s).should_not be_nil | ||
# (/Final score:/ =~ response_s).should_not be_nil | ||
# (CNFManager::Points.all_result_test_names(CNFManager::Points.final_cnf_results_yml).sort).should eq(["ip_addresses", "liveness", "readiness", "rolling_update", "rolling_downgrade", "rolling_version_change", "nodeport_not_used", "hostport_not_used", "hardcoded_ip_addresses_in_k8s_runtime_configuration", "rollback", "secrets_used", "immutable_configmap"].sort) | ||
# (/^.*\.cr:[0-9].*/ =~ response_s).should be_nil | ||
# $?.success?.should be_true | ||
# end | ||
# end | ||
describe CnfTestSuite do | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.