Skip to content

Commit

Permalink
Merge pull request openshift#9841 from liggitt/sa-test-flake
Browse files Browse the repository at this point in the history
Merged by openshift-bot
  • Loading branch information
OpenShift Bot authored Jul 14, 2016
2 parents e1d5e16 + dea2566 commit 5d153b2
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions test/integration/sa_oauthclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
kapi "k8s.io/kubernetes/pkg/api"
kapierrors "k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/client/restclient"
kclient "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/serviceaccount"
"k8s.io/kubernetes/pkg/util/wait"

Expand Down Expand Up @@ -75,24 +76,21 @@ func TestSAAsOAuthClient(t *testing.T) {
}

// get the SA ready with redirect URIs and secret annotations
defaultSA, err := clusterAdminKubeClient.ServiceAccounts(projectName).Get("default")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
var defaultSA *kapi.ServiceAccount

// retry this a couple times. We seem to be flaking on update conflicts and missing secrets all together
err = wait.PollImmediate(30*time.Millisecond, 10*time.Second, func() (done bool, err error) {
err = kclient.RetryOnConflict(kclient.DefaultRetry, func() error {
defaultSA, err = clusterAdminKubeClient.ServiceAccounts(projectName).Get("default")
if err != nil {
return err
}
if defaultSA.Annotations == nil {
defaultSA.Annotations = map[string]string{}
}
defaultSA.Annotations[saoauth.OAuthRedirectURISecretAnnotationPrefix+"one"] = oauthServer.URL
defaultSA.Annotations[saoauth.OAuthWantChallengesAnnotationPrefix] = "true"
defaultSA, err = clusterAdminKubeClient.ServiceAccounts(projectName).Update(defaultSA)
if err != nil {
t.Logf("unexpected err: %v", err)
return false, nil
}
return true, nil
return err
})
if err != nil {
t.Fatalf("unexpected error: %v", err)
Expand Down

0 comments on commit 5d153b2

Please sign in to comment.