Skip to content

Commit

Permalink
Merge branch 'pr-merge-1862' into pr/1893
Browse files Browse the repository at this point in the history
  • Loading branch information
HashNuke committed Feb 20, 2024
2 parents c0b0ddc + a5b8899 commit 0483561
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 36 deletions.
2 changes: 1 addition & 1 deletion config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ toggles:
# kind) will be changed, rebooted, chaos tested, etc
- name: destructive
toggle_on: false
loglevel: error
loglevel: info

3 changes: 2 additions & 1 deletion spec/platform/observability_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ describe "Platform Observability" do

LOGGING.info "Installing prometheus-node-exporter"
helm = Helm::BinarySingleton.helm
resp = `#{helm} install node-exporter stable/prometheus-node-exporter`
Helm.helm_repo_add("prometheus-community","https://prometheus-community.github.io/helm-charts")
resp = `#{helm} install node-exporter prometheus-community/prometheus-node-exporter`
LOGGING.info resp

pod_ready = ""
Expand Down
9 changes: 5 additions & 4 deletions spec/utils/utils_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,13 @@ describe "Utils" do
end

it "'task_runner' should run a test against a single cnf if passed a cnf-config argument even if there are multiple cnfs installed", tags: ["task_runner"] do
Log.info {`./cnf-testsuite cnf_setup cnf-config=sample-cnfs/sample-generic-cnf/cnf-testsuite.yml`}
Log.info {`./cnf-testsuite cnf_setup cnf-config=sample-cnfs/sample_privileged_cnf/cnf-testsuite.yml`}

response_s = `./cnf-testsuite cnf_setup cnf-config=sample-cnfs/sample-generic-cnf/cnf-testsuite.yml`
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
(resp).includes?("FAILED: Found 1 privileged containers").should be_true
ensure
response_s = `./cnf-testsuite cnf_cleanup cnf-config=sample-cnfs/sample-generic-cnf/cnf-testsuite.yml`
Log.info { response_s }
Expand Down
2 changes: 1 addition & 1 deletion src/cnf-testsuite.cr
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ task "upsert_release" do |_, args|
# LOGGING.info "upserting release on: #{ReleaseManager::VERSION}"
LOGGING.info "upserting release on: #{ReleaseManager::VERSION}"

ghrm = ReleaseManager::GithubReleaseManager.new("cncf/cnf-testsuite")
ghrm = ReleaseManager::GithubReleaseManager.new("cnti-testcatalog/testsuite")

release, asset = ghrm.upsert_release(version=ReleaseManager::VERSION)
if release
Expand Down
60 changes: 31 additions & 29 deletions src/tasks/workload/compatibility.cr
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,14 @@ task "increase_decrease_capacity" do |t, args|
testsuite_task = "increase_decrease_capacity"
Log.for(testsuite_task).info { "Starting test" }

Log.for(testsuite_task).info { "increase_capacity" }
Log.for(testsuite_task).info { "increase_decrease_capacity" }

increase_test_base_replicas = "1"
increase_test_target_replicas = "3"

decrease_test_base_replicas = "3"
decrease_test_target_replicas = "1"

# TODO scale replicatsets separately
# https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/#scaling-a-replicaset
# resource["kind"].as_s.downcase == "replicaset"
Expand All @@ -209,41 +213,39 @@ task "increase_decrease_capacity" do |t, args|
true
end
end

decrease_test_base_replicas = "3"
decrease_test_target_replicas = "1"
decrease_task_response = CNFManager.cnf_workload_resources(args, config) do | resource|
# TODO scale replicatsets separately
# https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/#scaling-a-replicaset
# resource["kind"].as_s.downcase == "replicaset"
if resource["kind"].as_s.downcase == "deployment" ||
resource["kind"].as_s.downcase == "statefulset"
final_count = change_capacity(decrease_test_base_replicas, decrease_test_target_replicas, args, config, resource)
decrease_test_target_replicas == final_count
else
true
increase_task_successful = increase_task_response.none?(false)

if increase_task_successful
decrease_task_response = CNFManager.cnf_workload_resources(args, config) do | resource|
# TODO scale replicatsets separately
# https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/#scaling-a-replicaset
# resource["kind"].as_s.downcase == "replicaset"
if resource["kind"].as_s.downcase == "deployment" ||
resource["kind"].as_s.downcase == "statefulset"
final_count = change_capacity(decrease_test_base_replicas, decrease_test_target_replicas, args, config, resource)
decrease_test_target_replicas == final_count
else
true
end
end
end
decrease_task_successful = !decrease_task_response.nil? && decrease_task_response.none?(false)

emoji_capacity = "📦📈📉"

if increase_task_response.none?(false) && decrease_task_response.none?(false)
pass_msg = "✔️ 🏆 PASSED: Replicas increased to #{increase_test_target_replicas} and decreased to #{decrease_test_target_replicas} #{emoji_capacity}"
pass_msg = "✔️ 🏆 PASSED: Replicas increased to #{increase_test_target_replicas} and decreased to #{decrease_test_target_replicas} #{emoji_capacity}"
fail_msg = "✖️ FAILURE: Capacity change failed #{emoji_capacity}"


if increase_task_successful && decrease_task_successful
upsert_passed_task(testsuite_task, pass_msg, task_start_time)
else
upsert_failed_task(testsuite_task, "✖️ FAILURE: Capacity change failed #{emoji_capacity}", task_start_time)

# If increased capacity failed
if increase_task_response.any?(false)
upsert_failed_task(testsuite_task, fail_msg, task_start_time)
stdout_failure(increase_decrease_remedy_msg())
unless increase_task_successful
stdout_failure("Failed to increase replicas from #{increase_test_base_replicas} to #{increase_test_target_replicas}")
end

# If decrease capacity failed
if decrease_task_response.any?(false)
else
stdout_failure("Failed to decrease replicas from #{decrease_test_base_replicas} to #{decrease_test_target_replicas}")
end

stdout_failure(increase_decrease_remedy_msg())
end
end
end
end
Expand Down Expand Up @@ -376,7 +378,7 @@ def wait_for_scaling(resource, target_replica_count, args)
if args.named.keys.includes? "wait_count"
wait_count_value = args.named["wait_count"]
else
wait_count_value = "30"
wait_count_value = "45"
end
wait_count = wait_count_value.to_i
second_count = 0
Expand Down
1 change: 1 addition & 0 deletions src/tasks/workload/configuration.cr
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ task "ip_addresses" do |_, args|
emoji_network_runtime = "📶🏃⏲️"
helm_directory = config.cnf_config[:helm_directory]
helm_chart_path = config.cnf_config[:helm_chart_path]
Log.info { "Path: #{helm_chart_path}" }
if File.directory?(helm_chart_path)
# Switch to the helm chart directory
Dir.cd(helm_chart_path)
Expand Down

0 comments on commit 0483561

Please sign in to comment.