Skip to content

Commit fab98c5

Browse files
test-contains-both-streams (#516)
Summary: - Added new robot testing keyword `Should Stackql Exec Inline Contain Both Streams`. - Updated selected positive and negative scenarios to use new keyword. - Robot test `Registry Pull Google Provider Implicit Latest Version` uses new keyword for positive scenario. - Robot test `Select Star of EC2 Instances Returns Expected Result` uses new keyword for positive scenario. - Robot test `Faulty Auth Azure Authenticated VM Sizes` uses new keyword for negative scenario.
1 parent d32a42e commit fab98c5

File tree

3 files changed

+41
-3
lines changed

3 files changed

+41
-3
lines changed

test/robot/functional/stackql_mocked_from_cmd_line.robot

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2688,7 +2688,7 @@ Registry Pull Google Provider Specific Version Prerelease
26882688
... successfully installed
26892689

26902690
Registry Pull Google Provider Implicit Latest Version
2691-
Should Stackql Exec Inline Contain Stderr
2691+
Should Stackql Exec Inline Contain Both Streams
26922692
... ${STACKQL_EXE}
26932693
... ${OKTA_SECRET_STR}
26942694
... ${GITHUB_SECRET_STR}
@@ -2697,6 +2697,7 @@ Registry Pull Google Provider Implicit Latest Version
26972697
... ${AUTH_CFG_STR}
26982698
... ${SQL_BACKEND_CFG_STR_CANONICAL}
26992699
... registry pull google ;
2700+
... ${EMPTY}
27002701
... successfully installed
27012702

27022703

@@ -3566,7 +3567,7 @@ Basic View Select Star of Cloud Control Resource Returns Expected Result
35663567
... ${CURDIR}/tmp/Basic-View-Select-Star-of-Cloud-Control-Resource-Returns-Expected-Result.tmp
35673568

35683569
Select Star of EC2 Instances Returns Expected Result
3569-
Should StackQL Exec Inline Contain
3570+
Should StackQL Exec Inline Contain Both Streams
35703571
... ${STACKQL_EXE}
35713572
... ${OKTA_SECRET_STR}
35723573
... ${GITHUB_SECRET_STR}
@@ -3576,6 +3577,7 @@ Select Star of EC2 Instances Returns Expected Result
35763577
... ${SQL_BACKEND_CFG_STR_CANONICAL}
35773578
... select * from aws.ec2.instances where region \= 'us-east-1' ;
35783579
... vol-1234567890abcdef0
3580+
... ${EMPTY}
35793581
... stdout=${CURDIR}/tmp/Select-Star-of-EC2-Instances-Returns-Expected-Result.tmp
35803582

35813583
Select With IN Scalars inside WHERE Clause Returns Expected Result

test/robot/integration/stackql_integration_from_cmd_line.robot

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Azure Authenticated VM Sizes
2323
... stdout=${CURDIR}/tmp/Azure-Authenticated-VM-Sizes.tmp
2424

2525
Faulty Auth Azure Authenticated VM Sizes
26-
Should Stackql Exec Inline Contain stderr
26+
Should Stackql Exec Inline Contain Both Streams
2727
... ${STACKQL_EXE}
2828
... ${OKTA_SECRET_STR}
2929
... ${GITHUB_SECRET_STR}
@@ -32,6 +32,7 @@ Faulty Auth Azure Authenticated VM Sizes
3232
... ${AUTH_AZURE_FAULTY}
3333
... ${SQL_BACKEND_CFG_STR_CANONICAL}
3434
... ${AZURE_VM_SIZES_ENUMERATION}
35+
... ${EMPTY}
3536
... credentials error
3637
... stdout=${CURDIR}/tmp/Faulty-Azure-Authenticated-VM-Sizes.tmp
3738
... stderr=${CURDIR}/tmp/Faulty-Azure-Authenticated-VM-Sizes-stderr.tmp

test/robot/lib/StackQLInterfaces.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ def _verify_both_streams(self, result, expected_output, expected_stderr_output):
101101
return stdout_ok and stderr_ok
102102
stderr_ok = self.should_be_equal(result.stderr, expected_stderr_output)
103103
return stdout_ok and stderr_ok
104+
105+
def _contain_both_streams(self, result, expected_output, expected_stderr_output):
106+
stdout_ok = self.should_contain(result.stdout, expected_output)
107+
stderr_ok = self.should_contain(result.stderr, expected_stderr_output)
108+
return stdout_ok and stderr_ok
104109

105110
def _run_sqlite_command(self, sqlite_exe :str, sqlite_db_file :str, query :str, *args, **cfg):
106111
self.log_to_console(f"sqlite_exe = '{sqlite_exe}'")
@@ -927,6 +932,36 @@ def should_stackql_exec_inline_contain(
927932
**cfg
928933
)
929934
return self.should_contain(result.stdout, expected_output)
935+
936+
@keyword
937+
def should_stackql_exec_inline_contain_both_streams(
938+
self,
939+
stackql_exe :str,
940+
okta_secret_str :str,
941+
github_secret_str :str,
942+
k8s_secret_str :str,
943+
registry_cfg :RegistryCfg,
944+
auth_cfg_str :str,
945+
sql_backend_cfg_str :str,
946+
query :str,
947+
expected_output :str,
948+
expected_output_stderr :str,
949+
*args,
950+
**cfg
951+
):
952+
result = self._run_stackql_exec_command(
953+
stackql_exe,
954+
okta_secret_str,
955+
github_secret_str,
956+
k8s_secret_str,
957+
registry_cfg,
958+
auth_cfg_str,
959+
sql_backend_cfg_str,
960+
query,
961+
*args,
962+
**cfg
963+
)
964+
return self._contain_both_streams(result, expected_output, expected_output_stderr)
930965

931966

932967
@keyword

0 commit comments

Comments
 (0)