Skip to content

Commit

Permalink
Merge pull request kubernetes#93990 from knight42/fix/run_kubectl_app…
Browse files Browse the repository at this point in the history
…ly_tests

test(kubectl): deflake run_kubectl_apply_tests(round 2)
  • Loading branch information
k8s-ci-robot committed Aug 14, 2020
2 parents fa1a3e0 + 3cb3356 commit c2bde25
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/cmd/apply.sh
Expand Up @@ -144,6 +144,18 @@ run_kubectl_apply_tests() {
}
__EOF__

# Ensure the API server has recognized and started serving the associated CR API
local tries=5
for i in $(seq 1 $tries); do
local output
output=$(kubectl "${kube_flags[@]:?}" api-resources --api-group mygroup.example.com -oname)
if kube::test::if_has_string "$output" resources.mygroup.example.com; then
break
fi
echo "${i}: Waiting for CR API to be available"
sleep "$i"
done

# Dry-run create the CR
kubectl "${kube_flags[@]:?}" apply --dry-run=server -f hack/testdata/CRD/resource.yaml "${kube_flags[@]:?}"
# Make sure that the CR doesn't exist
Expand Down

0 comments on commit c2bde25

Please sign in to comment.