Fix flaky test TestServiceUpdateSecrets#38499
Conversation
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #38499 +/- ##
==========================================
- Coverage 36.65% 36.62% -0.04%
==========================================
Files 608 608
Lines 45174 45174
==========================================
- Hits 16560 16544 -16
- Misses 26329 26341 +12
- Partials 2285 2289 +4 |
|
(reserved for my derek commands) |
|
Wow 😮 this PR passed CI on first try. Haven't see that happening earlier. Anyway as purpose is see if those flaky tests are fixed I will do force push to see if they passes second time. |
42aed22 to
457fcd7
Compare
|
Only RS1 failed on second run. Looks nice. |
thaJeztah
left a comment
There was a problem hiding this comment.
Left some thoughts, but happy to get feedback on those 👍
457fcd7 to
d5cc0ad
Compare
Tests which will re-deploy containers uses function serviceIsUpdated() to make sure that service update really reached state UpdateStateCompleted. Tests which will not re-deploy container uses function serviceSpecIsUpdated to make sure that service version is increased. Signed-off-by: Olli Janatuinen <[email protected]>
d5cc0ad to
b868ada
Compare
|
@kolyshkin you maybe also want to look this? |
thaJeztah
left a comment
There was a problem hiding this comment.
LGTM to make our CI work (thanks!!)
But we should dig into this indeed to see why we can't rely on service.UpdateStatus for this; this feels like a band-aid for either a bug, or an issue in the design
|
@thaJeztah on that case IMO correct approach would be add similar label modify tests to swarmkit side. |
|
This is interesting that updating labels actually even sets the update status to nil. |
|
In swarmkit when the service is updated in the store, the UpdateStatus is always set to nil. I guess since there's nothing left to reconcile no update status needs to be set. |
|
This |
|
@cpuguy83 can be done but I would still prefer to merge this and create another PR for those improvements so we get CI working again. UpdateStatus is set to Nil on https://github.com/docker/swarmkit/blob/0091d9285168040649140c76629e4284857e5365/manager/controlapi/service.go#L827-L828 |
cpuguy83
left a comment
There was a problem hiding this comment.
LGTM
The old implementation just looks incorrect for what it was doing.
|
Looking at that code; #38499 (comment) As part of the Service update,
var dirtySlots []orchestrator.Slot
for _, slot := range slots {
if u.isSlotDirty(slot) {
dirtySlots = append(dirtySlots, slot)
}
}Some changes on a service don't require updates to the task (container); to check if updates are needed, these functions are called: If changes are needed, However, in case of the // Abort immediately if all tasks are clean.
if len(dirtySlots) == 0 {
if service.UpdateStatus != nil &&
(service.UpdateStatus.State == api.UpdateStatus_UPDATING ||
service.UpdateStatus.State == api.UpdateStatus_ROLLBACK_STARTED) {
u.completeUpdate(ctx, service.ID)
}
return
}Even if we would skip the check (if an updated or rollback was started), if service.UpdateStatus == nil {
// The service was changed since we started this update
return nil
}Based on the above, it looks like
I think we can make it non-ambiguous if we set the status to |
- What I did
Alternative for #38474 to solve #37547
- How I did it
Took original commit from #38474 as baseline and added new serviceSpecIsUpdated() function which checks only that service version is updated when only updating service labels.
- How to verify it
Run CI builds couple of times and survive without TestServiceUpdateSecrets or TestServiceUpdateConfigs failures.