From 33c8f741228f72cbf877917e8d4eccc0d1281120 Mon Sep 17 00:00:00 2001 From: Guido Grazioli Date: Thu, 7 Apr 2022 14:07:45 +0200 Subject: [PATCH] add molecule test for keycloak_quarkus --- molecule/quarkus/converge.yml | 39 +++++++++++++++++++++++ molecule/quarkus/molecule.yml | 53 +++++++++++++++++++++++++++++++ molecule/quarkus/prepare.yml | 12 +++++++ molecule/quarkus/requirements.yml | 10 ++++++ molecule/quarkus/roles | 1 + molecule/quarkus/verify.yml | 11 +++++++ 6 files changed, 126 insertions(+) create mode 100644 molecule/quarkus/converge.yml create mode 100644 molecule/quarkus/molecule.yml create mode 100644 molecule/quarkus/prepare.yml create mode 100644 molecule/quarkus/requirements.yml create mode 120000 molecule/quarkus/roles create mode 100644 molecule/quarkus/verify.yml diff --git a/molecule/quarkus/converge.yml b/molecule/quarkus/converge.yml new file mode 100644 index 0000000..452212b --- /dev/null +++ b/molecule/quarkus/converge.yml @@ -0,0 +1,39 @@ +--- +- name: Converge + hosts: all + vars: + keycloak_quarkus_admin_pass: "remembertochangeme" + keycloak_realm: TestRealm + roles: + - role: keycloak_quarkus + - role: keycloak_realm + keycloak_context: '' + keycloak_admin_password: "remembertochangeme" + keycloak_client_default_roles: + - TestRoleAdmin + - TestRoleUser + keycloak_client_users: + - username: TestUser + password: password + client_roles: + - client: TestClient + role: TestRoleUser + realm: "{{ keycloak_realm }}" + - username: TestAdmin + password: password + client_roles: + - client: TestClient + role: TestRoleUser + realm: "{{ keycloak_realm }}" + - client: TestClient + role: TestRoleAdmin + realm: "{{ keycloak_realm }}" + keycloak_realm: TestRealm + keycloak_clients: + - name: TestClient + roles: "{{ keycloak_client_default_roles }}" + realm: "{{ keycloak_realm }}" + public_client: "{{ keycloak_client_public }}" + web_origins: "{{ keycloak_client_web_origins }}" + users: "{{ keycloak_client_users }}" + client_id: TestClient diff --git a/molecule/quarkus/molecule.yml b/molecule/quarkus/molecule.yml new file mode 100644 index 0000000..ea8ad61 --- /dev/null +++ b/molecule/quarkus/molecule.yml @@ -0,0 +1,53 @@ +--- +dependency: + name: shell + command: ansible-galaxy collection install -r molecule/default/requirements.yml -p $HOME/.ansible/collections --force-with-deps +driver: + name: docker +lint: | + ansible-lint --version + ansible-lint -v +platforms: + - name: instance + image: registry.access.redhat.com/ubi8/ubi-init:latest + pre_build_image: true + privileged: true + command: "/usr/sbin/init" + port_bindings: + - "8080/tcp" + - "8443/tcp" + - "8009/tcp" +provisioner: + name: ansible + config_options: + defaults: + interpreter_python: auto_silent + ssh_connection: + pipelining: false + playbooks: + prepare: prepare.yml + converge: converge.yml + verify: verify.yml + inventory: + host_vars: + localhost: + ansible_python_interpreter: "{{ ansible_playbook_python }}" + env: + ANSIBLE_FORCE_COLOR: "true" +verifier: + name: ansible +scenario: + test_sequence: + - dependency + - lint + - cleanup + - destroy + - syntax + - create + - prepare + - converge + - idempotence + - side_effect + - verify + - cleanup + - destroy diff --git a/molecule/quarkus/prepare.yml b/molecule/quarkus/prepare.yml new file mode 100644 index 0000000..03433c0 --- /dev/null +++ b/molecule/quarkus/prepare.yml @@ -0,0 +1,12 @@ +--- +- name: Prepare + hosts: all + tasks: + - name: Disable beta repos + ansible.builtin.command: yum config-manager --disable '*beta*' + ignore_errors: yes + + - name: Install sudo + ansible.builtin.yum: + name: sudo + state: present diff --git a/molecule/quarkus/requirements.yml b/molecule/quarkus/requirements.yml new file mode 100644 index 0000000..9aa3437 --- /dev/null +++ b/molecule/quarkus/requirements.yml @@ -0,0 +1,10 @@ +--- +collections: + - name: middleware_automation.redhat_csp_download + version: ">=1.2.1" + - name: middleware_automation.wildfly + version: ">=0.0.5" + - name: community.general + - name: community.docker + version: ">=1.9.1" + diff --git a/molecule/quarkus/roles b/molecule/quarkus/roles new file mode 120000 index 0000000..b741aa3 --- /dev/null +++ b/molecule/quarkus/roles @@ -0,0 +1 @@ +../../roles \ No newline at end of file diff --git a/molecule/quarkus/verify.yml b/molecule/quarkus/verify.yml new file mode 100644 index 0000000..ef973cd --- /dev/null +++ b/molecule/quarkus/verify.yml @@ -0,0 +1,11 @@ +--- +- name: Verify + hosts: all + tasks: + - name: Populate service facts + ansible.builtin.service_facts: + - name: Check if keycloak service started + ansible.builtin.assert: + that: + - ansible_facts.services["keycloak.service"]["state"] == "running" + - ansible_facts.services["keycloak.service"]["status"] == "enabled"