Skip to content

Commit

Permalink
fix sonar lint check
Browse files Browse the repository at this point in the history
Signed-off-by: xliuqq <xlzq1992@gmail.com>
  • Loading branch information
xliuqq committed May 7, 2024
1 parent 916828c commit b81ac42
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/common/label.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const (
var (
// LabelAnnotationPodSchedRegex is the fluid cache label for scheduling pod, format: 'fluid.io/dataset.{dataset name}.sched]'
// use string literal to meet security check.
LabelAnnotationPodSchedRegex = regexp.MustCompile("^fluid\\.io/dataset\\.([A-Za-z0-9.-]*)\\.sched$")
LabelAnnotationPodSchedRegex = regexp.MustCompile(`^fluid\.io/dataset\.([A-Za-z0-9.-]*)\.sched$`)
)

type OperationType string
Expand Down
6 changes: 5 additions & 1 deletion pkg/common/label_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,14 @@ func TestLabelAnnotationPodSchedRegex(t *testing.T) {
match: true,
got: "dsA",
},
"wrong": {
"wrong fluid.io": {
target: "fluidaio/dataset.dsA.sched",
match: false,
},
"wrong prefix": {
target: "a.fluid.io/dataset.dsA.sched",
match: false,
},
}

for index, item := range testCases {
Expand Down

0 comments on commit b81ac42

Please sign in to comment.