Skip to content

Commit d7e6b4c

Browse files
committed
test: update GitHub Actions and integration tests
- Added condition to trigger workflow on specific file changes. - Introduced steps to retrieve admin password and run integration tests. - Modified test assertions for download tasks. - Created new task file for raw component testing.
1 parent 8fa3961 commit d7e6b4c

File tree

3 files changed

+31
-7
lines changed

3 files changed

+31
-7
lines changed

.github/workflows/test-module.yml

+17
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
jobs:
1111
module:
1212
name: Sanity & Unit Tests
13+
#if: github.event_name == 'workflow_dispatch' || contains(github.event.commits.*.modified, 'plugins/') || contains(github.event.commits.*.modified, 'tests/unit/')
1314
runs-on: ubuntu-latest
1415

1516
steps:
@@ -146,6 +147,22 @@ jobs:
146147
run: |
147148
timeout 300 bash -c 'until curl -f http://localhost:8081/service/rest/v1/status; do sleep 5; done'
148149
150+
- name: Get initial admin password
151+
run: |
152+
ADMIN_PASS=$(docker exec $(docker ps -q) cat /nexus-data/admin.password)
153+
echo "NEXUS_ADMIN_PASSWORD=${ADMIN_PASS}" >> $GITHUB_ENV
154+
155+
- name: Run integration tests
156+
run: |
157+
cd /home/runner/.ansible/collections/ansible_collections/cloudkrafter/nexus
158+
ansible-test integration raw_component --docker default --coverage --continue-on-error -v
159+
env:
160+
PY_COLORS: '1'
161+
ANSIBLE_FORCE_COLOR: '1'
162+
NEXUS_URL: 'http://localhost:8081'
163+
NEXUS_USERNAME: 'admin'
164+
NEXUS_PASSWORD: ${{ env.NEXUS_ADMIN_PASSWORD }}
165+
149166
- name: Generate code coverage report
150167
run: |
151168
cd /home/runner/.ansible/collections/ansible_collections/cloudkrafter/nexus

tests/integration/targets/download/tasks/main.yml

+1-7
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,11 @@
3131
dest: /tmp
3232
arch: invalid_arch
3333
register: missing_state
34-
ignore_errors: true
35-
36-
- name: debug
37-
debug:
38-
var: missing_state
3934

4035
- name: invalid
4136
assert:
4237
that:
43-
- download_invalid_arch is failed
44-
- download_invalid_arch,msg == "Invalid state:"
38+
- missing_state.failed
4539

4640
# - name: Download Latest Nexus
4741
# cloudkrafter.nexus.download:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
- name: show env vars
2+
debug:
3+
var: ansible_env
4+
5+
# - name: Upload artifact
6+
# cloudkrafter.nexus.raw_component:
7+
# src: /tmp/nexus-latest.tar.gz
8+
# dest: /nexus
9+
# name: nexus-latest.tar.gz
10+
# repository: https://host.docker.internal:9091/repository/raw-hosted
11+
# username: admin
12+
# password: changeme
13+
# validate_certs: false

0 commit comments

Comments
 (0)