Skip to content

Commit 615080c

Browse files
Matovidloclaude
andcommitted
test: add templates API E2E test for shared-variables project
Adds test/templates/api/projects/project-with-shared-variables/ which sets up a project where a keboola.variables config is referenced by two consumer configs (identical to the CLI variables-used-twice fixture) and calls GET /v1/project/{branch}/instances. That endpoint calls prj.LoadState with LoadRemoteState:true, triggering AfterRemoteOperation and the full mapper chain. Without the two-pass fix this returned 500 "multiple parents defined by relations"; with the fix it returns 200 with an empty instances list. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent eb9ffc2 commit 615080c

5 files changed

Lines changed: 102 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
200
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"instances": []
3+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"path": "/v1/project/%%TEST_BRANCH_MAIN_ID%%/instances",
3+
"method": "GET",
4+
"headers": {
5+
"Content-Type": "application/json",
6+
"X-StorageApi-Token": "%%TEST_KBC_STORAGE_API_TOKEN%%"
7+
},
8+
"body": {}
9+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"branches": [
3+
{
4+
"branch": {
5+
"name": "Main",
6+
"description": "",
7+
"isDefault": true
8+
},
9+
"configs": [
10+
{
11+
"componentId": "ex-generic-v2",
12+
"name": "With Variables 1",
13+
"description": "",
14+
"configuration": {
15+
"variables_id": "%s",
16+
"variables_values_id": "%s"
17+
},
18+
"rows": [],
19+
"isDisabled": false
20+
},
21+
{
22+
"componentId": "ex-generic-v2",
23+
"name": "With Variables 2",
24+
"description": "",
25+
"configuration": {
26+
"variables_id": "%s",
27+
"variables_values_id": "%s"
28+
},
29+
"rows": [],
30+
"isDisabled": false
31+
},
32+
{
33+
"componentId": "keboola.variables",
34+
"name": "Variables",
35+
"description": "",
36+
"configuration": {
37+
"variables": [
38+
{
39+
"name": "foo",
40+
"type": "string"
41+
}
42+
]
43+
},
44+
"rows": [
45+
{
46+
"name": "Default values",
47+
"description": "",
48+
"isDisabled": false,
49+
"configuration": {
50+
"values": [
51+
{
52+
"name": "foo",
53+
"value": "bar"
54+
}
55+
]
56+
}
57+
}
58+
],
59+
"isDisabled": false
60+
}
61+
]
62+
}
63+
]
64+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"backend": {
3+
"type": "snowflake"
4+
},
5+
"allBranchesConfigs": [],
6+
"branches": [
7+
{
8+
"branch": {
9+
"name": "Main",
10+
"isDefault": true
11+
},
12+
"configs": [
13+
"with-variables-1",
14+
"with-variables-2",
15+
"variables"
16+
]
17+
}
18+
],
19+
"envs": {
20+
"TEST_CONFIG_WITH_VARIABLES_1_VARIABLES_ID": "%%TEST_BRANCH_MAIN_CONFIG_VARIABLES_ID%%",
21+
"TEST_CONFIG_WITH_VARIABLES_1_VARIABLES_VALUES_ID": "%%TEST_BRANCH_MAIN_CONFIG_VARIABLES_ROW_DEFAULT_VALUES_ID%%",
22+
"TEST_CONFIG_WITH_VARIABLES_2_VARIABLES_ID": "%%TEST_BRANCH_MAIN_CONFIG_VARIABLES_ID%%",
23+
"TEST_CONFIG_WITH_VARIABLES_2_VARIABLES_VALUES_ID": "%%TEST_BRANCH_MAIN_CONFIG_VARIABLES_ROW_DEFAULT_VALUES_ID%%"
24+
}
25+
}

0 commit comments

Comments
 (0)