Skip to content

Commit

Permalink
fix: fix the regexp of execution status outdate key (#18481)
Browse files Browse the repository at this point in the history
Signed-off-by: chlins <chenyuzh@vmware.com>
  • Loading branch information
chlins authored Apr 5, 2023
1 parent 72a6ef2 commit 697f1c7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/pkg/task/dao/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ var (
// execStatusOutdateKeyRegex is the regex for the execution status outdate key,
// the regex used to parse exec id and vendor type from the key.
// e.g. execution:id:100:vendor:REPLICATION:status_outdate
execStatusOutdateKeyRegex = regexp.MustCompile(`execution:id:(\d+):vendor:([A-Z_]+):status_outdate`)
execStatusOutdateKeyRegex = regexp.MustCompile(`execution:id:(\d+):vendor:([A-Z0-9_]+):status_outdate`)
)

// ExecutionStatusChangePostFunc is the function called after the execution status changed
Expand Down
3 changes: 2 additions & 1 deletion src/pkg/task/dao/execution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,8 @@ func Test_extractExecIDVendorFromKey(t *testing.T) {
{"invalid format", args{"invalid:foo:bar"}, 0, "", true},
{"invalid execution id", args{"execution:id:12abc:vendor:GC:status_outdate"}, 0, "", true},
{"invalid vendor type", args{"execution:id:100:vendor:foo:status_outdate"}, 0, "", true},
{"valid", args{"execution:id:100:vendor:GARBAGE_COLLECTION:status_outdate"}, 100, "GARBAGE_COLLECTION", false},
{"valid 1", args{"execution:id:100:vendor:GARBAGE_COLLECTION:status_outdate"}, 100, "GARBAGE_COLLECTION", false},
{"valid 2", args{"execution:id:100:vendor:P2P_PREHEAT:status_outdate"}, 100, "P2P_PREHEAT", false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit 697f1c7

Please sign in to comment.