Skip to content

Commit

Permalink
fix: update canonicalize job test to include canonicalize update stra…
Browse files Browse the repository at this point in the history
…tegy
  • Loading branch information
Juanadelacuesta committed Apr 3, 2023
1 parent e61fa47 commit 418dcf3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 2 additions & 0 deletions nomad/job_endpoint_hooks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,7 @@ func Test_jobCanonicalizer_Mutate(t *testing.T) {
Namespace: "default",
Datacenters: []string{"*"},
Priority: 123,
Update: *structs.DefaultUpdateStrategy,
},
},
{
Expand All @@ -753,6 +754,7 @@ func Test_jobCanonicalizer_Mutate(t *testing.T) {
Namespace: "default",
Datacenters: []string{"*"},
Priority: serverJobDefaultPriority,
Update: *structs.DefaultUpdateStrategy,
},
},
}
Expand Down
10 changes: 1 addition & 9 deletions nomad/structs/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -5156,7 +5156,7 @@ func (u *UpdateStrategy) Rolling() bool {
func (u *UpdateStrategy) Canonicalize() {
d := DefaultUpdateStrategy

if u.MaxParallel != 0 {
if u.MaxParallel == 0 {
u.MaxParallel = d.MaxParallel
}

Expand All @@ -5180,17 +5180,9 @@ func (u *UpdateStrategy) Canonicalize() {
u.MinHealthyTime = d.MinHealthyTime
}

if u.AutoRevert == false {
u.AutoRevert = d.AutoRevert
}

if u.Canary == 0 {
u.Canary = d.Canary
}

if u.AutoPromote == false {
u.AutoPromote = d.AutoPromote
}
}

type Multiregion struct {
Expand Down

0 comments on commit 418dcf3

Please sign in to comment.