-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix typo, improve destination validations (#832)
* Fix typo, improve destination validations Signed-off-by: Pete Wall <pete.wall@grafana.com> * Improve linting and testing Signed-off-by: Pete Wall <pete.wall@grafana.com> * Also prevent multiple platform tests from running at the same time. Signed-off-by: Pete Wall <pete.wall@grafana.com> * Need to set something that evaluates to something, even if the matrix is empty Signed-off-by: Pete Wall <pete.wall@grafana.com> --------- Signed-off-by: Pete Wall <pete.wall@grafana.com>
- Loading branch information
Showing
14 changed files
with
151 additions
and
24 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
8 changes: 8 additions & 0 deletions
8
charts/k8s-monitoring/schema-mods/definitions/invalid-destination.schema.json
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,8 @@ | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"type": { | ||
"type": "string" | ||
} | ||
} | ||
} |
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
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
77 changes: 77 additions & 0 deletions
77
charts/k8s-monitoring/tests/destination_validations_test.yaml
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,77 @@ | ||
# yamllint disable rule:document-start rule:line-length rule:trailing-spaces | ||
suite: Test destination validations | ||
templates: | ||
- validations.yaml | ||
tests: | ||
- it: asks you to set the name of a destination | ||
set: | ||
cluster: {name: test-cluster} | ||
clusterMetrics: {enabled: true} | ||
destinations: | ||
- type: prometheus | ||
asserts: | ||
- failedTemplate: | ||
errorMessage: |- | ||
execution error at (k8s-monitoring/templates/validations.yaml:4:4): | ||
Destination #0 does not have a name. | ||
Please set: | ||
destinations: | ||
- name: my-destination-name | ||
- it: asks you to set a valid name for the destination | ||
set: | ||
cluster: {name: test-cluster} | ||
clusterMetrics: {enabled: true} | ||
destinations: | ||
- name: prøm3thüs! | ||
type: prometheus | ||
asserts: | ||
- failedTemplate: | ||
errorMessage: |- | ||
execution error at (k8s-monitoring/templates/validations.yaml:4:4): | ||
Destination #0 (prøm3thüs!) has invalid characters in its name. | ||
Please only use alphanumeric, underscores, dashes, or spaces | ||
- it: requires a destination type | ||
set: | ||
cluster: {name: test-cluster} | ||
clusterMetrics: {enabled: true} | ||
destinations: | ||
- name: a destination with no type | ||
asserts: | ||
- failedTemplate: | ||
errorMessage: |- | ||
execution error at (k8s-monitoring/templates/validations.yaml:4:4): | ||
Destination #0 (a destination with no type) does not have a type. | ||
Please set: | ||
destinations: | ||
- name: a destination with no type | ||
type: loki, otlp, prometheus, or pyroscope | ||
- it: validates the destination type | ||
set: | ||
cluster: {name: test-cluster} | ||
clusterMetrics: {enabled: true} | ||
destinations: | ||
- name: a destination with an invalid type | ||
type: invalidType | ||
asserts: | ||
- failedTemplate: | ||
errorMessage: |- | ||
execution error at (k8s-monitoring/templates/validations.yaml:4:4): | ||
Destination #0 (a destination with an invalid type) is using an unknown type (invalidType). | ||
Please set: | ||
destinations: | ||
- name: a destination with an invalid type | ||
type: "[loki, otlp, prometheus, or pyroscope]" | ||
- it: allows destination names with alphanumeric, underscores, dashes, and spaces | ||
set: | ||
cluster: {name: test-cluster} | ||
clusterMetrics: {enabled: true} | ||
alloy-metrics: {enabled: true} | ||
destinations: | ||
- name: This is my _Prometheus_ destination-1 | ||
type: prometheus | ||
asserts: | ||
- notFailedTemplate: {} |
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