Skip to content

Commit 5da55df

Browse files
authored
improve tests (#19)
1 parent 8b4e8c6 commit 5da55df

File tree

5 files changed

+53
-191
lines changed

5 files changed

+53
-191
lines changed

.github/workflows/integration.yml

Lines changed: 20 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -4,126 +4,16 @@ on:
44
push:
55
branches:
66
- master
7-
pull_request:
87
schedule:
98
- cron: 30 6 * * *
109

1110
jobs:
12-
build-collection-artifact:
13-
name: Build collection
14-
runs-on: ${{ matrix.runner-os }}
15-
strategy:
16-
matrix:
17-
runner-os:
18-
- ubuntu-latest
19-
ansible-version:
20-
- git+https://github.com/ansible/ansible.git@devel
21-
runner-python-version:
22-
- 3.8
23-
steps:
24-
- uses: actions/checkout@v1
25-
- name: Set up Python ${{ matrix.runner-python-version }}
26-
uses: actions/setup-python@v1
27-
with:
28-
python-version: ${{ matrix.runner-python-version }}
29-
- name: Set up pip cache
30-
uses: actions/cache@v1
31-
with:
32-
path: ~/.cache/pip
33-
key: ${{ runner.os }}-pip-${{ github.ref }}
34-
- name: Install Ansible ${{ matrix.ansible-version }}
35-
run: >-
36-
python -m
37-
pip
38-
install
39-
--user
40-
${{ matrix.ansible-version }}
41-
- name: Build a collection tarball
42-
run: >-
43-
~/.local/bin/ansible-galaxy
44-
collection
45-
build
46-
--output-path
47-
"${GITHUB_WORKSPACE}/.cache/collection-tarballs"
48-
- name: Store migrated collection artifacts
49-
uses: actions/upload-artifact@v1
50-
with:
51-
name: >-
52-
collection
53-
path: .cache/collection-tarballs
54-
55-
sanity-test-collection-via-containers:
56-
name: Sanity Py${{ matrix.python-version }}
57-
needs:
58-
- build-collection-artifact
59-
runs-on: ${{ matrix.runner-os }}
60-
strategy:
61-
fail-fast: false
62-
matrix:
63-
runner-os:
64-
- ubuntu-latest
65-
runner-python-version:
66-
- 3.6
67-
ansible-version:
68-
- git+https://github.com/ansible/ansible.git@devel
69-
steps:
70-
- name: Set up Python ${{ matrix.runner-python-version }}
71-
uses: actions/setup-python@v1
72-
with:
73-
python-version: ${{ matrix.runner-python-version }}
74-
- name: Set up pip cache
75-
uses: actions/cache@v1
76-
with:
77-
path: ~/.cache/pip
78-
key: ${{ runner.os }}-pip-${{ github.ref }}-sanity-containers
79-
restore-keys: |
80-
${{ runner.os }}-pip-
81-
${{ runner.os }}-
82-
- name: Install Ansible ${{ matrix.ansible-version }}
83-
run: >-
84-
python -m
85-
pip
86-
install
87-
--user
88-
${{ matrix.ansible-version }}
89-
- name: Download migrated collection artifacts
90-
uses: actions/download-artifact@v1
91-
with:
92-
name: >-
93-
collection
94-
path: .cache/collection-tarballs
95-
- name: Install the collection tarball
96-
run: >-
97-
~/.local/bin/ansible-galaxy
98-
collection
99-
install
100-
.cache/collection-tarballs/*.tar.gz
101-
- name: Run collection sanity tests
102-
run: >-
103-
~/.local/bin/ansible-test
104-
sanity
105-
--color
106-
--requirements
107-
--docker
108-
-vvv
109-
working-directory: >-
110-
/home/runner/.ansible/collections/ansible_collections/ngine_io/cloudstack
111-
11211
integration-test:
11312
name: Integration test group${{matrix.group}} Py${{ matrix.python-version }}
114-
needs:
115-
- build-collection-artifact
116-
- sanity-test-collection-via-containers
117-
runs-on: ${{ matrix.runner-os }}
13+
runs-on: ubuntu-latest
11814
strategy:
11915
fail-fast: false
12016
matrix:
121-
runner-os:
122-
- ubuntu-latest
123-
runner-python-version:
124-
- 3.6
125-
ansible-version:
126-
- git+https://github.com/ansible/ansible.git@devel
12717
python-version:
12818
- 3.6
12919
- 2.7
@@ -135,40 +25,26 @@ jobs:
13525
uses: actions/checkout@v1
13626
with:
13727
path: ansible_collections/ngine_io/cloudstack
138-
- name: Set up pip cache
139-
uses: actions/cache@v1
140-
with:
141-
path: ~/.cache/pip
142-
key: ${{ runner.os }}-pip-${{ github.ref }}
143-
- name: Install Ansible ${{ matrix.ansible-version }}
144-
run: >-
145-
python -m
146-
pip
147-
install
148-
--user
149-
${{ matrix.ansible-version }}
150-
- name: Install requirements
151-
run: >-
152-
python -m
153-
pip
154-
install
155-
--user
156-
-r requirements.txt
157-
- name: Download migrated collection artifacts
158-
uses: actions/download-artifact@v1
28+
29+
- name: Set up Python ${{ matrix.python-version }}
30+
uses: actions/setup-python@v1
15931
with:
160-
name: >-
161-
collection
162-
path: .cache/collection-tarballs
163-
- name: Install collection tarball
164-
run: >-
165-
~/.local/bin/ansible-galaxy
166-
collection
167-
install
168-
${GITHUB_WORKSPACE}/.cache/collection-tarballs/*.gz
32+
python-version: ${{ matrix.python-version }}
33+
34+
- name: Install ansible and collection dependencies
35+
run: |
36+
python -m pip install --upgrade pip
37+
pip install ansible
38+
pip install -r requirements.txt
39+
40+
- name: Build and install collection
41+
run: |
42+
ansible-galaxy collection build .
43+
ansible-galaxy collection install *.gz
44+
16945
- name: Run the tests
17046
run: >-
171-
~/.local/bin/ansible-test
47+
ansible-test
17248
integration
17349
--docker
17450
-v
@@ -179,9 +55,10 @@ jobs:
17955
--continue-on-error
18056
--coverage
18157
shippable/cs/group${{ matrix.group }}/
58+
18259
- name: Generate coverage report.
18360
run: >-
184-
~/.local/bin/ansible-test
61+
ansible-test
18562
coverage xml
18663
-v
18764
--requirements

.github/workflows/publish.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v1
12+
with:
13+
path: ansible_collections/ngine_io/cloudstack
1214
- name: Set up Python
1315
uses: actions/setup-python@v1
1416
with:

.github/workflows/sanity.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Sanity
2+
on:
3+
- pull_request
4+
5+
jobs:
6+
sanity:
7+
name: Sanity (${{ matrix.ansible }})
8+
strategy:
9+
matrix:
10+
ansible:
11+
- stable-2.10
12+
- stable-2.9
13+
- devel
14+
runs-on: ubuntu-latest
15+
steps:
16+
17+
- name: Check out code
18+
uses: actions/checkout@v1
19+
with:
20+
path: ansible_collections/ngine_io/cloudstack
21+
22+
- name: Set up Python 3.6
23+
uses: actions/setup-python@v1
24+
with:
25+
python-version: 3.6
26+
27+
- name: Install ansible-base (${{ matrix.ansible }})
28+
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check
29+
30+
- name: Run sanity tests
31+
run: ansible-test sanity --docker -v --color --python 3.6

tests/sanity/ignore-2.10.txt

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +0,0 @@
1-
plugins/modules/cs_disk_offering.py validate-modules:parameter-list-no-elements
2-
plugins/modules/cs_firewall.py validate-modules:parameter-list-no-elements
3-
plugins/modules/cs_host.py validate-modules:parameter-list-no-elements
4-
plugins/modules/cs_instance.py validate-modules:parameter-list-no-elements
5-
plugins/modules/cs_ip_address.py validate-modules:parameter-list-no-elements
6-
plugins/modules/cs_iso.py validate-modules:parameter-list-no-elements
7-
plugins/modules/cs_loadbalancer_rule.py validate-modules:doc-required-mismatch
8-
plugins/modules/cs_loadbalancer_rule.py validate-modules:parameter-list-no-elements
9-
plugins/modules/cs_loadbalancer_rule_member.py validate-modules:parameter-list-no-elements
10-
plugins/modules/cs_network.py validate-modules:parameter-list-no-elements
11-
plugins/modules/cs_network_acl_rule.py validate-modules:parameter-list-no-elements
12-
plugins/modules/cs_network_offering.py validate-modules:parameter-list-no-elements
13-
plugins/modules/cs_physical_network.py validate-modules:parameter-list-no-elements
14-
plugins/modules/cs_portforward.py validate-modules:parameter-list-no-elements
15-
plugins/modules/cs_project.py validate-modules:parameter-list-no-elements
16-
plugins/modules/cs_resourcelimit.py validate-modules:invalid-ansiblemodule-schema
17-
plugins/modules/cs_service_offering.py validate-modules:parameter-list-no-elements
18-
plugins/modules/cs_storage_pool.py validate-modules:parameter-list-no-elements
19-
plugins/modules/cs_template.py validate-modules:parameter-list-no-elements
20-
plugins/modules/cs_vmsnapshot.py validate-modules:parameter-list-no-elements
21-
plugins/modules/cs_volume.py validate-modules:parameter-list-no-elements
22-
plugins/modules/cs_vpc.py validate-modules:parameter-list-no-elements
23-
plugins/modules/cs_vpc_offering.py validate-modules:parameter-list-no-elements
24-
plugins/modules/cs_vpn_customer_gateway.py validate-modules:parameter-list-no-elements

tests/sanity/ignore-2.9.txt

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +0,0 @@
1-
plugins/modules/cs_disk_offering.py validate-modules:parameter-list-no-elements
2-
plugins/modules/cs_firewall.py validate-modules:parameter-list-no-elements
3-
plugins/modules/cs_host.py validate-modules:parameter-list-no-elements
4-
plugins/modules/cs_instance.py validate-modules:parameter-list-no-elements
5-
plugins/modules/cs_ip_address.py validate-modules:parameter-list-no-elements
6-
plugins/modules/cs_iso.py validate-modules:parameter-list-no-elements
7-
plugins/modules/cs_loadbalancer_rule.py validate-modules:doc-required-mismatch
8-
plugins/modules/cs_loadbalancer_rule.py validate-modules:parameter-list-no-elements
9-
plugins/modules/cs_loadbalancer_rule_member.py validate-modules:parameter-list-no-elements
10-
plugins/modules/cs_network.py validate-modules:parameter-list-no-elements
11-
plugins/modules/cs_network_acl_rule.py validate-modules:parameter-list-no-elements
12-
plugins/modules/cs_network_offering.py validate-modules:parameter-list-no-elements
13-
plugins/modules/cs_physical_network.py validate-modules:parameter-list-no-elements
14-
plugins/modules/cs_portforward.py validate-modules:parameter-list-no-elements
15-
plugins/modules/cs_project.py validate-modules:parameter-list-no-elements
16-
plugins/modules/cs_resourcelimit.py validate-modules:invalid-ansiblemodule-schema
17-
plugins/modules/cs_service_offering.py validate-modules:parameter-list-no-elements
18-
plugins/modules/cs_storage_pool.py validate-modules:parameter-list-no-elements
19-
plugins/modules/cs_template.py validate-modules:parameter-list-no-elements
20-
plugins/modules/cs_vmsnapshot.py validate-modules:parameter-list-no-elements
21-
plugins/modules/cs_volume.py validate-modules:parameter-list-no-elements
22-
plugins/modules/cs_vpc.py validate-modules:parameter-list-no-elements
23-
plugins/modules/cs_vpc_offering.py validate-modules:parameter-list-no-elements
24-
plugins/modules/cs_vpn_customer_gateway.py validate-modules:parameter-list-no-elements

0 commit comments

Comments
 (0)