mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-25 10:07:43 +01:00
fix: fix the regexp of execution status outdate key (#18481)
Signed-off-by: chlins <chenyuzh@vmware.com>
This commit is contained in:
parent
72a6ef2514
commit
697f1c79ef
@ -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
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user