Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

e2e: Poll when checking the flux sync tag #2687

Merged
merged 1 commit into from
Dec 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions test/e2e/12_sync.bats
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,18 @@ function setup() {
poll_until_true 'workload podinfo' 'kubectl -n demo describe deployment/podinfo'

# Check the sync tag
git pull -f --tags
local sync_tag_hash
sync_tag_hash=$(git rev-list -n 1 flux)
local head_hash
head_hash=$(git rev-list -n 1 HEAD)
[ "$head_hash" = "$sync_tag_hash" ]
poll_until_equals "sync tag" "$head_hash" 'git pull -f --tags > /dev/null 2>&1; git rev-list -n 1 flux'

# Add a change, wait for it to happen and check the sync tag again
sed -i'.bak' 's%stefanprodan/podinfo:.*%stefanprodan/podinfo:3.1.5%' "${clone_dir}/workloads/podinfo-dep.yaml"
git -c '[email protected]' -c 'user.name=Foo' commit -am "Bump podinfo"
head_hash=$(git rev-list -n 1 HEAD)
git push >&3
poll_until_equals "podinfo image" "stefanprodan/podinfo:3.1.5" "kubectl get pod -n demo -l app=podinfo -o\"jsonpath={['items'][0]['spec']['containers'][0]['image']}\""
git pull -f --tags
sync_tag_hash=$(git rev-list -n 1 flux)
[ "$head_hash" = "$sync_tag_hash" ]
poll_until_equals "sync tag" "$head_hash" 'git pull -f --tags > /dev/null 2>&1; git rev-list -n 1 flux'

}

@test "Sync fails on duplicate resource" {
Expand Down
4 changes: 1 addition & 3 deletions test/e2e/13_sync_gc.bats
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ function setup() {
fluxctl --k8s-fwd-ns "${FLUX_NAMESPACE}" sync

poll_until_equals "podinfo deployment removed" "[]" "kubectl get deploy -n demo -o\"jsonpath={['items']}\""
git pull -f --tags >&3
sync_tag_hash=$(git rev-list -n 1 flux)
[ "$sync_tag_hash" = "$head_hash" ]
poll_until_equals "sync tag" "$head_hash" 'git pull -f --tags > /dev/null 2>&1; git rev-list -n 1 flux'
}

function teardown() {
Expand Down