-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (75 loc) · 2.87 KB
/
stackql-assert-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: 'stackql-assert'
on:
push:
branches:
- main
pull_request:
jobs:
stackql-exec-google-example:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{matrix.os}}
name: 'Assert test '
steps:
- name: Checkout
uses: actions/[email protected]
#
# Pull required providers
#
- name: pull required providers
uses: stackql/[email protected]
with:
is_command: true
query: "REGISTRY PULL google; REGISTRY PULL github"
#
# Example `test_query` with `expected_rows`
#
- name: Use test query string and expected rows
uses: ./
with:
test_query: |
SELECT name
FROM google.compute.instances
WHERE project = 'stackql-integration-tests' AND zone = 'australia-southeast1-a' and name = 'stackql-test-001';
expected_rows: 1
env:
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}
#
# Example `test_query_file_path` with `expected_results_str`
#
- name: Use test query file and expected result string
uses: ./
with:
test_query_file_path: './.github/workflows/workflow_scripts/google-example.iql'
expected_results_str: '[{"name":"stackql-test-001"}]'
env:
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}
#
# Example `test_query_file_path` with `expected_results_file_path` supplying `vars` using an inline `jsonnet` config block
#
- name: Use test query file and expected results file path using inline jsonnet config block and external vars
uses: ./
with:
test_query_file_path: './.github/workflows/workflow_scripts/google-example-inline-jsonnet.iql'
expected_results_file_path: './.github/workflows/workflow_scripts/google-example-inline-jsonnet-results.json'
vars: GOOGLE_PROJECT=${{ env.GOOGLE_PROJECT }},GOOGLE_ZONE=${{ env.GOOGLE_ZONE }}
env:
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}
GOOGLE_PROJECT: ${{ vars.GOOGLE_PROJECT }}
GOOGLE_ZONE: ${{ vars.GOOGLE_ZONE }}
#
# Example `test_query_file_path` with `expected_rows` supplying `vars` using `jsonnet` config provided using `data_file_path`
#
- name: Use test query file with a jsonnet data file sourcing external vars and an expected row count
uses: ./
with:
test_query_file_path: './.github/workflows/workflow_scripts/github-example.iql'
data_file_path: './.github/workflows/workflow_scripts/github-example-data.jsonnet'
vars: TEST_ORG=${{ env.TEST_ORG }},TEST_REPO=${{ env.TEST_REPO }}
expected_rows: 1
env:
STACKQL_GITHUB_USERNAME: ${{ secrets.STACKQL_GITHUB_USERNAME }}
STACKQL_GITHUB_PASSWORD: ${{ secrets.STACKQL_GITHUB_PASSWORD }}
TEST_ORG: ${{ vars.TEST_ORG }}
TEST_REPO: ${{ vars.TEST_REPO }}