8000 Fix the dynamic payload validation (#445) · gitploy-io/gitploy@18f8318 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
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

internal/interactor/validator.go

Lines changed: 4 additions & 0 deletions
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
}

internal/interactor/validator_test.go

Lines changed: 10 additions & 0 deletions
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)
0