Fixes https://github.com/moby/moby/issues/44378 by s4ke · Pull Request #3082 · moby/swarmkit (original) (raw)

AssignedGenericResources in constraint_enforcer.go were falsely checked inside a case that enforced Reservations to be set Furthermore, the if statement had a missing !

Signed-off-by: Martin Braun braun@neuroforge.de

- What I did

Fixed a inverted logic bug in constraint_enforcer.go that should fix moby/moby#44378

- How I did it

I added a test for constraint_enforcer_test.go that checks for proper enforcement of generic resources being present. While doing so, I noticed that the checks for AssignedGenericResources were done inside a check for the resources. This seemed wrong, so I moved the logic outside of the if statement.

- How to test it

- Description for the changelog

Fixed a inverted logic bug in constraint_enforcer.go that should fix moby/moby#44378