Skip to content

Commit 409d29d

Browse files
Add tests to e2e for chart name change upgrade
Signed-off-by: MichaelMorris <[email protected]>
1 parent 8820735 commit 409d29d

34 files changed

Lines changed: 2498 additions & 0 deletions

.github/workflows/e2e.yaml

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,6 +1053,171 @@ jobs:
10531053
echo ' done'
10541054

10551055
kubectl delete -n helm-system -f config/testdata/$test_name/install.yaml
1056+
- name: Run upgrade with chart name changed and default ChartNameChangeStrategy
1057+
run: |
1058+
test_name=upgrade-chart-name-change
1059+
kubectl -n helm-system apply -f config/testdata/$test_name/install.yaml
1060+
echo -n ">>> Waiting for expected conditions"
1061+
count=0
1062+
until [ 'true' == "$( kubectl -n helm-system get helmrelease/$test_name -o json | jq '.status.conditions | map( { (.type): .status } ) | add | .Released=="True" and .Ready=="True"' )" ]; do
1063+
echo -n '.'
1064+
sleep 5
1065+
count=$((count + 1))
1066+
if [[ ${count} -eq 24 ]]; then
1067+
echo ' No more retries left!'
1068+
exit 1
1069+
fi
1070+
done
1071+
echo ' done'
1072+
1073+
# Validate release was installed.
1074+
HISTORY=$(helm -n helm-system history -o json $test_name)
1075+
REVISION_COUNT=$(echo "$HISTORY" | jq 'length')
1076+
if [ "$REVISION_COUNT" != 1 ]; then
1077+
echo -e "Unexpected revision count: $REVISION_COUNT"
1078+
exit 1
1079+
fi
1080+
LAST_REVISION_STATUS=$(echo "$HISTORY" | jq -r 'last | .status')
1081+
if [ "$LAST_REVISION_STATUS" != "deployed" ]; then
1082+
echo -e "Unexpected last revision status: $LAST_REVISION_STATUS"
1083+
exit 1
1084+
fi
1085+
1086+
kubectl -n helm-system apply -f config/testdata/$test_name/upgrade.yaml
1087+
echo -n ">>> Waiting for expected conditions"
1088+
count=0
1089+
until [ 'true' == "$( kubectl -n helm-system get helmrelease/$test_name -o json | jq '.status.upgradeFailures == 1 and .status.installFailures == 1 and ( .status.conditions | map( { (.type): .status } ) | add | .Released=="False" and .Ready=="False" )' )" ]; do
1090+
echo -n '.'
1091+
sleep 5
1092+
count=$((count + 1))
1093+
if [[ ${count} -eq 24 ]]; then
1094+
echo ' No more retries left!'
1095+
exit 1
1096+
fi
1097+
done
1098+
echo ' done'
1099+
1100+
# Validate release was uninstalled/reinstalled.
1101+
HISTORY=$(helm -n helm-system history -o json $test_name)
1102+
REVISION_COUNT=$(echo "$HISTORY" | jq 'length')
1103+
if [ "$REVISION_COUNT" != 1 ]; then
1104+
echo -e "Unexpected revision count: $REVISION_COUNT"
1105+
exit 1
1106+
fi
1107+
LAST_REVISION_STATUS=$(echo "$HISTORY" | jq -r 'last | .status')
1108+
if [ "$LAST_REVISION_STATUS" != "failed" ]; then
1109+
echo -e "Unexpected last revision status: $LAST_REVISION_STATUS"
1110+
exit 1
1111+
fi
1112+
1113+
kubectl delete -n helm-system -f config/testdata/$test_name/install.yaml
1114+
- name: Run upgrade with chart name changed and reinstall ChartNameChangeStrategy
1115+
run: |
1116+
test_name=upgrade-chart-name-change
1117+
kubectl -n helm-system apply -f config/testdata/$test_name/install.yaml
1118+
echo -n ">>> Waiting for expected conditions"
1119+
count=0
1120+
until [ 'true' == "$( kubectl -n helm-system get helmrelease/$test_name -o json | jq '.status.conditions | map( { (.type): .status } ) | add | .Released=="True" and .Ready=="True"' )" ]; do
1121+
echo -n '.'
1122+
sleep 5
1123+
count=$((count + 1))
1124+
if [[ ${count} -eq 24 ]]; then
1125+
echo ' No more retries left!'
1126+
exit 1
1127+
fi
1128+
done
1129+
echo ' done'
1130+
1131+
# Validate release was installed.
1132+
HISTORY=$(helm -n helm-system history -o json $test_name)
1133+
REVISION_COUNT=$(echo "$HISTORY" | jq 'length')
1134+
if [ "$REVISION_COUNT" != 1 ]; then
1135+
echo -e "Unexpected revision count: $REVISION_COUNT"
1136+
exit 1
1137+
fi
1138+
LAST_REVISION_STATUS=$(echo "$HISTORY" | jq -r 'last | .status')
1139+
if [ "$LAST_REVISION_STATUS" != "deployed" ]; then
1140+
echo -e "Unexpected last revision status: $LAST_REVISION_STATUS"
1141+
exit 1
1142+
fi
1143+
1144+
kubectl -n helm-system apply -f config/testdata/$test_name/upgrade-reinstall.yaml
1145+
echo -n ">>> Waiting for expected conditions"
1146+
count=0
1147+
until [ 'true' == "$( kubectl -n helm-system get helmrelease/$test_name -o json | jq '.status.upgradeFailures == 1 and .status.installFailures == 1 and ( .status.conditions | map( { (.type): .status } ) | add | .Released=="False" and .Ready=="False" )' )" ]; do
1148+
echo -n '.'
1149+
sleep 5
1150+
count=$((count + 1))
1151+
if [[ ${count} -eq 24 ]]; then
1152+
echo ' No more retries left!'
1153+
exit 1
1154+
fi
1155+
done
1156+
echo ' done'
1157+
1158+
# Validate release was uninstalled/reinstalled.
1159+
HISTORY=$(helm -n helm-system history -o json $test_name)
1160+
REVISION_COUNT=$(echo "$HISTORY" | jq 'length')
1161+
if [ "$REVISION_COUNT" != 1 ]; then
1162+
echo -e "Unexpected revision count: $REVISION_COUNT"
1163+
exit 1
1164+
fi
1165+
LAST_REVISION_STATUS=$(echo "$HISTORY" | jq -r 'last | .status')
1166+
if [ "$LAST_REVISION_STATUS" != "failed" ]; then
1167+
echo -e "Unexpected last revision status: $LAST_REVISION_STATUS"
1168+
exit 1
1169+
fi
1170+
1171+
kubectl delete -n helm-system -f config/testdata/$test_name/install.yaml
1172+
- name: Run upgrade with chart name changed and InPlaceUpdate ChartNameChangeStrategy
1173+
run: |
1174+
test_name=upgrade-chart-name-change
1175+
kubectl -n helm-system apply -f config/testdata/$test_name/install.yaml
1176+
echo -n ">>> Waiting for expected conditions"
1177+
count=0
1178+
until [ 'true' == "$( kubectl -n helm-system get helmrelease/$test_name -o json | jq '.status.conditions | map( { (.type): .status } ) | add | .Released=="True" and .Ready=="True"' )" ]; do
1179+
echo -n '.'
1180+
sleep 5
1181+
count=$((count + 1))
1182+
if [[ ${count} -eq 24 ]]; then
1183+
echo ' No more retries left!'
1184+
exit 1
1185+
fi
1186+
done
1187+
echo ' done'
1188+
1189+
# Validate release was installed.
1190+
HISTORY=$(helm -n helm-system history -o json $test_name)
1191+
REVISION_COUNT=$(echo "$HISTORY" | jq 'length')
1192+
if [ "$REVISION_COUNT" != 1 ]; then
1193+
echo -e "Unexpected revision count: $REVISION_COUNT"
1194+
exit 1
1195+
fi
1196+
LAST_REVISION_STATUS=$(echo "$HISTORY" | jq -r 'last | .status')
1197+
if [ "$LAST_REVISION_STATUS" != "deployed" ]; then
1198+
echo -e "Unexpected last revision status: $LAST_REVISION_STATUS"
1199+
exit 1
1200+
fi
1201+
1202+
kubectl -n helm-system apply -f config/testdata/$test_name/upgrade-inplace.yaml
1203+
1204+
# Wait for the upgrade to complete (revision count should be 2).
1205+
echo -n ">>> Waiting for upgrade"
1206+
count=0
1207+
until [ '2' == "$(helm -n helm-system history -o json $test_name 2>/dev/null | jq 'length')" ]; do
1208+
echo -n '.'
1209+
sleep 5
1210+
count=$((count + 1))
1211+
if [[ ${count} -eq 24 ]]; then
1212+
echo ' No more retries left!'
1213+
exit 1
1214+
fi
1215+
done
1216+
echo ' done'
1217+
1218+
kubectl -n helm-system wait helmreleases/$test_name --for=condition=ready --timeout=4m
1219+
1220+
kubectl delete -n helm-system -f config/testdata/$test_name/install.yaml
10561221
- name: Run upgrade fail with uninstall remediation strategy test
10571222
run: |
10581223
test_name=upgrade-fail-remediate-uninstall
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*~
18+
# Various IDEs
19+
.project
20+
.idea/
21+
*.tmproj
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
version: 6.11.3
3+
appVersion: 6.11.3
4+
name: pod2info
5+
engine: gotpl
6+
description: Podinfo Helm chart for Kubernetes
7+
home: https://github.com/MichaelMorrisEst/podinfo
8+
maintainers:
9+
10+
name: stefanprodan
11+
sources:
12+
- https://github.com/MichaelMorrisEst/podinfo
13+
kubeVersion: ">=1.23.0-0"

0 commit comments

Comments
 (0)