Skip to content

Commit

Permalink
Rename image_size task to reasonable_image_size lfn-cnti/certificatio…
Browse files Browse the repository at this point in the history
  • Loading branch information
denverwilliams committed May 6, 2020
1 parent 0b427d2 commit 054c3bd
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion points.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
pass: 5
fail: -1

- name: image_size_large
- name: reasonable_image_size
tags: microservice, dynamic
- name: reasonable_startup_time
tags: microservice, dynamic
Expand Down
2 changes: 1 addition & 1 deletion spec/cnf_conformance_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe CnfConformance do
(/PASSED: Replicas decreased to 1/ =~ response_s).should_not be_nil
(/PASSED: Published Helm Chart Repo added/ =~ response_s).should_not be_nil
(/Final score:/ =~ response_s).should_not be_nil
(all_result_test_names(final_cnf_results_yml)).should eq(["privileged", "increase_capacity", "decrease_capacity", "ip_addresses", "liveness", "readiness", "install_script_helm", "helm_chart_valid", "helm_chart_published", "image_size_large", "reasonable_startup_time"])
(all_result_test_names(final_cnf_results_yml)).should eq(["privileged", "increase_capacity", "decrease_capacity", "ip_addresses", "liveness", "readiness", "install_script_helm", "helm_chart_valid", "helm_chart_published", "reasonable_image_size", "reasonable_startup_time"])
end

it "'scalability' should run all of the scalability tests" do
Expand Down
8 changes: 4 additions & 4 deletions spec/microservice_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ describe "Microservice" do
`crystal src/cnf-conformance.cr cnf_cleanup cnf-path=sample-cnfs/sample_envoy_slow_startup`
end

it "'image_size_large' should pass if image is smaller than 5gb", tags: "image_size_large" do
it "'reasonable_image_size' should pass if image is smaller than 5gb", tags: "reasonable_image_size" do
begin
`crystal src/cnf-conformance.cr sample_coredns_setup`
response_s = `crystal src/cnf-conformance.cr image_size_large verbose`
response_s = `crystal src/cnf-conformance.cr reasonable_image_size verbose`
puts response_s
$?.success?.should be_true
(/Image size is good/ =~ response_s).should_not be_nil
Expand All @@ -46,11 +46,11 @@ describe "Microservice" do
end
end

it "'image_size_large' should fail if image is larger than 5gb", tags: "image_size_large" do
it "'reasonable_image_size' should fail if image is larger than 5gb", tags: "reasonable_image_size" do
begin
`crystal src/cnf-conformance.cr cnf_cleanup cnf-path=sample-cnfs/sample-large-cnf`
`crystal src/cnf-conformance.cr cnf_setup cnf-path=sample-cnfs/sample-large-cnf deploy_with_chart=false`
response_s = `crystal src/cnf-conformance.cr image_size_large verbose`
response_s = `crystal src/cnf-conformance.cr reasonable_image_size verbose`
puts response_s
$?.success?.should be_true
(/Image size too large/ =~ response_s).should_not be_nil
Expand Down
2 changes: 1 addition & 1 deletion spec/utils/utils_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ describe "Utils" do

it "'all_task_test_names' should return all tasks names"do
create_results_yml
(all_task_test_names()).should eq(["image_size_large", "reasonable_startup_time","cni_spec", "api_snoop_alpha", "api_snoop_beta", "api_snoop_general_apis", "reset_cnf", "check_reaped", "privileged", "shells", "protected_access", "increase_capacity", "decrease_capacity", "small_autoscaling", "large_autoscaling", "network_chaos", "external_retry", "versioned_helm_chart", "ip_addresses", "liveness", "readiness", "no_volume_with_configuration", "rolling_update", "fluentd_traffic", "jaeger_traffic", "prometheus_traffic", "opentelemetry_compatible", "openmetric_compatible", "helm_deploy", "install_script_helm", "helm_chart_valid", "helm_chart_published", "hardware_affinity", "static_accessing_hardware", "dynamic_accessing_hardware", "direct_hugepages", "performance", "k8s_conformance"])
(all_task_test_names()).should eq(["reasonable_image_size", "reasonable_startup_time","cni_spec", "api_snoop_alpha", "api_snoop_beta", "api_snoop_general_apis", "reset_cnf", "check_reaped", "privileged", "shells", "protected_access", "increase_capacity", "decrease_capacity", "small_autoscaling", "large_autoscaling", "network_chaos", "external_retry", "versioned_helm_chart", "ip_addresses", "liveness", "readiness", "no_volume_with_configuration", "rolling_update", "fluentd_traffic", "jaeger_traffic", "prometheus_traffic", "opentelemetry_compatible", "openmetric_compatible", "helm_deploy", "install_script_helm", "helm_chart_valid", "helm_chart_published", "hardware_affinity", "static_accessing_hardware", "dynamic_accessing_hardware", "direct_hugepages", "performance", "k8s_conformance"])
end

it "'all_result_test_names' should return the tasks assigned to a tag"do
Expand Down
11 changes: 6 additions & 5 deletions src/tasks/microservice.cr
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# coding: utf-8
require "sam"
require "file_utils"
require "colorize"
Expand All @@ -7,7 +8,7 @@ require "halite"
require "totem"

desc "The CNF conformance suite checks to see if CNFs follows microservice principles"
task "microservice", ["image_size_large", "reasonable_startup_time"] do |_, args|
task "microservice", ["reasonable_image_size", "reasonable_startup_time"] do |_, args|
end

desc "Does the CNF have a reasonable startup time?"
Expand Down Expand Up @@ -62,8 +63,8 @@ task "reasonable_startup_time" do |_, args|
end
end

desc "Is the image size large?"
task "image_size_large", ["retrieve_manifest"] do |_, args|
desc "Does the CNF have a reasonable container image size?"
task "reasonable_image_size", ["retrieve_manifest"] do |_, args|
begin
config = cnf_conformance_yml
helm_directory = config.get("helm_directory").as_s
Expand Down Expand Up @@ -102,10 +103,10 @@ task "image_size_large", ["retrieve_manifest"] do |_, args|
docker_resp &&
docker_resp.status_code == 200 &&
micro_size.to_s.to_i64 < 50000000
upsert_passed_task("image_size_large")
upsert_passed_task("reasonable_image_size")
puts "PASSED: Image size is good".colorize(:green)
else
upsert_failed_task("image_size_large")
upsert_failed_task("reasonable_image_size")
puts "FAILURE: Image size too large".colorize(:red)
end
rescue ex
Expand Down

0 comments on commit 054c3bd

Please sign in to comment.