The stackql/stackql-assert action is an composite action that runs stackql query and check if result matches expected result
Note stackql-assert action uses same auth setup as stackql-exec. Learn more about authentication setup when running stackql
{   "google": { "type": "service_account",  "credentialsfilepath": "sa-key.json" },
    "github": { "type": "basic", "credentialsenvvar": "STACKQL_GITHUB_CREDS" }}
It can be passed with auth_str as a string, or stored in a file and pass filename to auth-obj-path
- For "basic" auth, you need to set a environment variable with same name as the value of credentialsenvvarin the auth string for the Github Action step. You can use Github Secrets to store the value of the environment variable, and use env to pass it to the action. For example:
env:
  STACKQL_GITHUB_CREDS: ${{ secrets.STACKQL_GITHUB_CREDS }}
- For "service_account" auth, you need to store the credentials into a file; You can follow the example of Prep Google Creds (bash)step in the example workflow
- Use test_queryortest_query_pathto pass the test query to the action. The test query should be a valid StackQL query. The action will run the query and check if the result is empty or not. If the result is empty, the action will fail the step.
- Either test_queryortest_query_pathis required. If both are provided,test_querywill be used.
- query example can be found in example workflow and example .iql file
- Use expected_results_strorexpected_results_file_pathto pass the expected result to the action. The expected result should be a valid JSON object. The action will compare the result with the expected result. If the result is not the same as the expected result, the action will fail the step.
- Either expected_results_strorexpected_results_file_pathis required. If both are provided,expected_results_strwill be used.
- Expected result example can be found in example workflow and example .json file
- auth_obj_path- Path to the auth object file.
- auth_str- Auth string.
- test_query- Test query to run (overrides test_query_path).
- test_query_path- Path to the test query file.
- expected_rows- Expected number of rows in the result.
- expected_results_str- expected result from executing test query, support object string (overrides expected_results_file_path)
- expected_results_file_path- file that stores expected result, json is support