From 190561039bec631fc26d15c8efdae56b8574a3ed Mon Sep 17 00:00:00 2001 From: Aditya Thebe Date: Tue, 24 Dec 2024 12:13:41 +0545 Subject: [PATCH] fix: update playbook schema --- Makefile | 2 +- query/config_changes.go | 29 +- query/config_relations.go | 31 +- schema/openapi/playbook-spec.schema.json | 84 +- schema/playbook-spec.schema.json | 1009 ---------------------- tests/config_changes_test.go | 6 +- 6 files changed, 122 insertions(+), 1039 deletions(-) delete mode 100644 schema/playbook-spec.schema.json diff --git a/Makefile b/Makefile index e68b43c4..7b972959 100644 --- a/Makefile +++ b/Makefile @@ -74,7 +74,7 @@ migrate-test: hack/migrate/go.mod cd hack/migrate && go run ./main.go cp-playbook-schema: - cp ../mission-control/config/schemas/playbook-spec.schema.json schema/ + cp ../mission-control/config/schemas/playbook-spec.schema.json schema/openapi/ fmt_json: ls fixtures/expectations/*.json | while read -r jf; do \ diff --git a/query/config_changes.go b/query/config_changes.go index 4da16a6c..22e6fc50 100644 --- a/query/config_changes.go +++ b/query/config_changes.go @@ -16,14 +16,16 @@ import ( "gorm.io/gorm/clause" ) +type ChangeRelationDirection string + const ( - CatalogChangeRecursiveUpstream = "upstream" - CatalogChangeRecursiveDownstream = "downstream" - CatalogChangeRecursiveNone = "none" - CatalogChangeRecursiveAll = "all" + CatalogChangeRecursiveUpstream ChangeRelationDirection = "upstream" + CatalogChangeRecursiveDownstream ChangeRelationDirection = "downstream" + CatalogChangeRecursiveNone ChangeRelationDirection = "none" + CatalogChangeRecursiveAll ChangeRelationDirection = "all" ) -var allRecursiveOptions = []string{CatalogChangeRecursiveUpstream, CatalogChangeRecursiveDownstream, CatalogChangeRecursiveNone, CatalogChangeRecursiveAll} +var allRecursiveOptions = []ChangeRelationDirection{CatalogChangeRecursiveUpstream, CatalogChangeRecursiveDownstream, CatalogChangeRecursiveNone, CatalogChangeRecursiveAll} var allowedConfigChangesSortColumns = []string{"name", "change_type", "summary", "source", "created_at", "count"} @@ -57,7 +59,8 @@ type CatalogChangesSearchRequest struct { sortOrder string // upstream | downstream | both - Recursive string `query:"recursive" json:"recursive"` + Recursive ChangeRelationDirection `query:"recursive" json:"recursive"` + // FIXME: Soft toggle does not work with Recursive=both // In that case, soft relations are always returned // It also returns ALL soft relations throughout the tree @@ -141,7 +144,7 @@ func (t *CatalogChangesSearchRequest) SetDefaults() { t.Recursive = CatalogChangeRecursiveDownstream } - if t.Depth <= 0 { + if t.Depth == 0 { t.Depth = 5 } @@ -152,7 +155,7 @@ func (t *CatalogChangesSearchRequest) SetDefaults() { func (t *CatalogChangesSearchRequest) Validate() error { if !lo.Contains(allRecursiveOptions, t.Recursive) { - return fmt.Errorf("'recursive' must be one of %s", strings.Join(allRecursiveOptions, ", ")) + return fmt.Errorf("'recursive' must be one of %v", allRecursiveOptions) } if t.From != "" { @@ -298,7 +301,7 @@ func FindCatalogChanges(ctx context.Context, req CatalogChangesSearchRequest) (* if req.Severity != "" { clause, err := parseAndBuildFilteringQuery(formSeverityQuery(req.Severity), "severity", false) if err != nil { - return nil, api.Errorf(api.EINVALID, fmt.Sprintf("failed to parse severity: %v", err)) + return nil, api.Errorf(api.EINVALID, "failed to parse severity: %v", err) } clauses = append(clauses, clause...) } @@ -306,7 +309,7 @@ func FindCatalogChanges(ctx context.Context, req CatalogChangesSearchRequest) (* if req.Summary != "" { clause, err := parseAndBuildFilteringQuery(req.Summary, "summary", true) if err != nil { - return nil, api.Errorf(api.EINVALID, fmt.Sprintf("failed to parse summary: %v", err)) + return nil, api.Errorf(api.EINVALID, "failed to parse summary: %v", err) } clauses = append(clauses, clause...) } @@ -314,7 +317,7 @@ func FindCatalogChanges(ctx context.Context, req CatalogChangesSearchRequest) (* if req.Source != "" { clause, err := parseAndBuildFilteringQuery(req.Source, "source", true) if err != nil { - return nil, api.Errorf(api.EINVALID, fmt.Sprintf("failed to parse source: %v", err)) + return nil, api.Errorf(api.EINVALID, "failed to parse source: %v", err) } clauses = append(clauses, clause...) } @@ -322,7 +325,7 @@ func FindCatalogChanges(ctx context.Context, req CatalogChangesSearchRequest) (* if req.Tags != "" { parsedLabelSelector, err := labels.Parse(req.Tags) if err != nil { - return nil, api.Errorf(api.EINVALID, fmt.Sprintf("failed to parse label selector: %v", err)) + return nil, api.Errorf(api.EINVALID, "failed to parse label selector: %v", err) } requirements, _ := parsedLabelSelector.Requirements() for _, r := range requirements { @@ -345,7 +348,7 @@ func FindCatalogChanges(ctx context.Context, req CatalogChangesSearchRequest) (* if req.externalCreatedBy != "" { clause, err := parseAndBuildFilteringQuery(req.externalCreatedBy, "external_created_by", true) if err != nil { - return nil, api.Errorf(api.EINVALID, fmt.Sprintf("failed to parse external createdby: %v", err)) + return nil, api.Errorf(api.EINVALID, "failed to parse external createdby: %v", err) } clauses = append(clauses, clause...) } diff --git a/query/config_relations.go b/query/config_relations.go index cddc8182..8d3c7355 100644 --- a/query/config_relations.go +++ b/query/config_relations.go @@ -34,9 +34,6 @@ type RelatedConfig struct { Path string `json:"path"` } -type RelationType string -type RelationDirection string - type RelationQuery struct { ID uuid.UUID Relation RelationDirection @@ -46,13 +43,33 @@ type RelationQuery struct { MaxDepth *int } +type RelationDirection string + const ( + All RelationDirection = "all" Incoming RelationDirection = "incoming" Outgoing RelationDirection = "outgoing" - Both RelationType = "both" - Hard RelationType = "hard" - Soft RelationType = "soft" - All RelationDirection = "all" +) + +func (t RelationDirection) ToChangeDirection() ChangeRelationDirection { + switch t { + case All: + return CatalogChangeRecursiveAll + case Incoming: + return CatalogChangeRecursiveUpstream + case Outgoing: + return CatalogChangeRecursiveDownstream + } + + return CatalogChangeRecursiveNone +} + +type RelationType string + +const ( + Both RelationType = "both" + Hard RelationType = "hard" + Soft RelationType = "soft" ) func GetRelatedConfigs(ctx context.Context, query RelationQuery) ([]RelatedConfig, error) { diff --git a/schema/openapi/playbook-spec.schema.json b/schema/openapi/playbook-spec.schema.json index 6aa24b9c..eb7f7ed7 100644 --- a/schema/openapi/playbook-spec.schema.json +++ b/schema/openapi/playbook-spec.schema.json @@ -3,6 +3,63 @@ "$id": "https://github.com/flanksource/incident-commander/api/v1/playbook-spec", "$ref": "#/$defs/PlaybookSpec", "$defs": { + "AIAction": { + "properties": { + "apiKey": { + "$ref": "#/$defs/EnvVar" + }, + "backend": { + "type": "string" + }, + "model": { + "type": "string" + }, + "apiURL": { + "type": "string" + }, + "config": { + "type": "string" + }, + "changes": { + "$ref": "#/$defs/TimeMetadata" + }, + "analysis": { + "$ref": "#/$defs/TimeMetadata" + }, + "relationships": { + "items": { + "$ref": "#/$defs/AIActionRelationship" + }, + "type": "array" + }, + "prompt": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "prompt" + ] + }, + "AIActionRelationship": { + "properties": { + "depth": { + "type": "integer" + }, + "direction": { + "type": "string" + }, + "changes": { + "$ref": "#/$defs/TimeMetadata" + }, + "analysis": { + "$ref": "#/$defs/TimeMetadata" + } + }, + "additionalProperties": false, + "type": "object" + }, "AWSConnection": { "properties": { "connection": { @@ -582,6 +639,9 @@ "templatesOn": { "type": "string" }, + "ai": { + "$ref": "#/$defs/AIAction" + }, "exec": { "$ref": "#/$defs/ExecAction" }, @@ -943,12 +1003,6 @@ "namespace": { "type": "string" }, - "types": { - "$ref": "#/$defs/Items" - }, - "statuses": { - "$ref": "#/$defs/Items" - }, "tagSelector": { "type": "string" }, @@ -957,6 +1011,12 @@ }, "fieldSelector": { "type": "string" + }, + "types": { + "$ref": "#/$defs/Items" + }, + "statuses": { + "$ref": "#/$defs/Items" } }, "additionalProperties": false, @@ -1004,6 +1064,18 @@ "required": [ "key" ] + }, + "TimeMetadata": { + "properties": { + "since": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "since" + ] } } } \ No newline at end of file diff --git a/schema/playbook-spec.schema.json b/schema/playbook-spec.schema.json deleted file mode 100644 index e73bb275..00000000 --- a/schema/playbook-spec.schema.json +++ /dev/null @@ -1,1009 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/flanksource/incident-commander/api/v1/playbook-spec", - "$ref": "#/$defs/PlaybookSpec", - "$defs": { - "AWSConnection": { - "properties": { - "connection": { - "type": "string" - }, - "accessKey": { - "$ref": "#/$defs/EnvVar" - }, - "secretKey": { - "$ref": "#/$defs/EnvVar" - }, - "sessionToken": { - "$ref": "#/$defs/EnvVar" - }, - "assumeRole": { - "type": "string" - }, - "region": { - "type": "string" - }, - "endpoint": { - "type": "string" - }, - "skipTLSVerify": { - "type": "boolean" - } - }, - "additionalProperties": false, - "type": "object" - }, - "Artifact": { - "properties": { - "path": { - "type": "string" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "path" - ] - }, - "AzureConnection": { - "properties": { - "connection": { - "type": "string" - }, - "clientID": { - "$ref": "#/$defs/EnvVar" - }, - "clientSecret": { - "$ref": "#/$defs/EnvVar" - }, - "tenantID": { - "type": "string" - } - }, - "additionalProperties": false, - "type": "object" - }, - "AzureDevopsPipeline": { - "properties": { - "id": { - "type": "string" - }, - "version": { - "type": "string" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "id" - ] - }, - "AzureDevopsPipelineAction": { - "properties": { - "org": { - "type": "string" - }, - "project": { - "type": "string" - }, - "token": { - "$ref": "#/$defs/EnvVar" - }, - "pipeline": { - "$ref": "#/$defs/AzureDevopsPipeline" - }, - "parameters": { - "$ref": "#/$defs/AzureDevopsPipelineParameters" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "org", - "project", - "token", - "pipeline" - ] - }, - "AzureDevopsPipelineParameters": { - "properties": { - "resources": true, - "templateParameters": true, - "variables": true, - "stagesToSkip": { - "items": { - "type": "string" - }, - "type": "array" - } - }, - "additionalProperties": false, - "type": "object" - }, - "ConfigMapKeySelector": { - "properties": { - "name": { - "type": "string" - }, - "key": { - "type": "string" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "key" - ] - }, - "EnvVar": { - "properties": { - "name": { - "type": "string" - }, - "value": { - "type": "string" - }, - "valueFrom": { - "$ref": "#/$defs/EnvVarSource" - } - }, - "additionalProperties": false, - "type": "object" - }, - "EnvVarSource": { - "properties": { - "serviceAccount": { - "type": "string" - }, - "helmRef": { - "$ref": "#/$defs/HelmRefKeySelector" - }, - "configMapKeyRef": { - "$ref": "#/$defs/ConfigMapKeySelector" - }, - "secretKeyRef": { - "$ref": "#/$defs/SecretKeySelector" - } - }, - "additionalProperties": false, - "type": "object" - }, - "ExecAction": { - "properties": { - "script": { - "type": "string" - }, - "connections": { - "$ref": "#/$defs/ExecConnections" - }, - "artifacts": { - "items": { - "$ref": "#/$defs/Artifact" - }, - "type": "array" - }, - "env": { - "items": { - "$ref": "#/$defs/EnvVar" - }, - "type": "array" - }, - "checkout": { - "$ref": "#/$defs/GitCheckout" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "script" - ] - }, - "ExecConnections": { - "properties": { - "fromConfigItem": { - "type": "string" - }, - "kubernetes": { - "$ref": "#/$defs/KubernetesConnection" - }, - "aws": { - "$ref": "#/$defs/AWSConnection" - }, - "gcp": { - "$ref": "#/$defs/GCPConnection" - }, - "azure": { - "$ref": "#/$defs/AzureConnection" - } - }, - "additionalProperties": false, - "type": "object" - }, - "GCPConnection": { - "properties": { - "connection": { - "type": "string" - }, - "endpoint": { - "type": "string" - }, - "credentials": { - "$ref": "#/$defs/EnvVar" - }, - "skipTLSVerify": { - "type": "boolean" - } - }, - "additionalProperties": false, - "type": "object" - }, - "GitCheckout": { - "properties": { - "url": { - "type": "string" - }, - "connection": { - "type": "string" - }, - "username": { - "$ref": "#/$defs/EnvVar" - }, - "password": { - "$ref": "#/$defs/EnvVar" - }, - "certificate": { - "$ref": "#/$defs/EnvVar" - }, - "destination": { - "type": "string" - } - }, - "additionalProperties": false, - "type": "object" - }, - "GitOpsAction": { - "properties": { - "repo": { - "$ref": "#/$defs/GitOpsActionRepo" - }, - "commit": { - "$ref": "#/$defs/GitOpsActionCommit" - }, - "pr": { - "$ref": "#/$defs/GitOpsActionPR" - }, - "patches": { - "items": { - "$ref": "#/$defs/GitOpsActionPatch" - }, - "type": "array" - }, - "files": { - "items": { - "$ref": "#/$defs/GitOpsActionFile" - }, - "type": "array" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "repo", - "commit" - ] - }, - "GitOpsActionCommit": { - "properties": { - "author": { - "type": "string" - }, - "email": { - "type": "string" - }, - "message": { - "type": "string" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "author", - "email", - "message" - ] - }, - "GitOpsActionFile": { - "properties": { - "path": { - "type": "string" - }, - "content": { - "type": "string" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "path", - "content" - ] - }, - "GitOpsActionPR": { - "properties": { - "title": { - "type": "string" - }, - "tags": { - "items": { - "type": "string" - }, - "type": "array" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "title" - ] - }, - "GitOpsActionPatch": { - "properties": { - "path": { - "type": "string" - }, - "yq": { - "type": "string" - }, - "jq": { - "type": "string" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "path" - ] - }, - "GitOpsActionRepo": { - "properties": { - "url": { - "type": "string" - }, - "username": { - "$ref": "#/$defs/EnvVar" - }, - "password": { - "$ref": "#/$defs/EnvVar" - }, - "base": { - "type": "string" - }, - "branch": { - "type": "string" - }, - "skipExisting": { - "type": "boolean" - }, - "force": { - "type": "boolean" - }, - "connection": { - "type": "string" - }, - "type": { - "type": "string" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "url" - ] - }, - "GithubAction": { - "properties": { - "repo": { - "type": "string" - }, - "username": { - "type": "string" - }, - "token": { - "$ref": "#/$defs/EnvVar" - }, - "workflows": { - "items": { - "$ref": "#/$defs/GithubWorkflow" - }, - "type": "array" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "repo", - "username", - "token" - ] - }, - "GithubWorkflow": { - "properties": { - "id": { - "type": "string" - }, - "ref": { - "type": "string" - }, - "input": { - "type": "string" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "id" - ] - }, - "HTTPAction": { - "properties": { - "connection": { - "type": "string" - }, - "url": { - "type": "string" - }, - "username": { - "$ref": "#/$defs/EnvVar" - }, - "password": { - "$ref": "#/$defs/EnvVar" - }, - "method": { - "type": "string" - }, - "ntlm": { - "type": "boolean" - }, - "ntlmv2": { - "type": "boolean" - }, - "headers": { - "items": { - "$ref": "#/$defs/EnvVar" - }, - "type": "array" - }, - "body": { - "type": "string" - }, - "templateBody": { - "type": "boolean" - } - }, - "additionalProperties": false, - "type": "object" - }, - "HelmRefKeySelector": { - "properties": { - "name": { - "type": "string" - }, - "key": { - "type": "string" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "key" - ] - }, - "Items": { - "items": { - "type": "string" - }, - "type": "array" - }, - "KubernetesConnection": { - "properties": { - "connection": { - "type": "string" - }, - "kubeconfig": { - "$ref": "#/$defs/EnvVar" - } - }, - "additionalProperties": false, - "type": "object" - }, - "NotificationAction": { - "properties": { - "url": { - "type": "string" - }, - "connection": { - "type": "string" - }, - "title": { - "type": "string" - }, - "message": { - "type": "string" - }, - "properties": { - "additionalProperties": { - "type": "string" - }, - "type": "object" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "title", - "message" - ] - }, - "Permission": { - "properties": { - "role": { - "type": "string" - }, - "team": { - "type": "string" - }, - "ref": { - "type": "string" - } - }, - "additionalProperties": false, - "type": "object" - }, - "PlaybookAction": { - "properties": { - "name": { - "type": "string" - }, - "delay": { - "type": "string" - }, - "timeout": { - "type": "string" - }, - "if": { - "type": "string" - }, - "runsOn": { - "items": { - "type": "string" - }, - "type": "array" - }, - "templatesOn": { - "type": "string" - }, - "exec": { - "$ref": "#/$defs/ExecAction" - }, - "gitops": { - "$ref": "#/$defs/GitOpsAction" - }, - "github": { - "$ref": "#/$defs/GithubAction" - }, - "azureDevopsPipeline": { - "$ref": "#/$defs/AzureDevopsPipelineAction" - }, - "http": { - "$ref": "#/$defs/HTTPAction" - }, - "sql": { - "$ref": "#/$defs/SQLAction" - }, - "pod": { - "$ref": "#/$defs/PodAction" - }, - "notification": { - "$ref": "#/$defs/NotificationAction" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "name" - ] - }, - "PlaybookApproval": { - "properties": { - "type": { - "type": "string" - }, - "approvers": { - "$ref": "#/$defs/PlaybookApprovers" - } - }, - "additionalProperties": false, - "type": "object" - }, - "PlaybookApprovers": { - "properties": { - "people": { - "items": { - "type": "string" - }, - "type": "array" - }, - "teams": { - "items": { - "type": "string" - }, - "type": "array" - } - }, - "additionalProperties": false, - "type": "object" - }, - "PlaybookEventWebhookAuth": { - "properties": { - "basic": { - "$ref": "#/$defs/PlaybookEventWebhookAuthBasic" - }, - "github": { - "$ref": "#/$defs/PlaybookEventWebhookAuthGithub" - }, - "svix": { - "$ref": "#/$defs/PlaybookEventWebhookAuthSVIX" - }, - "jwt": { - "$ref": "#/$defs/PlaybookEventWebhookAuthJWT" - } - }, - "additionalProperties": false, - "type": "object" - }, - "PlaybookEventWebhookAuthBasic": { - "properties": { - "username": { - "$ref": "#/$defs/EnvVar" - }, - "password": { - "$ref": "#/$defs/EnvVar" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "username", - "password" - ] - }, - "PlaybookEventWebhookAuthGithub": { - "properties": { - "token": { - "$ref": "#/$defs/EnvVar" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "token" - ] - }, - "PlaybookEventWebhookAuthJWT": { - "properties": { - "jwksUri": { - "type": "string" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "jwksUri" - ] - }, - "PlaybookEventWebhookAuthSVIX": { - "properties": { - "secret": { - "$ref": "#/$defs/EnvVar" - }, - "verifyTimestamp": { - "type": "string" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "secret" - ] - }, - "PlaybookParameter": { - "properties": { - "name": { - "type": "string" - }, - "default": { - "type": "string" - }, - "label": { - "type": "string" - }, - "required": { - "type": "boolean" - }, - "icon": { - "type": "string" - }, - "description": { - "type": "string" - }, - "type": { - "type": "string" - }, - "properties": true, - "dependsOn": { - "items": { - "type": "string" - }, - "type": "array" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "name" - ] - }, - "PlaybookSpec": { - "properties": { - "title": { - "type": "string" - }, - "description": { - "type": "string" - }, - "category": { - "type": "string" - }, - "icon": { - "type": "string" - }, - "on": { - "$ref": "#/$defs/PlaybookTrigger" - }, - "runsOn": { - "items": { - "type": "string" - }, - "type": "array" - }, - "env": { - "items": { - "$ref": "#/$defs/EnvVar" - }, - "type": "array" - }, - "templatesOn": { - "type": "string" - }, - "permissions": { - "items": { - "$ref": "#/$defs/Permission" - }, - "type": "array" - }, - "configs": { - "$ref": "#/$defs/ResourceSelectors" - }, - "checks": { - "$ref": "#/$defs/ResourceSelectors" - }, - "components": { - "$ref": "#/$defs/ResourceSelectors" - }, - "parameters": { - "items": { - "$ref": "#/$defs/PlaybookParameter" - }, - "type": "array" - }, - "actions": { - "items": { - "$ref": "#/$defs/PlaybookAction" - }, - "type": "array" - }, - "filters": { - "items": { - "type": "string" - }, - "type": "array" - }, - "approval": { - "$ref": "#/$defs/PlaybookApproval" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "actions" - ] - }, - "PlaybookTrigger": { - "properties": { - "canary": { - "items": { - "$ref": "#/$defs/PlaybookTriggerEvent" - }, - "type": "array" - }, - "config": { - "items": { - "$ref": "#/$defs/PlaybookTriggerEvent" - }, - "type": "array" - }, - "component": { - "items": { - "$ref": "#/$defs/PlaybookTriggerEvent" - }, - "type": "array" - }, - "webhook": { - "$ref": "#/$defs/PlaybookTriggerWebhook" - } - }, - "additionalProperties": false, - "type": "object" - }, - "PlaybookTriggerEvent": { - "properties": { - "event": { - "type": "string" - }, - "labels": { - "additionalProperties": { - "type": "string" - }, - "type": "object" - }, - "filter": { - "type": "string" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "event" - ] - }, - "PlaybookTriggerWebhook": { - "properties": { - "path": { - "type": "string" - }, - "authentication": { - "$ref": "#/$defs/PlaybookEventWebhookAuth" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "path" - ] - }, - "PodAction": { - "properties": { - "name": { - "type": "string" - }, - "maxLength": { - "type": "integer" - }, - "spec": true, - "artifacts": { - "items": { - "$ref": "#/$defs/Artifact" - }, - "type": "array" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "name", - "spec" - ] - }, - "ResourceSelector": { - "properties": { - "agent": { - "type": "string" - }, - "scope": { - "type": "string" - }, - "cache": { - "type": "string" - }, - "search": { - "type": "string" - }, - "limit": { - "type": "integer" - }, - "includeDeleted": { - "type": "boolean" - }, - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "tagSelector": { - "type": "string" - }, - "labelSelector": { - "type": "string" - }, - "fieldSelector": { - "type": "string" - }, - "types": { - "$ref": "#/$defs/Items" - }, - "statuses": { - "$ref": "#/$defs/Items" - } - }, - "additionalProperties": false, - "type": "object" - }, - "ResourceSelectors": { - "items": { - "$ref": "#/$defs/ResourceSelector" - }, - "type": "array" - }, - "SQLAction": { - "properties": { - "connection": { - "type": "string" - }, - "url": { - "type": "string" - }, - "query": { - "type": "string" - }, - "driver": { - "type": "string" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "query", - "driver" - ] - }, - "SecretKeySelector": { - "properties": { - "name": { - "type": "string" - }, - "key": { - "type": "string" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "key" - ] - } - } -} \ No newline at end of file diff --git a/tests/config_changes_test.go b/tests/config_changes_test.go index 7bcb9e2c..1c7bd791 100644 --- a/tests/config_changes_test.go +++ b/tests/config_changes_test.go @@ -110,7 +110,7 @@ var _ = ginkgo.Describe("Config changes recursive", ginkgo.Ordered, func() { Expect(err).To(BeNil()) }) - var findChanges = func(id uuid.UUID, filter string, deleted bool) (*query.CatalogChangesSearchResponse, error) { + var findChanges = func(id uuid.UUID, filter query.ChangeRelationDirection, deleted bool) (*query.CatalogChangesSearchResponse, error) { return query.FindCatalogChanges(DefaultContext, query.CatalogChangesSearchRequest{ CatalogID: id.String(), IncludeDeletedConfigs: deleted, @@ -371,7 +371,7 @@ var _ = ginkgo.Describe("Config changes recursive", ginkgo.Ordered, func() { Expect(response.Summary[WChange.ChangeType]).To(Equal(1)) }) - ginkgo.It(query.CatalogChangeRecursiveDownstream, func() { + ginkgo.It(string(query.CatalogChangeRecursiveDownstream), func() { response, err := query.FindCatalogChanges(DefaultContext, query.CatalogChangesSearchRequest{ CatalogID: V.ID.String(), Recursive: query.CatalogChangeRecursiveDownstream, @@ -383,7 +383,7 @@ var _ = ginkgo.Describe("Config changes recursive", ginkgo.Ordered, func() { Expect(response.Summary["Pulled"]).To(Equal(1)) }) - ginkgo.It(query.CatalogChangeRecursiveAll, func() { + ginkgo.It(string(query.CatalogChangeRecursiveAll), func() { response, err := query.FindCatalogChanges(DefaultContext, query.CatalogChangesSearchRequest{ CatalogID: V.ID.String(), Recursive: query.CatalogChangeRecursiveAll,