Skip to content

Commit

Permalink
activation tests fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Akasurde committed Aug 19, 2024
1 parent 08d98f5 commit 47c85b2
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 31 deletions.
1 change: 1 addition & 0 deletions .config/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,4 @@ hdrs
testuser
testsecret
keygen
testpass
24 changes: 18 additions & 6 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ jobs:
ansible-version:
- "milestone"

env:
CONTROLLER_URL: "https://localhost:8443"
CONTROLLER_USERNAME: "admin"
CONTROLLER_PASSWORD: "testpass"
CONTROLLER_VERIFY_SSL: false

steps:
- name: Checkout ansible/eda
uses: actions/checkout@v3
Expand Down Expand Up @@ -66,6 +60,24 @@ jobs:
--disable-pip-version-check
shell: bash

- name: Print the ansible version
run: ansible --version

- name: Create integration_config.yml
env:
CONTROLLER_HOST: ${{ env.CONTROLLER_HOST }}
CONTROLLER_USERNAME: ${{ env.CONTROLLER_USERNAME }}
CONTROLLER_PASSWORD: ${{ secrets.CONTROLLER_PASSWORD }}
CONTROLLER_VERIFY_SSL: ${{ env.CONTROLLER_VERIFY_SSL }}
run: |
touch tests/integration/integration_config.yml
echo "controller_host: '${{ env.CONTROLLER_HOST }}'" >> tests/integration/integration_config.yml
echo "controller_username: '${{ env.CONTROLLER_USERNAME }}'" >> tests/integration/integration_config.yml
echo "controller_password: '${{ secrets.CONTROLLER_PASSWORD }}'" >> tests/integration/integration_config.yml
echo "controller_verify_ssl: '${{ env.CONTROLLER_VERIFY_SSL }}'" >> tests/integration/integration_config.yml
cat tests/integration/integration_config.yml
working-directory: ansible_collections/ansible/eda

- name: Run integration tests
run: ansible-test integration -v
working-directory: ansible_collections/ansible/eda
4 changes: 4 additions & 0 deletions tests/integration/integration_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
controller_host: "https://localhost:8443"
controller_username: "admin"
controller_password: "testpass"
controller_verify_ssl: false
27 changes: 2 additions & 25 deletions tests/integration/targets/activation/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
---
- block:
- set_fact:
credential_defaults: &credential_defaults
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
controller_host: "{{ controller_host }}"
validate_certs: false
- debug:
msg: "{{ controller_host }}"

- name: Generate a random_string for the test
set_fact:
Expand All @@ -32,15 +28,13 @@

- name: Create an AWX controller token
ansible.eda.controller_token:
<<: *credential_defaults
name: "{{ awx_token_name }}"
description: "A test AWX controller token description"
token: "{{ token_value }}"
state: present

- name: Create a new credential type
ansible.eda.credential_type:
<<: *credential_defaults
name: "{{ credential_type_name }}"
state: present
description: "A test credential type"
Expand Down Expand Up @@ -88,7 +82,6 @@

- name: Create a new SCM credential
ansible.eda.credential:
<<: *credential_defaults
name: "{{ credential_name }}"
state: present
credential_type_name: Source Control
Expand All @@ -107,7 +100,6 @@

- name: Create a new project
ansible.eda.project:
<<: *credential_defaults
name: "{{ project_name }}"
description: "Test Project Description"
url: "{{ scm_url }}"
Expand All @@ -123,7 +115,6 @@

- name: Create a new decision environment
ansible.eda.decision_environment:
<<: *credential_defaults
name: "{{ decision_env_name }}"
description: "Test Decision Environment Description"
credential: "{{ credential_name }}"
Expand All @@ -132,7 +123,6 @@

- name: Create a new rulebook activation in check mode
ansible.eda.activation:
<<: *credential_defaults
name: "{{ activation_name }}"
description: "Example Activation description"
project_name: "{{ project_name }}"
Expand All @@ -150,7 +140,6 @@

- name: Create a new rulebook activation
ansible.eda.activation:
<<: *credential_defaults
name: "{{ activation_name }}"
description: "Example Activation description"
project_name: "{{ project_name }}"
Expand All @@ -167,7 +156,6 @@

- name: Create a new rulebook activation again
ansible.eda.activation:
<<: *credential_defaults
name: "{{ activation_name }}"
description: "Example Activation description"
project_name: "{{ project_name }}"
Expand All @@ -185,16 +173,13 @@

- name: Get information about the rulebook activation
ansible.eda.activation_info:
<<: *credential_defaults
name: "{{ activation_name }}"

- name: List all the rulebook activations
ansible.eda.activation_info:
<<: *credential_defaults

- name: Delete project
ansible.eda.project:
<<: *credential_defaults
name: "{{ project_name }}"
state: absent
register: project_deletion
Expand All @@ -207,7 +192,6 @@

- name: Delete credential
ansible.eda.credential:
<<: *credential_defaults
name: "{{ credential_name }}"
state: absent
register: credential_deletion
Expand All @@ -220,49 +204,42 @@

- name: Delete rulebook activation
ansible.eda.activation:
<<: *credential_defaults
name: "{{ activation_name }}"
state: absent

always:
- name: Delete AWX token
ansible.eda.controller_token:
<<: *credential_defaults
name: "{{ awx_token_name }}"
state: absent
ignore_errors: true

- name: Delete project
ansible.eda.project:
<<: *credential_defaults
name: "{{ project_name }}"
state: absent
ignore_errors: true

- name: Delete decision environment
ansible.eda.decision_environment:
<<: *credential_defaults
name: "{{ decision_env_name }}"
state: absent
ignore_errors: true

- name: Delete credential
ansible.eda.credential:
<<: *credential_defaults
name: "{{ credential_name }}"
state: absent
ignore_errors: true

- name: Delete credential type
ansible.eda.credential_type:
<<: *credential_defaults
name: "{{ credential_type_name }}"
state: absent
ignore_errors: true

- name: Delete rulebook activation
ansible.eda.activation:
<<: *credential_defaults
name: "{{ activation_name }}"
state: absent
ignore_errors: true

0 comments on commit 47c85b2

Please sign in to comment.