-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Starting metric server before running ingestion pipeline Fixes a bug where mutliple ingestion pipelines attempt to start the same metrics server, resulting in a panic * Validating queue label metric names Co-authored-by: Mustafa Ilyas <[email protected]>
- Loading branch information
1 parent
421dc6d
commit 7115d29
Showing
7 changed files
with
157 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package metrics | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestQueueLabelValidation(t *testing.T) { | ||
tests := map[string]struct { | ||
labelName string | ||
isValid bool | ||
}{ | ||
"Empty label name": { | ||
labelName: "", | ||
isValid: false, | ||
}, | ||
"Priority label": { | ||
labelName: "priority", | ||
isValid: true, | ||
}, | ||
"Label name with underscores": { | ||
labelName: "priority__cpu_pool", | ||
isValid: true, | ||
}, | ||
"Label name with spaces": { | ||
labelName: "priority cpu pool", | ||
isValid: false, | ||
}, | ||
"Alphanumeric label name": { | ||
labelName: "cluster_12_user", | ||
isValid: true, | ||
}, | ||
"Invalid Kubernetes-style label name 1": { | ||
labelName: "armadaproject.io/category", | ||
isValid: false, | ||
}, | ||
"Invalid Kubernetes-style label name 2": { | ||
labelName: "armadaproject.io/ttl", | ||
isValid: false, | ||
}, | ||
"Invalid Kubernetes-style label name 3": { | ||
labelName: "kubernetes.io/metadata.name", | ||
isValid: false, | ||
}, | ||
} | ||
|
||
for name, tc := range tests { | ||
t.Run(name, func(t *testing.T) { | ||
isValid := isValidMetricLabelName(tc.labelName) | ||
assert.Equal(t, tc.isValid, isValid) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters