Skip to content

Commit a158609

Browse files
authored
Fix/rework molecule tests (#2)
* migrated all tests from old role repos * limited builds on branches and pr * fixed cgroup issues * enhanced linter warn and skip configs * added manual trigger for builds
1 parent 6819448 commit a158609

File tree

119 files changed

+699
-442
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+699
-442
lines changed

.ansible-lint

Lines changed: 0 additions & 8 deletions
This file was deleted.

.config/ansible-lint.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
warn_list:
2+
- schema[meta]
3+
- name[missing]
4+
- package-latest
5+
- jinja[spacing]
6+
- experimental # all rules tagged as experimental
7+
- key-order[task] # Ensure specific order of keys in mappings.
8+
- name[casing]
9+
skip_list:
10+
- '106'
11+
- 'command-instead-of-module'
12+
- 'risky-shell-pipe'
13+
- 'role-name'
14+
- 'line-length'
15+
- 'fqcn-builtins'
16+
- yaml # Violations reported by yamllint.

.github/workflows/molecule.yml renamed to .github/workflows/test_full_stack.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
---
2-
name: Molecule Test
2+
name: Test ElasticStack
33
on:
44
push:
55
tags:
6-
- v*
6+
- '*'
77
branches:
88
- main
9-
- 'feature/**'
10-
- 'fix/**'
11-
- '!doc/**'
129
pull_request:
1310
branches:
1411
- 'feature/**'
@@ -24,10 +21,13 @@ jobs:
2421
COLLECTION_NAME: elasticstack
2522

2623
strategy:
24+
fail-fast: false
2725
max-parallel: 1
2826
matrix:
29-
distro: [ubuntu2204]
30-
scenario: [default, cluster, cluster-oss, no-security]
27+
distro:
28+
- ubuntu2204
29+
scenario:
30+
- elasticstack_default
3131

3232
steps:
3333
- name: Check out code
@@ -48,7 +48,6 @@ jobs:
4848
mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE
4949
cp -a ../ansible-collection-$COLLECTION_NAME ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME
5050
51-
5251
- name: Test with molecule
5352
run: |
5453
molecule test -s ${{ matrix.scenario }}
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
---
2+
name: Test Role beats
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
logLevel:
7+
description: 'Log level'
8+
required: true
9+
default: 'warning'
10+
type: choice
11+
options:
12+
- info
13+
- warning
14+
- debug
15+
push:
16+
branches:
17+
- 'feature/**'
18+
- 'fix/**'
19+
- '!doc/**'
20+
paths:
21+
- 'roles/beats/**'
22+
- '.github/workflows/test_role_beats.yml'
23+
- 'molecule/beats_**'
24+
- '.config/ansible-lint.yml'
25+
- '.yamllint'
26+
pull_request:
27+
branches:
28+
- 'feature/**'
29+
- 'fix/**'
30+
- '!doc/**'
31+
paths:
32+
- 'roles/beats/**'
33+
- '.github/workflows/test_role_beats.yml'
34+
- 'molecule/beats_**'
35+
- '.config/ansible-lint.yml'
36+
- '.yamllint'
37+
38+
jobs:
39+
lint:
40+
runs-on: ubuntu-latest
41+
steps:
42+
- name: Check out the codebase.
43+
uses: actions/checkout@v3
44+
45+
- name: Set up Python 3.
46+
uses: actions/setup-python@v4
47+
with:
48+
python-version: '3.x'
49+
50+
- name: Install test dependencies.
51+
run: |
52+
python3 -m pip install --upgrade pip
53+
python3 -m pip install yamllint ansible-lint
54+
55+
- name: Lint code.
56+
run: |
57+
yamllint roles/beats/
58+
ansible-lint roles/beats/
59+
60+
build:
61+
needs: lint
62+
runs-on: ubuntu-latest
63+
64+
env:
65+
COLLECTION_NAMESPACE: NETWAYS
66+
COLLECTION_NAME: elasticstack
67+
68+
strategy:
69+
fail-fast: false
70+
max-parallel: 1
71+
matrix:
72+
distro: [debian11, rockylinux8, ubuntu2204]
73+
scenario: [beats_default, beats_full_stack, beats_peculiar]
74+
75+
steps:
76+
- name: Check out code
77+
uses: actions/checkout@v3
78+
79+
- name: Set up Python 3.8
80+
uses: actions/setup-python@v3
81+
with:
82+
python-version: 3.8
83+
84+
- name: Install dependencies
85+
run: |
86+
python3 -m pip install --upgrade pip
87+
python3 -m pip install -r requirements-test.txt
88+
89+
- name: Install collection
90+
run: |
91+
mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE
92+
cp -a ../ansible-collection-$COLLECTION_NAME ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME
93+
94+
- name: Test with molecule
95+
run: |
96+
molecule test -s ${{ matrix.scenario }}
97+
env:
98+
MOLECULE_DISTRO: ${{ matrix.distro }}
99+
PY_COLORS: '1'
100+
ANSIBLE_FORCE_COLOR: '1'
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
---
2+
name: Test Role elasticsearch
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
logLevel:
7+
description: 'Log level'
8+
required: true
9+
default: 'warning'
10+
type: choice
11+
options:
12+
- info
13+
- warning
14+
- debug
15+
push:
16+
branches:
17+
- 'feature/**'
18+
- 'fix/**'
19+
- '!doc/**'
20+
paths:
21+
- 'roles/elasticsearch/**'
22+
- '.github/workflows/test_role_elasticsearch.yml'
23+
- 'molecule/elasticsearch_**'
24+
- '.config/ansible-lint.yml'
25+
- '.yamllint'
26+
pull_request:
27+
branches:
28+
- 'feature/**'
29+
- 'fix/**'
30+
- '!doc/**'
31+
paths:
32+
- 'roles/elasticsearch/**'
33+
- '.github/workflows/test_role_elasticsearch.yml'
34+
- 'molecule/elasticsearch_**'
35+
- '.config/ansible-lint.yml'
36+
- '.yamllint'
37+
38+
jobs:
39+
lint:
40+
runs-on: ubuntu-latest
41+
steps:
42+
- name: Check out the codebase.
43+
uses: actions/checkout@v3
44+
45+
- name: Set up Python 3.
46+
uses: actions/setup-python@v4
47+
with:
48+
python-version: '3.x'
49+
50+
- name: Install test dependencies.
51+
run: |
52+
python3 -m pip install --upgrade pip
53+
python3 -m pip install yamllint ansible-lint
54+
55+
- name: Lint code.
56+
run: |
57+
yamllint roles/elasticsearch/
58+
ansible-lint roles/elasticsearch/
59+
60+
build:
61+
needs: lint
62+
runs-on: ubuntu-latest
63+
64+
env:
65+
COLLECTION_NAMESPACE: NETWAYS
66+
COLLECTION_NAME: elasticstack
67+
68+
strategy:
69+
fail-fast: false
70+
max-parallel: 1
71+
matrix:
72+
distro: [ubuntu2204]
73+
scenario: [elasticsearch_default, elasticsearch_cluster, elasticsearch_cluster-oss, elasticsearch_no-security]
74+
75+
steps:
76+
- name: Check out code
77+
uses: actions/checkout@v3
78+
79+
- name: Set up Python 3.8
80+
uses: actions/setup-python@v3
81+
with:
82+
python-version: 3.8
83+
84+
- name: Install dependencies
85+
run: |
86+
python3 -m pip install --upgrade pip
87+
python3 -m pip install -r requirements-test.txt
88+
89+
- name: Install collection
90+
run: |
91+
mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE
92+
cp -a ../ansible-collection-$COLLECTION_NAME ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME
93+
94+
- name: Test with molecule
95+
run: |
96+
molecule test -s ${{ matrix.scenario }}
97+
env:
98+
MOLECULE_DISTRO: ${{ matrix.distro }}
99+
PY_COLORS: '1'
100+
ANSIBLE_FORCE_COLOR: '1'
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
---
2+
name: Test Role Kibana
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
logLevel:
7+
description: 'Log level'
8+
required: true
9+
default: 'warning'
10+
type: choice
11+
options:
12+
- info
13+
- warning
14+
- debug
15+
push:
16+
branches:
17+
- 'feature/**'
18+
- 'fix/**'
19+
- '!doc/**'
20+
paths:
21+
- 'roles/kibana/**'
22+
- '.github/workflows/test_role_kibana.yml'
23+
- 'molecule/kibana_**'
24+
- '.config/ansible-lint.yml'
25+
- '.yamllint'
26+
pull_request:
27+
branches:
28+
- 'feature/**'
29+
- 'fix/**'
30+
- '!doc/**'
31+
paths:
32+
- 'roles/kibana/**'
33+
- '.github/workflows/test_role_kibana.yml'
34+
- 'molecule/kibana_**'
35+
- '.config/ansible-lint.yml'
36+
- '.yamllint'
37+
38+
jobs:
39+
lint:
40+
runs-on: ubuntu-latest
41+
steps:
42+
- name: Check out the codebase.
43+
uses: actions/checkout@v3
44+
45+
- name: Set up Python 3.
46+
uses: actions/setup-python@v4
47+
with:
48+
python-version: '3.x'
49+
50+
- name: Install test dependencies.
51+
run: |
52+
python3 -m pip install --upgrade pip
53+
python3 -m pip install yamllint ansible-lint
54+
55+
- name: Lint code.
56+
run: |
57+
yamllint roles/kibana/
58+
ansible-lint roles/kibana/
59+
60+
build:
61+
needs: lint
62+
runs-on: ubuntu-latest
63+
64+
env:
65+
COLLECTION_NAMESPACE: NETWAYS
66+
COLLECTION_NAME: elasticstack
67+
68+
strategy:
69+
fail-fast: false
70+
max-parallel: 3
71+
matrix:
72+
distro: [ubuntu2204]
73+
scenario: [kibana_default, kibana_full_stack, kibana_full_stack-oss]
74+
75+
steps:
76+
- name: Check out code
77+
uses: actions/checkout@v2
78+
79+
- name: Set up Python 3.8
80+
uses: actions/setup-python@v2
81+
with:
82+
python-version: 3.8
83+
84+
- name: Install dependencies
85+
run: |
86+
python3 -m pip install --upgrade pip
87+
python3 -m pip install -r requirements-test.txt
88+
89+
- name: Install collection
90+
run: |
91+
mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE
92+
cp -a ../ansible-collection-$COLLECTION_NAME ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME
93+
94+
- name: Test with molecule
95+
run: |
96+
molecule test -s ${{ matrix.scenario }}
97+
env:
98+
MOLECULE_DISTRO: ${{ matrix.distro }}

0 commit comments

Comments
 (0)