-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
integration-cli: add test for restarting entire swarm cluster #24465
Conversation
func (s *DockerSwarmSuite) TestApiSwarmRestartCluster(c *check.C) { | ||
var nodes []*SwarmDaemon | ||
d1 := s.AddDaemon(c, false, false) | ||
c.Assert(d1.Init(swarm.InitRequest{ |
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.
This is default for s.AddDaemon(c, true, true)
// pollFunc is used to periodically execute a check function, it | ||
// returns error after timeout. | ||
func pollFunc(f func() error, timeout time.Duration) error { | ||
if f() == nil { |
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.
should be f
not f()
right? it'll call f()
or panic if f
is nil
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 think it's checking for the error returned by f()
😝
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.
that's check on line 1579, I think the check here is for nilness - not the return
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.
Pretty sure this one is for not entering in the loop and start the timer 😉
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.
what's the point of not entering the for with the timer if it returns nil and you exit the for and the function at line 1581? it's a duplicate check then? the function will always exit at that return nil if f() return nil so why not entering the for?
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.
@LK4D4 ? 👼
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
@tonistiigi I removed polling overall as you suggested. |
var leaderFound bool | ||
totalMCount++ | ||
var mCount, wCount int | ||
for _, n := range d.listNodes(c) { |
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.
This API call gets proxied to the leader, so what we really see is the leader's view of the cluster.
I still think this loop is worth doing, because it confirms that API calls can be run against each of the managers. But it's important to understand that the information returned is really coming from the leader.
LGTM |
1 similar comment
LGTM |
ping @tonistiigi