From 2a61453f6d82e51e691312ec9f25396ba4e78ade Mon Sep 17 00:00:00 2001 From: Petr Hosek Date: Fri, 14 Feb 2025 13:45:57 +0100 Subject: [PATCH] feat: add test fixture for template creation with exact inputs and configurations --- .../create-test-exactlyOne/args | 1 + .../create-test-exactlyOne/env | 2 + .../create-test-exactlyOne/expected-code | 1 + .../create-test-exactlyOne/expected-stderr | 0 .../create-test-exactlyOne/expected-stdout | 6 ++ .../in/.keboola/repository.json | 26 ++++++ .../create-test-exactlyOne/in/inputs.json | 6 ++ .../in/my-template/v0/src/README.md | 4 + .../in/my-template/v0/src/description.md | 10 +++ .../ex-generic-v2/empty/config.jsonnet | 7 ++ .../ex-generic-v2/empty/description.md | 1 + .../ex-generic-v2/empty/meta.jsonnet | 3 + .../with-rows/config.jsonnet | 8 ++ .../with-rows/description.md | 1 + .../with-rows/meta.jsonnet | 3 + .../with-rows/rows/users/config.jsonnet | 5 ++ .../with-rows/rows/users/description.md | 1 + .../with-rows/rows/users/meta.jsonnet | 4 + .../in/my-template/v0/src/inputs.jsonnet | 69 ++++++++++++++++ .../in/my-template/v0/src/manifest.jsonnet | 21 +++++ .../create-test-exactlyOne/in/projects.json | 9 +++ .../create-test-exactlyOne/initial-state.json | 11 +++ .../out/.keboola/repository.json | 26 ++++++ .../create-test-exactlyOne/out/inputs.json | 6 ++ .../out/my-template/v0/src/README.md | 4 + .../out/my-template/v0/src/description.md | 10 +++ .../ex-generic-v2/empty/config.jsonnet | 7 ++ .../ex-generic-v2/empty/description.md | 1 + .../ex-generic-v2/empty/meta.jsonnet | 3 + .../with-rows/config.jsonnet | 8 ++ .../with-rows/description.md | 1 + .../with-rows/meta.jsonnet | 3 + .../with-rows/rows/users/config.jsonnet | 5 ++ .../with-rows/rows/users/description.md | 1 + .../with-rows/rows/users/meta.jsonnet | 4 + .../out/my-template/v0/src/inputs.jsonnet | 69 ++++++++++++++++ .../out/my-template/v0/src/manifest.jsonnet | 21 +++++ .../one/expected-out/.keboola/manifest.json | 80 +++++++++++++++++++ .../v0/tests/one/expected-out/description.md | 1 + .../one/expected-out/main/description.md | 0 .../ex-generic-v2/empty-instance/config.json | 7 ++ .../empty-instance/description.md | 1 + .../ex-generic-v2/empty-instance/meta.json | 4 + .../keboola.ex-db-mysql/with-rows/config.json | 8 ++ .../with-rows/description.md | 1 + .../keboola.ex-db-mysql/with-rows/meta.json | 4 + .../with-rows/rows/users/config.json | 5 ++ .../with-rows/rows/users/description.md | 1 + .../with-rows/rows/users/meta.json | 4 + .../v0/tests/one/expected-out/main/meta.json | 4 + .../out/my-template/v0/tests/one/inputs.json | 6 ++ .../create-test-exactlyOne/out/projects.json | 9 +++ 52 files changed, 503 insertions(+) create mode 100644 test/cli/template-test-create/create-test-exactlyOne/args create mode 100644 test/cli/template-test-create/create-test-exactlyOne/env create mode 100644 test/cli/template-test-create/create-test-exactlyOne/expected-code create mode 100644 test/cli/template-test-create/create-test-exactlyOne/expected-stderr create mode 100644 test/cli/template-test-create/create-test-exactlyOne/expected-stdout create mode 100644 test/cli/template-test-create/create-test-exactlyOne/in/.keboola/repository.json create mode 100644 test/cli/template-test-create/create-test-exactlyOne/in/inputs.json create mode 100644 test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/README.md create mode 100644 test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/description.md create mode 100644 test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/ex-generic-v2/empty/config.jsonnet create mode 100644 test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/ex-generic-v2/empty/description.md create mode 100644 test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/ex-generic-v2/empty/meta.jsonnet create mode 100644 test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/config.jsonnet create mode 100644 test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/description.md create mode 100644 test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/meta.jsonnet create mode 100644 test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/rows/users/config.jsonnet create mode 100644 test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/rows/users/description.md create mode 100644 test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/rows/users/meta.jsonnet create mode 100644 test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/inputs.jsonnet create mode 100644 test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/manifest.jsonnet create mode 100644 test/cli/template-test-create/create-test-exactlyOne/in/projects.json create mode 100644 test/cli/template-test-create/create-test-exactlyOne/initial-state.json create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/.keboola/repository.json create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/inputs.json create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/README.md create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/description.md create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/ex-generic-v2/empty/config.jsonnet create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/ex-generic-v2/empty/description.md create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/ex-generic-v2/empty/meta.jsonnet create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/config.jsonnet create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/description.md create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/meta.jsonnet create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/rows/users/config.jsonnet create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/rows/users/description.md create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/rows/users/meta.jsonnet create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/inputs.jsonnet create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/manifest.jsonnet create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/.keboola/manifest.json create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/description.md create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/description.md create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/ex-generic-v2/empty-instance/config.json create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/ex-generic-v2/empty-instance/description.md create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/ex-generic-v2/empty-instance/meta.json create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/keboola.ex-db-mysql/with-rows/config.json create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/keboola.ex-db-mysql/with-rows/description.md create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/keboola.ex-db-mysql/with-rows/meta.json create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/keboola.ex-db-mysql/with-rows/rows/users/config.json create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/keboola.ex-db-mysql/with-rows/rows/users/description.md create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/keboola.ex-db-mysql/with-rows/rows/users/meta.json create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/meta.json create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/inputs.json create mode 100644 test/cli/template-test-create/create-test-exactlyOne/out/projects.json diff --git a/test/cli/template-test-create/create-test-exactlyOne/args b/test/cli/template-test-create/create-test-exactlyOne/args new file mode 100644 index 0000000000..964c7062d7 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/args @@ -0,0 +1 @@ +template test create my-template 0.0.1 --test-name one --inputs-file ./inputs.json --test-projects-file ./projects.json diff --git a/test/cli/template-test-create/create-test-exactlyOne/env b/test/cli/template-test-create/create-test-exactlyOne/env new file mode 100644 index 0000000000..78f851b025 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/env @@ -0,0 +1,2 @@ +TEST_KBC_PROJECTS_LOCK_DIR_NAME=.kac-cli-e2e-test-template-test + diff --git a/test/cli/template-test-create/create-test-exactlyOne/expected-code b/test/cli/template-test-create/create-test-exactlyOne/expected-code new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/expected-code @@ -0,0 +1 @@ +0 diff --git a/test/cli/template-test-create/create-test-exactlyOne/expected-stderr b/test/cli/template-test-create/create-test-exactlyOne/expected-stderr new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/cli/template-test-create/create-test-exactlyOne/expected-stdout b/test/cli/template-test-create/create-test-exactlyOne/expected-stdout new file mode 100644 index 0000000000..d4e439e589 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/expected-stdout @@ -0,0 +1,6 @@ +Objects from "keboola/my-template/0.0.1" template: + + C main/extractor/ex-generic-v2/empty-instance + + C main/extractor/keboola.ex-db-mysql/with-rows + + R main/extractor/keboola.ex-db-mysql/with-rows/rows/users +Template "keboola/my-template/0.0.1" has been applied, instance ID: %s +The test was created in folder tests/two. diff --git a/test/cli/template-test-create/create-test-exactlyOne/in/.keboola/repository.json b/test/cli/template-test-create/create-test-exactlyOne/in/.keboola/repository.json new file mode 100644 index 0000000000..de933ab3d5 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/in/.keboola/repository.json @@ -0,0 +1,26 @@ +{ + "version": 2, + "author": { + "name": "Example Author", + "url": "https://example.com" + }, + "templates": [ + { + "id": "my-template", + "name": "My Template", + "description": "Full workflow to ...", + "path": "my-template", + "versions": [ + { + "version": "0.0.1", + "description": "notes", + "stable": false, + "components": [ + "keboola.ex-facebook" + ], + "path": "v0" + } + ] + } + ] +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/in/inputs.json b/test/cli/template-test-create/create-test-exactlyOne/in/inputs.json new file mode 100644 index 0000000000..3f46b27294 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/in/inputs.json @@ -0,0 +1,6 @@ +{ + "ex-db-mysql-db-host": "host", + "ex-db-mysql-db-password": "##KBC_SECRET_PASSWORD##", + "ex-db-mysql-incremental": false, + "ex-generic-v2-api-base-url": "https://jsonplaceholder.typicode.com" +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/README.md b/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/README.md new file mode 100644 index 0000000000..47579b4667 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/README.md @@ -0,0 +1,4 @@ +### My Template + +Full workflow to ... + diff --git a/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/description.md b/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/description.md new file mode 100644 index 0000000000..dd8107f80f --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/description.md @@ -0,0 +1,10 @@ +# My Template + +## Extended description +- of a template for demo purposes +- from the examples in the API documentation + +## Some Example +``` + with.a.code() +``` diff --git a/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/ex-generic-v2/empty/config.jsonnet b/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/ex-generic-v2/empty/config.jsonnet new file mode 100644 index 0000000000..adff0db28d --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/ex-generic-v2/empty/config.jsonnet @@ -0,0 +1,7 @@ +{ + parameters: { + api: { + baseUrl: Input("ex-generic-v2-api-base-url"), + }, + }, +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/ex-generic-v2/empty/description.md b/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/ex-generic-v2/empty/description.md new file mode 100644 index 0000000000..28f6091c29 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/ex-generic-v2/empty/description.md @@ -0,0 +1 @@ +test fixture diff --git a/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/ex-generic-v2/empty/meta.jsonnet b/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/ex-generic-v2/empty/meta.jsonnet new file mode 100644 index 0000000000..ba845873d1 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/ex-generic-v2/empty/meta.jsonnet @@ -0,0 +1,3 @@ +{ + name: "empty " + InstanceIdShort(), +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/config.jsonnet b/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/config.jsonnet new file mode 100644 index 0000000000..cc407120fa --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/config.jsonnet @@ -0,0 +1,8 @@ +{ + parameters: { + db: { + host: Input("ex-db-mysql-db-host"), + "#password": Input("ex-db-mysql-db-password"), + }, + }, +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/description.md b/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/description.md new file mode 100644 index 0000000000..28f6091c29 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/description.md @@ -0,0 +1 @@ +test fixture diff --git a/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/meta.jsonnet b/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/meta.jsonnet new file mode 100644 index 0000000000..31d36dc2d4 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/meta.jsonnet @@ -0,0 +1,3 @@ +{ + name: "with-rows", +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/rows/users/config.jsonnet b/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/rows/users/config.jsonnet new file mode 100644 index 0000000000..a999413eb1 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/rows/users/config.jsonnet @@ -0,0 +1,5 @@ +{ + parameters: { + incremental: Input("ex-db-mysql-incremental"), + }, +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/rows/users/description.md b/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/rows/users/description.md new file mode 100644 index 0000000000..28f6091c29 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/rows/users/description.md @@ -0,0 +1 @@ +test fixture diff --git a/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/rows/users/meta.jsonnet b/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/rows/users/meta.jsonnet new file mode 100644 index 0000000000..f110914cf0 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/rows/users/meta.jsonnet @@ -0,0 +1,4 @@ +{ + name: "users", + isDisabled: false, +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/inputs.jsonnet b/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/inputs.jsonnet new file mode 100644 index 0000000000..53bb10fadf --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/inputs.jsonnet @@ -0,0 +1,69 @@ +{ + stepsGroups: [ + { + description: "Default Group", + required: "exactlyOne", + steps: [ + { + icon: "common:settings", + name: "Default Step 1", + description: "Default Step 1", + inputs: [ + { + id: "ex-generic-v2-api-base-url", + name: "Api BaseUrl", + description: "a", + type: "string", + kind: "input", + default: "https://jsonplaceholder.typicode.com", + }, + ], + }, + { + icon: "common:settings", + name: "Default Step 2", + description: "Default Step 2", + inputs: [ + { + id: "ex-db-mysql-db-host", + name: "Db Host", + description: "b", + type: "string", + kind: "input", + default: "mysql.example.com", + }, + ], + }, + { + icon: "common:settings", + name: "Default Step 3", + description: "Default Step 3", + inputs: [ + { + id: "ex-db-mysql-incremental", + name: "Incremental", + description: "c", + type: "bool", + kind: "confirm", + default: false, + }, + ], + }, + { + icon: "common:settings", + name: "Default Step 4", + description: "Default Step 4", + inputs: [ + { + id: "ex-db-mysql-db-password", + name: "Db Pass", + description: "b", + type: "string", + kind: "hidden", + }, + ], + }, + ], + }, + ], +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/manifest.jsonnet b/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/manifest.jsonnet new file mode 100644 index 0000000000..4fea74ed8e --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/in/my-template/v0/src/manifest.jsonnet @@ -0,0 +1,21 @@ +{ + configurations: [ + { + componentId: "ex-generic-v2", + id: ConfigId("empty"), + path: "extractor/ex-generic-v2/empty", + rows: [], + }, + { + componentId: "keboola.ex-db-mysql", + id: ConfigId("with-rows"), + path: "extractor/keboola.ex-db-mysql/with-rows", + rows: [ + { + id: ConfigRowId("users"), + path: "rows/users", + }, + ], + }, + ], +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/in/projects.json b/test/cli/template-test-create/create-test-exactlyOne/in/projects.json new file mode 100644 index 0000000000..72ad841c45 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/in/projects.json @@ -0,0 +1,9 @@ +[ + { + "host": "%%TEST_KBC_STORAGE_API_HOST%%", + "project":%%TEST_KBC_PROJECT_ID%%, + "stagingStorage": "%%TEST_KBC_PROJECT_STAGING_STORAGE%%", + "backend": "%%TEST_KBC_PROJECT_BACKEND%%", + "token": "%%TEST_KBC_STORAGE_API_TOKEN%%" + } +] diff --git a/test/cli/template-test-create/create-test-exactlyOne/initial-state.json b/test/cli/template-test-create/create-test-exactlyOne/initial-state.json new file mode 100644 index 0000000000..196b67b17b --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/initial-state.json @@ -0,0 +1,11 @@ +{ + "allBranchesConfigs": [], + "branches": [ + { + "branch": { + "name": "Main", + "isDefault": true + } + } + ] +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/.keboola/repository.json b/test/cli/template-test-create/create-test-exactlyOne/out/.keboola/repository.json new file mode 100644 index 0000000000..de933ab3d5 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/.keboola/repository.json @@ -0,0 +1,26 @@ +{ + "version": 2, + "author": { + "name": "Example Author", + "url": "https://example.com" + }, + "templates": [ + { + "id": "my-template", + "name": "My Template", + "description": "Full workflow to ...", + "path": "my-template", + "versions": [ + { + "version": "0.0.1", + "description": "notes", + "stable": false, + "components": [ + "keboola.ex-facebook" + ], + "path": "v0" + } + ] + } + ] +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/inputs.json b/test/cli/template-test-create/create-test-exactlyOne/out/inputs.json new file mode 100644 index 0000000000..3f46b27294 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/inputs.json @@ -0,0 +1,6 @@ +{ + "ex-db-mysql-db-host": "host", + "ex-db-mysql-db-password": "##KBC_SECRET_PASSWORD##", + "ex-db-mysql-incremental": false, + "ex-generic-v2-api-base-url": "https://jsonplaceholder.typicode.com" +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/README.md b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/README.md new file mode 100644 index 0000000000..47579b4667 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/README.md @@ -0,0 +1,4 @@ +### My Template + +Full workflow to ... + diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/description.md b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/description.md new file mode 100644 index 0000000000..dd8107f80f --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/description.md @@ -0,0 +1,10 @@ +# My Template + +## Extended description +- of a template for demo purposes +- from the examples in the API documentation + +## Some Example +``` + with.a.code() +``` diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/ex-generic-v2/empty/config.jsonnet b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/ex-generic-v2/empty/config.jsonnet new file mode 100644 index 0000000000..adff0db28d --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/ex-generic-v2/empty/config.jsonnet @@ -0,0 +1,7 @@ +{ + parameters: { + api: { + baseUrl: Input("ex-generic-v2-api-base-url"), + }, + }, +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/ex-generic-v2/empty/description.md b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/ex-generic-v2/empty/description.md new file mode 100644 index 0000000000..28f6091c29 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/ex-generic-v2/empty/description.md @@ -0,0 +1 @@ +test fixture diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/ex-generic-v2/empty/meta.jsonnet b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/ex-generic-v2/empty/meta.jsonnet new file mode 100644 index 0000000000..ba845873d1 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/ex-generic-v2/empty/meta.jsonnet @@ -0,0 +1,3 @@ +{ + name: "empty " + InstanceIdShort(), +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/config.jsonnet b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/config.jsonnet new file mode 100644 index 0000000000..cc407120fa --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/config.jsonnet @@ -0,0 +1,8 @@ +{ + parameters: { + db: { + host: Input("ex-db-mysql-db-host"), + "#password": Input("ex-db-mysql-db-password"), + }, + }, +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/description.md b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/description.md new file mode 100644 index 0000000000..28f6091c29 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/description.md @@ -0,0 +1 @@ +test fixture diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/meta.jsonnet b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/meta.jsonnet new file mode 100644 index 0000000000..31d36dc2d4 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/meta.jsonnet @@ -0,0 +1,3 @@ +{ + name: "with-rows", +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/rows/users/config.jsonnet b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/rows/users/config.jsonnet new file mode 100644 index 0000000000..a999413eb1 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/rows/users/config.jsonnet @@ -0,0 +1,5 @@ +{ + parameters: { + incremental: Input("ex-db-mysql-incremental"), + }, +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/rows/users/description.md b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/rows/users/description.md new file mode 100644 index 0000000000..28f6091c29 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/rows/users/description.md @@ -0,0 +1 @@ +test fixture diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/rows/users/meta.jsonnet b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/rows/users/meta.jsonnet new file mode 100644 index 0000000000..f110914cf0 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/extractor/keboola.ex-db-mysql/with-rows/rows/users/meta.jsonnet @@ -0,0 +1,4 @@ +{ + name: "users", + isDisabled: false, +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/inputs.jsonnet b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/inputs.jsonnet new file mode 100644 index 0000000000..53bb10fadf --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/inputs.jsonnet @@ -0,0 +1,69 @@ +{ + stepsGroups: [ + { + description: "Default Group", + required: "exactlyOne", + steps: [ + { + icon: "common:settings", + name: "Default Step 1", + description: "Default Step 1", + inputs: [ + { + id: "ex-generic-v2-api-base-url", + name: "Api BaseUrl", + description: "a", + type: "string", + kind: "input", + default: "https://jsonplaceholder.typicode.com", + }, + ], + }, + { + icon: "common:settings", + name: "Default Step 2", + description: "Default Step 2", + inputs: [ + { + id: "ex-db-mysql-db-host", + name: "Db Host", + description: "b", + type: "string", + kind: "input", + default: "mysql.example.com", + }, + ], + }, + { + icon: "common:settings", + name: "Default Step 3", + description: "Default Step 3", + inputs: [ + { + id: "ex-db-mysql-incremental", + name: "Incremental", + description: "c", + type: "bool", + kind: "confirm", + default: false, + }, + ], + }, + { + icon: "common:settings", + name: "Default Step 4", + description: "Default Step 4", + inputs: [ + { + id: "ex-db-mysql-db-password", + name: "Db Pass", + description: "b", + type: "string", + kind: "hidden", + }, + ], + }, + ], + }, + ], +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/manifest.jsonnet b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/manifest.jsonnet new file mode 100644 index 0000000000..4fea74ed8e --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/src/manifest.jsonnet @@ -0,0 +1,21 @@ +{ + configurations: [ + { + componentId: "ex-generic-v2", + id: ConfigId("empty"), + path: "extractor/ex-generic-v2/empty", + rows: [], + }, + { + componentId: "keboola.ex-db-mysql", + id: ConfigId("with-rows"), + path: "extractor/keboola.ex-db-mysql/with-rows", + rows: [ + { + id: ConfigRowId("users"), + path: "rows/users", + }, + ], + }, + ], +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/.keboola/manifest.json b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/.keboola/manifest.json new file mode 100644 index 0000000000..ddc8d8435f --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/.keboola/manifest.json @@ -0,0 +1,80 @@ +{ + "version": 2, + "project": { + "id": __PROJECT_ID__, + "apiHost": "__STORAGE_API_HOST__" + }, + "allowTargetEnv": false, + "sortBy": "id", + "naming": { + "branch": "{branch_name}", + "config": "{component_type}/{component_id}/{config_name}", + "configRow": "rows/{config_row_name}", + "schedulerConfig": "schedules/{config_name}", + "sharedCodeConfig": "_shared/{target_component_id}", + "sharedCodeConfigRow": "codes/{config_row_name}", + "variablesConfig": "variables", + "variablesValuesRow": "values/{config_row_name}", + "dataAppConfig": "app/{component_id}/{config_name}" + }, + "allowedBranches": [ + "*" + ], + "ignoredComponents": [], + "templates": { + "repositories": [ + { + "type": "dir", + "name": "keboola", + "url": "../repository", + "ref": "main" + } + ] + }, + "branches": [ + { + "id": __MAIN_BRANCH_ID__, + "path": "main", + "metadata": { + "KBC.KAC.templates.instances": "[{\"instanceId\":\"%s\",\"instanceName\":\"test\",\"templateId\":\"my-template\",\"repositoryName\":\"keboola\",\"version\":\"0.0.1\",\"created\":{\"date\":\"%s\",\"tokenId\":\"%s\"},\"updated\":{\"date\":\"%s\",\"tokenId\":\"%s\"}}]" + } + } + ], + "configurations": [ + { + "branchId": __MAIN_BRANCH_ID__, + "componentId": "ex-generic-v2", + "id": "%s", + "path": "extractor/ex-generic-v2/empty-instance", + "metadata": { + "KBC.KAC.templates.configId": "{\"idInTemplate\":\"empty\"}", + "KBC.KAC.templates.configInputs": "[{\"input\":\"ex-generic-v2-api-base-url\",\"key\":\"parameters.api.baseUrl\"}]", + "KBC.KAC.templates.instanceId": "%s", + "KBC.KAC.templates.repository": "keboola", + "KBC.KAC.templates.templateId": "my-template" + }, + "rows": [] + }, + { + "branchId": __MAIN_BRANCH_ID__, + "componentId": "keboola.ex-db-mysql", + "id": "%s", + "path": "extractor/keboola.ex-db-mysql/with-rows", + "metadata": { + "KBC.KAC.templates.configId": "{\"idInTemplate\":\"with-rows\"}", + "KBC.KAC.templates.configInputs": "[{\"input\":\"ex-db-mysql-db-password\",\"key\":\"parameters.db.#password\"},{\"input\":\"ex-db-mysql-db-host\",\"key\":\"parameters.db.host\"}]", + "KBC.KAC.templates.instanceId": "%s", + "KBC.KAC.templates.repository": "keboola", + "KBC.KAC.templates.rowsIds": "[{\"idInProject\":\"%s\",\"idInTemplate\":\"users\"}]", + "KBC.KAC.templates.rowsInputs": "[{\"rowId\":\"%s\",\"input\":\"ex-db-mysql-incremental\",\"key\":\"parameters.incremental\"}]", + "KBC.KAC.templates.templateId": "my-template" + }, + "rows": [ + { + "id": "%s", + "path": "rows/users" + } + ] + } + ] +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/description.md b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/description.md new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/description.md @@ -0,0 +1 @@ + diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/description.md b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/description.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/ex-generic-v2/empty-instance/config.json b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/ex-generic-v2/empty-instance/config.json new file mode 100644 index 0000000000..e7bf7fb680 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/ex-generic-v2/empty-instance/config.json @@ -0,0 +1,7 @@ +{ + "parameters": { + "api": { + "baseUrl": "https://jsonplaceholder.typicode.com" + } + } +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/ex-generic-v2/empty-instance/description.md b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/ex-generic-v2/empty-instance/description.md new file mode 100644 index 0000000000..28f6091c29 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/ex-generic-v2/empty-instance/description.md @@ -0,0 +1 @@ +test fixture diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/ex-generic-v2/empty-instance/meta.json b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/ex-generic-v2/empty-instance/meta.json new file mode 100644 index 0000000000..9cd6f943d1 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/ex-generic-v2/empty-instance/meta.json @@ -0,0 +1,4 @@ +{ + "name": "empty instance", + "isDisabled": false +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/keboola.ex-db-mysql/with-rows/config.json b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/keboola.ex-db-mysql/with-rows/config.json new file mode 100644 index 0000000000..c72e3c0678 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/keboola.ex-db-mysql/with-rows/config.json @@ -0,0 +1,8 @@ +{ + "parameters": { + "db": { + "#password": "##KBC_SECRET_PASSWORD##", + "host": "host" + } + } +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/keboola.ex-db-mysql/with-rows/description.md b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/keboola.ex-db-mysql/with-rows/description.md new file mode 100644 index 0000000000..28f6091c29 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/keboola.ex-db-mysql/with-rows/description.md @@ -0,0 +1 @@ +test fixture diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/keboola.ex-db-mysql/with-rows/meta.json b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/keboola.ex-db-mysql/with-rows/meta.json new file mode 100644 index 0000000000..b6b602f6ff --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/keboola.ex-db-mysql/with-rows/meta.json @@ -0,0 +1,4 @@ +{ + "name": "with-rows", + "isDisabled": false +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/keboola.ex-db-mysql/with-rows/rows/users/config.json b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/keboola.ex-db-mysql/with-rows/rows/users/config.json new file mode 100644 index 0000000000..45fb08048a --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/keboola.ex-db-mysql/with-rows/rows/users/config.json @@ -0,0 +1,5 @@ +{ + "parameters": { + "incremental": false + } +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/keboola.ex-db-mysql/with-rows/rows/users/description.md b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/keboola.ex-db-mysql/with-rows/rows/users/description.md new file mode 100644 index 0000000000..28f6091c29 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/keboola.ex-db-mysql/with-rows/rows/users/description.md @@ -0,0 +1 @@ +test fixture diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/keboola.ex-db-mysql/with-rows/rows/users/meta.json b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/keboola.ex-db-mysql/with-rows/rows/users/meta.json new file mode 100644 index 0000000000..01dda2fbde --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/extractor/keboola.ex-db-mysql/with-rows/rows/users/meta.json @@ -0,0 +1,4 @@ +{ + "name": "users", + "isDisabled": false +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/meta.json b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/meta.json new file mode 100644 index 0000000000..154a3ce050 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/expected-out/main/meta.json @@ -0,0 +1,4 @@ +{ + "name": "Main", + "isDefault": true +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/inputs.json b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/inputs.json new file mode 100644 index 0000000000..3f46b27294 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/my-template/v0/tests/one/inputs.json @@ -0,0 +1,6 @@ +{ + "ex-db-mysql-db-host": "host", + "ex-db-mysql-db-password": "##KBC_SECRET_PASSWORD##", + "ex-db-mysql-incremental": false, + "ex-generic-v2-api-base-url": "https://jsonplaceholder.typicode.com" +} diff --git a/test/cli/template-test-create/create-test-exactlyOne/out/projects.json b/test/cli/template-test-create/create-test-exactlyOne/out/projects.json new file mode 100644 index 0000000000..72ad841c45 --- /dev/null +++ b/test/cli/template-test-create/create-test-exactlyOne/out/projects.json @@ -0,0 +1,9 @@ +[ + { + "host": "%%TEST_KBC_STORAGE_API_HOST%%", + "project":%%TEST_KBC_PROJECT_ID%%, + "stagingStorage": "%%TEST_KBC_PROJECT_STAGING_STORAGE%%", + "backend": "%%TEST_KBC_PROJECT_BACKEND%%", + "token": "%%TEST_KBC_STORAGE_API_TOKEN%%" + } +]