Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrpereira2 <rpereira@gitlab.com>2019-04-17 12:51:42 +0300
committersyasonik <syasonik@gitlab.com>2019-04-24 13:23:03 +0300
commitc2818d6b23543f288db3ae5464c3f3b473522836 (patch)
tree3de33b661e25ef7f4e6560d7fa26484853cb05ec /spec/fixtures
parent4a9002cee3c80a9de24f01a5eb313ff17d2e4931 (diff)
Add schema validation spec
Validate the schema of the dashboard that is loaded by Gitlab::MetricsDashboard::Service.
Diffstat (limited to 'spec/fixtures')
-rw-r--r--spec/fixtures/lib/gitlab/metrics_dashboard/schemas/dashboard.json17
-rw-r--r--spec/fixtures/lib/gitlab/metrics_dashboard/schemas/metrics.json16
-rw-r--r--spec/fixtures/lib/gitlab/metrics_dashboard/schemas/panel_groups.json17
-rw-r--r--spec/fixtures/lib/gitlab/metrics_dashboard/schemas/panels.json20
4 files changed, 70 insertions, 0 deletions
diff --git a/spec/fixtures/lib/gitlab/metrics_dashboard/schemas/dashboard.json b/spec/fixtures/lib/gitlab/metrics_dashboard/schemas/dashboard.json
new file mode 100644
index 00000000000..4d1ab8615eb
--- /dev/null
+++ b/spec/fixtures/lib/gitlab/metrics_dashboard/schemas/dashboard.json
@@ -0,0 +1,17 @@
+{
+ "type": "object",
+ "required": [
+ "dashboard",
+ "order",
+ "panel_groups"
+ ],
+ "properties": {
+ "dashboard": { "type": "string" },
+ "order": { "type": "number" },
+ "panel_groups": {
+ "type": "array",
+ "items": { "$ref": "spec/fixtures/lib/gitlab/metrics_dashboard/schemas/panel_groups.json" }
+ }
+ },
+ "additionalProperties": false
+}
diff --git a/spec/fixtures/lib/gitlab/metrics_dashboard/schemas/metrics.json b/spec/fixtures/lib/gitlab/metrics_dashboard/schemas/metrics.json
new file mode 100644
index 00000000000..4da1004dedd
--- /dev/null
+++ b/spec/fixtures/lib/gitlab/metrics_dashboard/schemas/metrics.json
@@ -0,0 +1,16 @@
+{
+ "type": "object",
+ "required": [
+ "unit",
+ "label"
+ ],
+ "properties": {
+ "id": { "type": "string" },
+ "query_range": { "type": "string" },
+ "query": { "type": "string" },
+ "unit": { "type": "string" },
+ "label": { "type": "string" },
+ "track": { "type": "string" }
+ },
+ "additionalProperties": false
+}
diff --git a/spec/fixtures/lib/gitlab/metrics_dashboard/schemas/panel_groups.json b/spec/fixtures/lib/gitlab/metrics_dashboard/schemas/panel_groups.json
new file mode 100644
index 00000000000..d7a390adcdc
--- /dev/null
+++ b/spec/fixtures/lib/gitlab/metrics_dashboard/schemas/panel_groups.json
@@ -0,0 +1,17 @@
+{
+ "type": "object",
+ "required": [
+ "group",
+ "priority",
+ "panels"
+ ],
+ "properties": {
+ "group": { "type": "string" },
+ "priority": { "type": "number" },
+ "panels": {
+ "type": "array",
+ "items": { "$ref": "panels.json" }
+ }
+ },
+ "additionalProperties": false
+}
diff --git a/spec/fixtures/lib/gitlab/metrics_dashboard/schemas/panels.json b/spec/fixtures/lib/gitlab/metrics_dashboard/schemas/panels.json
new file mode 100644
index 00000000000..1548daacd64
--- /dev/null
+++ b/spec/fixtures/lib/gitlab/metrics_dashboard/schemas/panels.json
@@ -0,0 +1,20 @@
+{
+ "type": "object",
+ "required": [
+ "title",
+ "y_label",
+ "weight",
+ "metrics"
+ ],
+ "properties": {
+ "title": { "type": "string" },
+ "type": { "type": "string" },
+ "y_label": { "type": "string" },
+ "weight": { "type": "number" },
+ "metrics": {
+ "type": "array",
+ "items": { "$ref": "metrics.json" }
+ }
+ },
+ "additionalProperties": false
+}