Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit 18f8318

Browse files
author
Noah Lee
authored
Fix the dynamic payload validation (#445)
1 parent 54a8409 commit 18f8318

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Diff for: internal/interactor/validator.go

+4
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ type DynamicPayloadValidator struct {
176176
}
177177

178178
func (v *DynamicPayloadValidator) Validate(d *ent.Deployment) error {
179+
if d.IsRollback {
180+
return nil
181+
}
182+
179183
if !v.Env.IsDynamicPayloadEnabled() {
180184
return nil
181185
}

Diff for: internal/interactor/validator_test.go

+10
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,13 @@ func TestSerializationValidator_Validate(t *testing.T) {
138138
}
139139
})
140140
}
141+
142+
func TestDynamicPayloadValidator_Validate(t *testing.T) {
143+
t.Run("Returns nil if it is rollback.", func(t *testing.T) {
144+
v := &i.DynamicPayloadValidator{Env: &extent.Env{}}
145+
146+
if err := v.Validate(&ent.Deployment{IsRollback: true}); err != nil {
147+
t.Fatalf("Validate returns an error: %s", err)
148+
}
149+
})
150+
}

0 commit comments

Comments
 (0)