From f6fd7543861e10edadf419597a130d9310cb70d4 Mon Sep 17 00:00:00 2001 From: yxxhero Date: Mon, 3 Oct 2022 11:09:02 +0800 Subject: [PATCH] add more tests Signed-off-by: yxxhero --- test/integration/issue.657.yaml | 16 +++++ test/integration/run.sh | 53 +++++++++------ .../yaml-features-golden/overwritten.yaml | 65 +++++++++++++++++++ 3 files changed, 113 insertions(+), 21 deletions(-) create mode 100644 test/integration/issue.657.yaml create mode 100644 test/integration/yaml-features-golden/overwritten.yaml diff --git a/test/integration/issue.657.yaml b/test/integration/issue.657.yaml new file mode 100644 index 00000000..9033a43d --- /dev/null +++ b/test/integration/issue.657.yaml @@ -0,0 +1,16 @@ +templates: + default: &default + values: + - image: + repository: docker.io/citizenstig/httpbin + tag: latest + pullPolicy: IfNotPresent + +releases: + - name: httpbin + chart: ./charts/httpbin + <<: *default + values: + - image: + tag: 0.0.1 + pullPolicy: Never \ No newline at end of file diff --git a/test/integration/run.sh b/test/integration/run.sh index 5c361793..29c11643 100755 --- a/test/integration/run.sh +++ b/test/integration/run.sh @@ -202,32 +202,43 @@ if [[ helm_major_version -eq 3 ]]; then test_pass "secretssops.2" - test_start "secretssops.3 - should order secrets correctly" + test_start "secretssops.3 - should order secrets correctly" - tmp=$(mktemp -d) - direct=${tmp}/direct.build.yaml - reverse=${tmp}/reverse.build.yaml - golden_dir=${dir}/secrets-golden + tmp=$(mktemp -d) + direct=${tmp}/direct.build.yaml + reverse=${tmp}/reverse.build.yaml + yaml_overwrite_reverse=${tmp}/yaml.override.build.yaml + secrets_golden_dir=${dir}/secrets-golden + feature_golden_dir=${dir}/yaml-features-golden - info "Building secrets output" + info "Building secrets output" - info "Comparing build/direct output ${direct} with ${golden_dir}" - for i in $(seq 10); do - info "Comparing build/direct #$i" - ${helmfile} -f ${dir}/secretssops.yaml -e direct template --skip-deps > ${direct} || fail "\"helmfile template\" shouldn't fail" - ./yamldiff ${golden_dir}/direct.build.yaml ${direct} || fail "\"helmfile template\" should be consistent" - echo code=$? - done + info "Comparing build/direct output ${direct} with ${secrets_golden_dir}" + for i in $(seq 10); do + info "Comparing build/direct #$i" + ${helmfile} -f ${dir}/secretssops.yaml -e direct template --skip-deps > ${direct} || fail "\"helmfile template\" shouldn't fail" + ./yamldiff ${secrets_golden_dir}/direct.build.yaml ${direct} || fail "\"helmfile template\" should be consistent" + echo code=$? + done - info "Comparing build/reverse output ${direct} with ${golden_dir}" - for i in $(seq 10); do - info "Comparing build/reverse #$i" - ${helmfile} -f ${dir}/secretssops.yaml -e reverse template --skip-deps > ${reverse} || fail "\"helmfile template\" shouldn't fail" - ./yamldiff ${golden_dir}/reverse.build.yaml ${reverse} || fail "\"helmfile template\" should be consistent" - echo code=$? - done + info "Comparing build/reverse output ${direct} with ${secrets_golden_dir}" + for i in $(seq 10); do + info "Comparing build/reverse #$i" + ${helmfile} -f ${dir}/secretssops.yaml -e reverse template --skip-deps > ${reverse} || fail "\"helmfile template\" shouldn't fail" + ./yamldiff ${secrets_golden_dir}/reverse.build.yaml ${reverse} || fail "\"helmfile template\" should be consistent" + echo code=$? + done - test_pass "secretssops.3" + test_pass "secretssops.3" + + test_start "yaml overwrite feature" + info "Comparing yaml overwrite feature output with ${feature_golden_dir}/overwritten.yaml" + for i in $(seq 10); do + info "Comparing build/yaml-overwrite #$i" + ${helmfile} -f ${dir}/issue.657.yaml template > ${yaml_overwrite_reverse} || fail "\"helmfile template\" shouldn't fail" + ./yamldiff ${feature_golden_dir}/reverse.build.yaml ${yaml_overwrite_reverse} || fail "\"helmfile template\" should be consistent" + echo code=$? + done fi diff --git a/test/integration/yaml-features-golden/overwritten.yaml b/test/integration/yaml-features-golden/overwritten.yaml new file mode 100644 index 00000000..e2978be6 --- /dev/null +++ b/test/integration/yaml-features-golden/overwritten.yaml @@ -0,0 +1,65 @@ +Building dependency release=httpbin, chart=httpbin +Templating release=httpbin, chart=httpbin +--- +# Source: httpbin/templates/service.yaml +apiVersion: v1 +kind: Service +metadata: + name: httpbin-httpbin + labels: + app: httpbin + chart: httpbin-0.1.0 + release: httpbin + heritage: Helm +spec: + type: LoadBalancer + ports: + - port: 8000 + targetPort: 8000 + protocol: TCP + name: httpbin + selector: + app: httpbin + release: httpbin +--- +# Source: httpbin/templates/deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: +metadata: + name: httpbin-httpbin + labels: + app: httpbin + chart: httpbin-0.1.0 + release: httpbin + heritage: Helm +spec: + replicas: 1 + selector: + matchLabels: + app: httpbin + strategy: {} + template: + metadata: + labels: + app: httpbin + release: httpbin + spec: + containers: + - name: httpbin + image: "docker.io/citizenstig/httpbin:0.0.1" + imagePullPolicy: Never + livenessProbe: + httpGet: + path: / + port: 8000 + readinessProbe: + httpGet: + path: / + port: 8000 + ports: + - containerPort: 8000 + resources: + {} + +status: {}