-
Notifications
You must be signed in to change notification settings - Fork 829
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
Flaky: TestAllocator #789
Flaky: TestAllocator #789
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,12 +22,15 @@ import ( | |
"io/ioutil" | ||
"net/http" | ||
"testing" | ||
"time" | ||
|
||
"agones.dev/agones/pkg/apis/allocation/v1alpha1" | ||
stablev1alpha1 "agones.dev/agones/pkg/apis/stable/v1alpha1" | ||
e2e "agones.dev/agones/test/e2e/framework" | ||
"github.com/sirupsen/logrus" | ||
"github.com/stretchr/testify/assert" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/util/wait" | ||
) | ||
|
||
func TestAllocator(t *testing.T) { | ||
|
@@ -70,9 +73,23 @@ func TestAllocator(t *testing.T) { | |
if !assert.Nil(t, err) { | ||
return | ||
} | ||
response, err := client.Post(requestURL, "application/json", bytes.NewBuffer(body)) | ||
if !assert.Nil(t, err) { | ||
return | ||
|
||
// wait for the allocation system to come online | ||
var response *http.Response | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pooneh-m for interest's sake - this was what (seems to have) solved the flakiness issue. My theory is that there was a race condition wherein the backing pods for the service would come up after this test was run, but only sometimes (probably depending on e2e test order). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the fix. Makes sense. |
||
err = wait.PollImmediate(2*time.Second, 5*time.Minute, func() (bool, error) { | ||
response, err = client.Post(requestURL, "application/json", bytes.NewBuffer(body)) | ||
|
||
if err != nil { | ||
response.Body.Close() // nolint: errcheck | ||
logrus.WithError(err).Infof("failing http request") | ||
return false, nil | ||
} | ||
|
||
return true, nil | ||
}) | ||
|
||
if !assert.NoError(t, err) { | ||
assert.FailNow(t, "Http test failed") | ||
} | ||
defer response.Body.Close() // nolint: errcheck | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Kuqd for interest's sake - this was the fix for the e2e tests. even with
-q
this was always returning a non zero status code. 🤷♂️