add more tests

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero 2022-10-03 11:09:02 +08:00
parent 14ba7cd156
commit f6fd754386
3 changed files with 113 additions and 21 deletions

View File

@ -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

View File

@ -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

View File

@ -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: {}