Skip to content

Commit

Permalink
Merge pull request kubernetes#42674 from nikhiljindal/secretKubeTe
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue

Enable secrets in federation kubectl tests

Fixes kubernetes#40568
Superseedes kubernetes#40714

Updating kubectl tests to wait for deletion if WAIT_FOR_DELETION is set to true. WAIT_FOR_DELETION will be set to true only when the tests are being run for federation apiserver.
This change will not impact kube apiserver tests and still enable federation and kubernetes to share the same test code.
This is a workaround until kubernetes#42594 is fixed.

cc @kubernetes/sig-federation-pr-reviews
cc @liggitt as he reviewed kubernetes#40714
  • Loading branch information
Kubernetes Submit Queue authored Apr 4, 2017
2 parents 39713ac + 3b8ba56 commit 3c35713
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
9 changes: 9 additions & 0 deletions hack/make-rules/test-cmd-util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1868,6 +1868,9 @@ run_secrets_test() {
kubectl delete secret test-secret --namespace=test-secrets

### Create a docker-registry secret in a specific namespace
if [[ "${WAIT_FOR_DELETION:-}" == "true" ]]; then
kube::test::wait_object_assert 'secrets --namespace=test-secrets' "{{range.items}}{{$id_field}}:{{end}}" ''
fi
# Pre-condition: no SECRET exists
kube::test::get_object_assert 'secrets --namespace=test-secrets' "{{range.items}}{{$id_field}}:{{end}}" ''
# Command
Expand All @@ -1880,6 +1883,9 @@ run_secrets_test() {
kubectl delete secret test-secret --namespace=test-secrets

### Create a tls secret
if [[ "${WAIT_FOR_DELETION:-}" == "true" ]]; then
kube::test::wait_object_assert 'secrets --namespace=test-secrets' "{{range.items}}{{$id_field}}:{{end}}" ''
fi
# Pre-condition: no SECRET exists
kube::test::get_object_assert 'secrets --namespace=test-secrets' "{{range.items}}{{$id_field}}:{{end}}" ''
# Command
Expand Down Expand Up @@ -1914,6 +1920,9 @@ __EOF__
kubectl delete secret secret-string-data --namespace=test-secrets

### Create a secret using output flags
if [[ "${WAIT_FOR_DELETION:-}" == "true" ]]; then
kube::test::wait_object_assert 'secrets --namespace=test-secrets' "{{range.items}}{{$id_field}}:{{end}}" ''
fi
# Pre-condition: no secret exists
kube::test::get_object_assert 'secrets --namespace=test-secrets' "{{range.items}}{{$id_field}}:{{end}}" ''
# Command
Expand Down
8 changes: 6 additions & 2 deletions hack/make-rules/test-federation-cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,12 @@ kube::log::status "Running kubectl tests for federation-apiserver"
setup
run_federation_apiserver
run_federation_controller_manager
# TODO: Fix for secrets, replicasets and deployments.
SUPPORTED_RESOURCES=("configmaps" "daemonsets" "events" "ingress" "namespaces" "services")
# TODO: Fix for replicasets and deployments.
SUPPORTED_RESOURCES=("configmaps" "daemonsets" "events" "ingress" "namespaces" "services" "secrets")
# Set wait for deletion to true for federation apiserver since resources are
# deleted asynchronously.
# This is a temporary workaround until https://github.com/kubernetes/kubernetes/issues/42594 is fixed.
WAIT_FOR_DELETION="true"
# WARNING: Do not wrap this call in a subshell to capture output, e.g. output=$(runTests)
# Doing so will suppress errexit behavior inside runTests
runTests
Expand Down

0 comments on commit 3c35713

Please sign in to comment.