From 697f1c79ef42abfbaf09d670f3321423356fb225 Mon Sep 17 00:00:00 2001 From: Chlins Zhang Date: Wed, 5 Apr 2023 13:53:45 +0800 Subject: [PATCH] fix: fix the regexp of execution status outdate key (#18481) Signed-off-by: chlins --- src/pkg/task/dao/execution.go | 2 +- src/pkg/task/dao/execution_test.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pkg/task/dao/execution.go b/src/pkg/task/dao/execution.go index caadac476..b30253374 100644 --- a/src/pkg/task/dao/execution.go +++ b/src/pkg/task/dao/execution.go @@ -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 diff --git a/src/pkg/task/dao/execution_test.go b/src/pkg/task/dao/execution_test.go index 5490615f6..e826ac774 100644 --- a/src/pkg/task/dao/execution_test.go +++ b/src/pkg/task/dao/execution_test.go @@ -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) {