-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Fix for Flaky test TestServiceWithPredefinedNetwork #36551
Conversation
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.
There seems to be a couple problems with this test.
-
It's not actually checking anything about the service, just that it exists. Shouldn't it be comparing the inspect result to the expected?
-
It shouldn't be doing cleanup. That is handled by
setupTest(t)()
.
What is the purpose of this test? What is the host
network a special case? That is what needs to be checked.
|
||
} | ||
|
||
func serviceRunningCount(client client.ServiceAPIClient, serviceID string, instances uint64) func(log poll.LogT) poll.Result { | ||
return func(log poll.LogT) poll.Result { | ||
filter := filters.NewArgs() | ||
filter.Add("service", serviceID) |
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.
Removing this is not the correct fix. It should be used as a filter in ServiceList
.
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.
- The actual regression issue was we couldnt create service with host network. Thats what I tried to test it to make sure there is no issue in creating service with host network.
- For your clean up comment : I try to remove service and make sure service is getting cleared. Thats what I meant by cleanup. I am not doing anything extra. Do you suggest I dont need to do verify the service that I created whether I am able to remove or not?. Pls let me know your feedback on this.
3)Regarding not adding filter: I am trying to get all the services running. so looked into existing examples of functions calling serviceList API. none of them using filter. Your previous comment on original comment said , I have defined filter but not using it. So i wanted to clean up the code as part of your previous comment. Pls correct me if my understand is wrong.
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.
I try to remove service and make sure service is getting cleared. Thats what I meant by cleanup. I am not doing anything extra. Do you suggest I dont need to do verify the service that I created whether I am able to remove or not?. Pls let me know your feedback on this.
That's right. The daemon which runs this service is going to be shutdown when the test exits (defer d.Stop(t)
) so you don't need to spend time doing cleanup.
Regarding not adding filter: I am trying to get all the services running.
Ok, I guess this is ok since you're targeting a daemon that was launched for this test.
@selansen this needs a minor rebase |
should I pull latest moby and apply my change on top of it and submit again
?
…On Wed, Mar 14, 2018 at 3:09 PM, Sebastiaan van Stijn < ***@***.***> wrote:
@selansen <https://github.com/selansen> this needs a minor rebase
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#36551 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AKEKn0xiI-xgk123GyuyL1U_e-zfgZ2Fks5teWrZgaJpZM4Sk8aV>
.
|
Codecov Report
@@ Coverage Diff @@
## master #36551 +/- ##
=========================================
Coverage ? 34.76%
=========================================
Files ? 612
Lines ? 45577
Branches ? 0
=========================================
Hits ? 15844
Misses ? 27663
Partials ? 2070 |
You should fetch the latest code then make your topic branch |
Thats what I did and committed my changes. Looks like all sanity passed. |
Seems the symptom of |
Yes. taken care of that too |
@thaJeztah , Hope this helps flaky issue that we are seeing on selective target. |
|
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.
noticed some things; @selansen can you check?
@@ -159,3 +149,17 @@ func swarmIngressReady(client client.NetworkAPIClient) func(log poll.LogT) poll. | |||
return poll.Success() | |||
} | |||
} | |||
|
|||
func noServices(client client.ServiceAPIClient) func(log poll.LogT) poll.Result { |
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.
Erm, this function doesn't seem to be called?
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.
I kept the new API so that TestServiceWithIngressNetwork will call it. Let me update it.
integration/network/service_test.go
Outdated
@@ -106,9 +101,6 @@ func TestServiceWithIngressNetwork(t *testing.T) { | |||
err = client.ServiceRemove(context.Background(), serviceID) | |||
require.NoError(t, err) | |||
|
|||
poll.WaitOn(t, serviceIsRemoved(client, serviceID), pollSettings) | |||
poll.WaitOn(t, noTasks(client), pollSettings) |
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.
If we don't check if the service (plus tasks?) are all removed here, this test may not be testing what it was created for (i.e.: check that the ingress network is not removed when removing services)
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.
Idea was to check service is removed instead task as we are testing service create/remove. Thats why I added new API. Let me update TestServiceWithIngressNetwork. Thanks for pointing it out.
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.
BTW actual test that was written by Chris Telfer was to verify Ingress network absence after service remove. So test will fail if it is not met. Daniel mentioned service clean up will happen automatically when we tear down the swarm . so we dont need to check this explicitly. Anyways I update the with new API that TestServiceWithIngressNetwork with my newly added noServices check to make sure we cover that .
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.
LGTM 🐯
Failed test cases are not related to my test cases. |
Seems |
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.
LGTM, but needs a rebase (looks like because of the gotestyourself changes)
@thaJeztah , I just did a rebase. should be good to go. |
TestServiceWithPredefinedNetwork test case was failing at times. To fix the issue, added new API to check for services after we clean up all services. Tested multiple times and this sould fix flaky issue. Signed-off-by: selansen <[email protected]>
Thanks! moved it to "status/merge" - fingers crossed if it all goes green 👍 |
Hm, more flakiness?
|
These tests pass now though;
|
Not sure about docker_api_swarm_service_test. They are not related to the fix I did. May be we need to take it as separate issue. |
Fixes #36547
Signed-off-by: selansen [email protected]
- What I did
- How I did it
- How to verify it
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)