Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flake fix for cassandra:cassandra #25133

Merged
merged 1 commit into from
May 5, 2016
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions hack/lib/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ kube::test::clear_all() {
kubectl delete "${kube_flags[@]}" rc,pods --all --grace-period=0
}

# Force exact match of a returned result for a object query. Wrap this with || to support multiple
# valid return types.
kube::test::get_object_assert() {
local object=$1
local request=$2
Expand Down
11 changes: 9 additions & 2 deletions hack/test-cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1724,9 +1724,16 @@ __EOF__
kube::log::status "Testing resource aliasing"
kubectl create -f examples/cassandra/cassandra-controller.yaml "${kube_flags[@]}"
kubectl create -f examples/cassandra/cassandra-service.yaml "${kube_flags[@]}"
kube::test::get_object_assert "all -l'app=cassandra'" "{{range.items}}{{range .metadata.labels}}{{.}}:{{end}}{{end}}" 'cassandra:cassandra:cassandra:cassandra:'
kubectl delete all -l app=cassandra "${kube_flags[@]}"

object="all -l'app=cassandra'"
request="{{range.items}}{{range .metadata.labels}}{{.}}:{{end}}{{end}}"

# all 4 cassandra's might not be in the request immediately...
kube::test::get_object_assert "$object" "$request" 'cassandra:cassandra:cassandra:cassandra:' || \
kube::test::get_object_assert "$object" "$request" 'cassandra:cassandra:cassandra:' || \
kube::test::get_object_assert "$object" "$request" 'cassandra:cassandra:'
Copy link
Member

@janetkuo janetkuo May 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about retry like this:

for count in $(seq 0 3); do
    if <the get command with 4 cassandra strings succeeded>
      break
    else
      sleep $((2**count))
    fi
done

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or it's fine if we don't care whether the pods come up or not. It's up to you.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea @janetkuo ... i think i kinda prefer explicit vs sleeps but am mostly +0 . I'll keep as-is mostly because im lazy :)


kubectl delete all -l app=cassandra "${kube_flags[@]}"

###########
# Explain #
Expand Down