Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ishanjainn committed Sep 18, 2023
1 parent 01a32cf commit 87d8125
Show file tree
Hide file tree
Showing 4 changed files with 182 additions and 8 deletions.
32 changes: 30 additions & 2 deletions .github/workflows/full-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,36 @@ jobs:
- name: Install ansible-base (${{ matrix.ansible }})
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check

- name: Run integration test
run: ansible-test integration -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker --coverage --test alert_contact_point
- name: Test module alert_contact_point
run: ansible-test integration -v alert_contact_point --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Test module alert_notification_policy
run: ansible-test integration -v alert_notification_policy --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Test module cloud_api_key
run: ansible-test integration -v cloud_api_key --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Test module cloud_plugin
run: ansible-test integration -v cloud_plugin --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Test module cloud_stack
run: ansible-test integration -v cloud_stack --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Test module dashboard
run: ansible-test integration -v dashboard --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Test module datasource
run: ansible-test integration -v datasource --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Test module folder
run: ansible-test integration -v folder --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Cooling Period
Expand Down
118 changes: 118 additions & 0 deletions .github/workflows/modules-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
---
name: Modules Test

# yamllint disable-line rule:truthy
on:
push:
branches:
- "main"
pull_request:
schedule:
- cron: '0 6 * * *'
env:
NAMESPACE: grafana
COLLECTION_NAME: grafana

jobs:

sanity:
name: Sanity (Ⓐ${{ matrix.ansible }})
strategy:
matrix:
ansible:
- stable-2.12
- stable-2.13
- stable-2.14
- devel
runs-on: ubuntu-20.04
steps:

- name: Check out code
uses: actions/checkout@v3
with:
path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.10'

- name: Install ansible-base (${{ matrix.ansible }})
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check

- name: Run sanity tests
run: ansible-test sanity -v --docker --color --coverage
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

integration:
runs-on: ubuntu-20.04
name: Integration (Ⓐ${{ matrix.ansible }}-py${{ matrix.python }})
strategy:
fail-fast: true
max-parallel: 1
matrix:
ansible:
- stable-2.13
python:
- '3.10'

steps:
- name: Check out code
uses: actions/checkout@v2
with:
path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: create integration_config
working-directory: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/tests/integration
run: |
cat <<EOF > integration_config.yml
stack_name: ${{ secrets.ANSIBLE_TEST_STACK_NAME }}
org_name: ${{ secrets.ANSIBLE_TEST_ORG_NAME }}
grafana_cloud_api_key: ${{ secrets.ANSIBLE_TEST_CLOUD_API_KEY }}
grafana_api_key: ${{ secrets.ANSIBLE_TEST_GRAFANA_API_KEY }}
grafana_url: ${{ secrets.ANSIBLE_GRAFANA_URL }}
test_stack_name: ${{ secrets.ANSIBLE_TEST_CI_STACK }}
EOF
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}

- name: Install ansible-base (${{ matrix.ansible }})
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check

- name: Install Requests
run: pip install requests

- name: Test module alert_contact_point
run: ansible-test integration -v alert_contact_point --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker

Check warning on line 89 in .github/workflows/modules-test.yml

View workflow job for this annotation

GitHub Actions / Perform Linting

89:151 [line-length] line too long (162 > 150 characters)
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Test module alert_notification_policy
run: ansible-test integration -v alert_notification_policy --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker

Check warning on line 93 in .github/workflows/modules-test.yml

View workflow job for this annotation

GitHub Actions / Perform Linting

93:151 [line-length] line too long (168 > 150 characters)
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Test module cloud_api_key
run: ansible-test integration -v cloud_api_key --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker

Check warning on line 97 in .github/workflows/modules-test.yml

View workflow job for this annotation

GitHub Actions / Perform Linting

97:151 [line-length] line too long (156 > 150 characters)
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Test module cloud_plugin
run: ansible-test integration -v cloud_plugin --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker

Check warning on line 101 in .github/workflows/modules-test.yml

View workflow job for this annotation

GitHub Actions / Perform Linting

101:151 [line-length] line too long (155 > 150 characters)
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Test module cloud_stack
run: ansible-test integration -v cloud_stack --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker

Check warning on line 105 in .github/workflows/modules-test.yml

View workflow job for this annotation

GitHub Actions / Perform Linting

105:151 [line-length] line too long (154 > 150 characters)
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Test module dashboard
run: ansible-test integration -v dashboard --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker

Check warning on line 109 in .github/workflows/modules-test.yml

View workflow job for this annotation

GitHub Actions / Perform Linting

109:151 [line-length] line too long (152 > 150 characters)
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Test module datasource
run: ansible-test integration -v datasource --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker

Check warning on line 113 in .github/workflows/modules-test.yml

View workflow job for this annotation

GitHub Actions / Perform Linting

113:151 [line-length] line too long (153 > 150 characters)
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Test module folder
run: ansible-test integration -v folder --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
32 changes: 30 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,36 @@ jobs:
- name: Install ansible-base (${{ matrix.ansible }})
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check

- name: Run integration test
run: ansible-test integration -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker --coverage
- name: Test module alert_contact_point
run: ansible-test integration -v alert_contact_point --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker

Check warning on line 83 in .github/workflows/release.yml

View workflow job for this annotation

GitHub Actions / Perform Linting

83:151 [line-length] line too long (162 > 150 characters)
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Test module alert_notification_policy
run: ansible-test integration -v alert_notification_policy --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Test module cloud_api_key
run: ansible-test integration -v cloud_api_key --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Test module cloud_plugin
run: ansible-test integration -v cloud_plugin --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Test module cloud_stack
run: ansible-test integration -v cloud_stack --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Test module dashboard
run: ansible-test integration -v dashboard --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Test module datasource
run: ansible-test integration -v datasource --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Test module folder
run: ansible-test integration -v folder --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

release:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: CI Tests
name: Role Test

# yamllint disable-line rule:truthy
on:
Expand Down Expand Up @@ -85,6 +85,6 @@ jobs:
- name: Install Requests
run: pip install requests

- name: Run integration test
run: ansible-test integration -v alert_contact_point --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
- name: Test role alert_contact_point
run: ansible-test integration -v molecule-grafana-alternative molecule-grafana-default --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

0 comments on commit 87d8125

Please sign in to comment.