Skip to content

Commit

Permalink
Fix flaky chart tests (#1820)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andres Martinez Gotor committed Jun 25, 2020
1 parent 55fd3b6 commit 9e03645
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 8 deletions.
17 changes: 15 additions & 2 deletions chart/kubeapps/templates/tests/test-assetsvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,20 @@ spec:
- name: ASSETSVC_PORT
value: "{{ .Values.assetsvc.service.port }}"
command:
- sh
- bash
- -c
- curl -o /tmp/output $ASSETSVC_HOST:$ASSETSVC_PORT/v1/ns/{{ .Release.Namespace }}/charts && cat /tmp/output && cat /tmp/output | grep wordpress
# We are requesting the "wordpress" chart to the chartsvc to check that everything works as expected
# Also, we retry several times in case the repository is being populated at the time of executing this test
- |
n=0
until [ "$n" -ge 5 ]; do
if curl -o /tmp/output $ASSETSVC_HOST:$ASSETSVC_PORT/v1/ns/{{ .Release.Namespace }}/charts && cat /tmp/output && cat /tmp/output | grep wordpress; then
break
fi
sleep 10
((n+=1))
done
if [ "$n" -eq 5 ]; then
exit 1
fi
restartPolicy: Never
4 changes: 2 additions & 2 deletions integration/use-cases/default-deployment.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ test("Deploys an application with the values by default", async () => {
await page.goto(getUrl("/#/login"));

await expect(page).toFillForm("form", {
token: process.env.ADMIN_TOKEN
token: process.env.ADMIN_TOKEN,
});

await expect(page).toClick("button", { text: "Login" });

await expect(page).toClick("a", { text: "Catalog" });

await expect(page).toClick("a", { text: "aerospike", timeout: 60000 });
await expect(page).toClick("a", { text: "apache", timeout: 60000 });

await expect(page).toClick("button", { text: "Deploy" });

Expand Down
4 changes: 2 additions & 2 deletions integration/use-cases/missing-permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ test("Fails to deploy an application due to missing permissions", async () => {
await page.goto(getUrl("/#/login"));

await expect(page).toFillForm("form", {
token: process.env.VIEW_TOKEN
token: process.env.VIEW_TOKEN,
});

await expect(page).toClick("button", { text: "Login" });

await expect(page).toClick("a", { text: "Catalog" });

await expect(page).toClick("a", { text: "aerospike", timeout: 60000 });
await expect(page).toClick("a", { text: "apache", timeout: 60000 });

await expect(page).toClick("button", { text: "Deploy" });

Expand Down
8 changes: 6 additions & 2 deletions script/e2e-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,12 @@ else
fi

# Wait for Kubeapps Jobs
k8s_wait_for_job_completed kubeapps apprepositories.kubeapps.com/repo-name=stable
info "Job apprepositories.kubeapps.com/repo-name=stable ready"
# Clean up existing jobs
kubectl delete jobs -n kubeapps --all
# Trigger update of the bitnami repository
kubectl patch apprepositories.kubeapps.com -n kubeapps bitnami -p='[{"op": "replace", "path": "/spec/resyncRequests", "value":1}]' --type=json
k8s_wait_for_job_completed kubeapps apprepositories.kubeapps.com/repo-name=bitnami
info "Job apprepositories.kubeapps.com/repo-name=bitnami ready"

info "All deployments ready. PODs:"
kubectl get pods -n kubeapps -o wide
Expand Down

0 comments on commit 9e03645

Please sign in to comment.