Skip to content
Merged
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
32 changes: 25 additions & 7 deletions test/e2e/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"testing"
"time"

apps1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/util/wait"
Expand Down Expand Up @@ -61,9 +60,8 @@ func TestProxy(t *testing.T) {
}

t.Logf("waiting for the new console deployment with proxy environment variables...")
var newConsoleDeployment *apps1.Deployment
err = wait.Poll(1*time.Second, framework.AsyncOperationTimeout, func() (stop bool, err error) {
newConsoleDeployment, err = framework.GetConsoleDeployment(client)
newConsoleDeployment, err := framework.GetConsoleDeployment(client)
if err != nil {
return false, err
}
Expand All @@ -75,12 +73,32 @@ func TestProxy(t *testing.T) {
}
return false, nil
})

for _, err = range framework.CheckEnvVars(proxyEnvVars["clusterVars"], newConsoleDeployment.Spec.Template.Spec.Containers[0].Env, true) {
t.Fatal(err)
}
err = pollDeploymentForEnv(client, proxyEnvVars["clusterVars"])

if err != nil {
t.Fatal(err)
}
}

func pollDeploymentForEnv(client *framework.ClientSet, clusterVars []corev1.EnvVar) error {
counter := 0
maxCount := 60
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So this simply takes a while to propagate correct?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ready to remove the [WIP]?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Perhaps could extract this bit out into a pollDeploymentForEnv func to make it explicit why its needed.

Copy link
Copy Markdown
Member Author

@jhadvig jhadvig Oct 2, 2019

Choose a reason for hiding this comment

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

So this simply takes a while to propagate correct?

yes

err := wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) {
newConsoleDeployment, err := framework.GetConsoleDeployment(client)
if err != nil {
return false, err
}
for _, err = range framework.CheckEnvVars(clusterVars, newConsoleDeployment.Spec.Template.Spec.Containers[0].Env, true) {
if counter == maxCount {
if err != nil {
return false, err
}
}
counter++
return false, nil
}
return true, nil
})

return err
}