fix: fix the regexp of execution status outdate key (#18481)

Signed-off-by: chlins <chenyuzh@vmware.com>
This commit is contained in:
Chlins Zhang 2023-04-05 13:53:45 +08:00 committed by GitHub
parent 72a6ef2514
commit 697f1c79ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -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

View File

@ -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) {