Skip to content

Commit 83d6466

Browse files
- Added robot test Alternate App Root Persists All Temp Materials in Alotted Directory.
1 parent ecd6890 commit 83d6466

File tree

5 files changed

+53
-1
lines changed

5 files changed

+53
-1
lines changed

docker-compose-persist-postgres.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ services:
4343
- ./cicd/vol/srv/credentials:/opt/stackql/srv/credentials:ro
4444
- ./test/assets/credentials/dummy:/opt/stackql/credentials/dummy:ro
4545
- ./test/assets/input:/opt/stackql/input:ro
46+
- ./test/tmp:/opt/test/tmp:rw
4647
- ${DB_SETUP_SRC:-./test/db/sqlite}:/opt/stackql/db:ro
4748
- ${REGISTRY_SRC:-./test/registry-mocked}:/opt/stackql/registry:ro
4849
- ./cicd/vol/stackql/config:/opt/stackql/.stackql:rw

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ services:
4343
- ./cicd/vol/srv/credentials:/opt/stackql/srv/credentials:ro
4444
- ./test/assets/credentials/dummy:/opt/stackql/credentials/dummy:ro
4545
- ./test/assets/input:/opt/stackql/input:ro
46+
- ./test/tmp:/opt/test/tmp:rw
4647
- ${DB_SETUP_SRC:-./test/db/sqlite}:/opt/stackql/db:ro
4748
- ${REGISTRY_SRC:-./test/registry-mocked}:/opt/stackql/registry:ro
4849
- ./cicd/vol/stackql/config:/opt/stackql/.stackql:rw

test/robot/functional/stackql_mocked_from_cmd_line.robot

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7323,3 +7323,33 @@ Busted Auth Throws Error Then Set Statement Update Auth Scenario Working
73237323
... ${outputErrStr}
73247324
... stdout=${CURDIR}/tmp/Busted-Auth-Throws-Error-Then-Set-Statement-Update-Auth-Scenario-Working-Working.tmp
73257325
... stderr=${CURDIR}/tmp/Busted-Auth-Throws-Error-Then-Set-Statement-Update-Auth-Scenario-Working-Working-stderr.tmp
7326+
7327+
Alternate App Root Persists All Temp Materials in Alotted Directory
7328+
[Teardown] Remove Directory ${TEST_TMP_EXEC_APP_ROOT} recursive=True
7329+
${inputStr} = Catenate
7330+
... registry pull google v0.1.2;
7331+
... show providers;
7332+
${outputStr} = Catenate SEPARATOR=\n
7333+
... |--------|---------|
7334+
... |${SPACE}${SPACE}name${SPACE}${SPACE}|${SPACE}version${SPACE}|
7335+
... |--------|---------|
7336+
... |${SPACE}google${SPACE}|${SPACE}v0.1.2${SPACE}${SPACE}|
7337+
... |--------|---------|
7338+
${outputErrStr} = Catenate SEPARATOR=\n
7339+
... google provider, version 'v0.1.2' successfully installed
7340+
Should Stackql Exec Inline Equal Both Streams
7341+
... ${STACKQL_EXE}
7342+
... ${OKTA_SECRET_STR}
7343+
... ${GITHUB_SECRET_STR}
7344+
... ${K8S_SECRET_STR}
7345+
... ${REGISTRY_MOCKED_CFG_STR}
7346+
... ${AUTH_CFG_DEFECTIVE_STR}
7347+
... ${SQL_BACKEND_CFG_STR_CANONICAL}
7348+
... ${inputStr}
7349+
... ${outputStr}
7350+
... ${outputErrStr}
7351+
... stackql_approot=${TEST_TMP_EXEC_APP_ROOT}
7352+
... stdout=${CURDIR}/tmp/Alternate-App-Root-Persists-All-Temp-Materials-in-Alotted-Directory.tmp
7353+
... stderr=${CURDIR}/tmp/Alternate-App-Root-Persists-All-Temp-Materials-in-Alotted-Directory-stderr.tmp
7354+
Directory Should Exist ${TEST_TMP_EXEC_APP_ROOT}${/}readline
7355+
Directory Should Exist ${TEST_TMP_EXEC_APP_ROOT}${/}src

test/robot/lib/StackQLInterfaces.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ def _docker_transform_args(self, *args) -> typing.Iterable:
220220
rv = [ f"--sqlBackend='{b[13:]}'" if type(b) == str and b.startswith('--sqlBackend=') else b for b in list(rv) ]
221221
rv = [ f"--export.alias='{b[15:]}'" if type(b) == str and b.startswith('--export.alias=') else b for b in list(rv) ]
222222
rv = [ f"--http.log.enabled='{b[19:]}'" if type(b) == str and b.startswith('--http.log.enabled=') else b for b in list(rv) ]
223+
rv = [ f"--approot='{b[10:]}'" if type(b) == str and b.startswith('--approot=') else b for b in list(rv) ]
223224
return rv
224225

225226
def _run_stackql_exec_command_docker(
@@ -254,6 +255,9 @@ def _run_stackql_exec_command_docker(
254255
query_from_input_file_path = cfg.pop('stackql_i', False)
255256
if query_from_input_file_path:
256257
supplied_args.append(f'--infile={query_from_input_file_path}')
258+
approot = cfg.pop('stackql_approot', False)
259+
if approot:
260+
supplied_args.append(f'--approot={approot}')
257261
query_from_input_file_data_path = cfg.pop('stackql_iqldata', False)
258262
if query_from_input_file_data_path:
259263
supplied_args.append(f'--iqldata={query_from_input_file_data_path}')
@@ -358,6 +362,9 @@ def _run_stackql_shell_command_docker(
358362
supplied_args.append(f"--registry='{registry_cfg_str}'")
359363
if auth_cfg_str != "":
360364
supplied_args.append(f"--auth='{auth_cfg_str}'")
365+
approot = cfg.pop('stackql_approot', False)
366+
if approot:
367+
supplied_args.append(f'--approot={approot}')
361368
if sql_backend_cfg_str != "":
362369
supplied_args.append(f"--sqlBackend='{sql_backend_cfg_str}'")
363370
supplied_args.append("--tls.allowInsecure=true")
@@ -445,6 +452,9 @@ def _run_stackql_exec_command_native(
445452
query_from_input_file_path = cfg.pop('stackql_i', False)
446453
if query_from_input_file_path:
447454
supplied_args.append(f'--infile={query_from_input_file_path}')
455+
approot = cfg.pop('stackql_approot', False)
456+
if approot:
457+
supplied_args.append(f'--approot={approot}')
448458
query_from_input_file_data_path = cfg.pop('stackql_iqldata', False)
449459
if query_from_input_file_data_path:
450460
supplied_args.append(f'--iqldata={query_from_input_file_data_path}')
@@ -513,7 +523,11 @@ def _run_stackql_shell_command_native(
513523
if sql_backend_cfg_str != "":
514524
supplied_args.append(f"--sqlBackend={sql_backend_cfg_str}")
515525
supplied_args.append("--tls.allowInsecure=true")
516-
supplied_args.append(f'--approot="{_TEST_APP_CACHE_ROOT}"')
526+
approot = cfg.pop('stackql_approot', False)
527+
if approot:
528+
supplied_args.append(f'--approot={approot}')
529+
else:
530+
supplied_args.append(f'--approot="{_TEST_APP_CACHE_ROOT}"')
517531
supplied_args.append(f"--execution.concurrency.limit={self._concurrency_limit}")
518532
supplied_args = supplied_args + list(args)
519533
stdout = cfg.get('stdout', subprocess.PIPE)

test/robot/lib/stackql_context.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@ def get_registry_mocked(execution_env :str) -> RegistryCfg:
189189
nop_verify=True
190190
)
191191

192+
def get_local_temp_path(inode_name: str, execution_env: str) -> str:
193+
if execution_env == 'docker':
194+
return os.path.join('/opt', 'test', 'tmp', inode_name)
195+
return os.path.join(REPOSITORY_ROOT, 'test', 'tmp', inode_name)
196+
192197
_AUTH_GOOGLE_SA_KEY_PATH = get_unix_path(os.path.join(REPOSITORY_ROOT, 'test', 'assets', 'credentials', 'dummy', 'google', 'functional-test-dummy-sa-key.json'))
193198

194199
_NON_EXISTENT_AUTH_GOOGLE_SA_KEY_PATH = get_unix_path(os.path.join(REPOSITORY_ROOT, 'test', 'assets', 'credentials', 'dummy', 'google', 'non-existent-dummy-sa-key.json'))
@@ -1118,6 +1123,7 @@ def get_variables(execution_env :str, sql_backend_str :str, use_stackql_preinsta
11181123
'UPDATE_GITHUB_ORG': UPDATE_GITHUB_ORG,
11191124
'VIEW_SELECT_AWS_CLOUD_CONTROL_BUCKET_DETAIL_EXPECTED': VIEW_SELECT_AWS_CLOUD_CONTROL_BUCKET_DETAIL_EXPECTED,
11201125
'VIEW_SELECT_STAR_AWS_CLOUD_CONTROL_BUCKET_DETAIL_EXPECTED': VIEW_SELECT_STAR_AWS_CLOUD_CONTROL_BUCKET_DETAIL_EXPECTED,
1126+
'TEST_TMP_EXEC_APP_ROOT': get_local_temp_path('.exec_app_root.stackql', execution_env),
11211127
}
11221128
if execution_env == 'docker':
11231129
rv['AUTH_CFG_STR'] = AUTH_CFG_STR_DOCKER

0 commit comments

Comments
 (0)