Add smoke test that verifies that basic jobs work

This commit is contained in:
Shane McDonald
2021-09-29 18:38:48 -04:00
parent eaa4d33aea
commit 86e0cf884f
5 changed files with 66 additions and 6 deletions

View File

@@ -8,6 +8,8 @@ spec:
foo: bar
deployment_type: awx
ingress_type: ingress
ingress_annotations: |
kubernetes.io/ingress.class: nginx
web_resource_requirements:
requests:
cpu: 250m

View File

@@ -13,7 +13,18 @@
vars:
cr_file: 'awx_v1beta1_awx.yaml'
# - name: Add assertions here
# assert:
# that: false
# fail_msg: FIXME Add real assertions for your operator
- name: Obtain generated admin password
k8s_info:
namespace: '{{ namespace }}'
kind: Secret
name: example-awx-admin-password
register: admin_pw_secret
- name: Launch Demo Job Template
awx.awx.job_launch:
name: Demo Job Template
wait: yes
validate_certs: no
controller_host: localhost
controller_username: admin
controller_password: "{{ admin_pw_secret.resources[0].data.password | b64decode }}"

View File

@@ -5,4 +5,23 @@
gather_facts: false
tasks:
- name: Create test kind cluster
command: kind create cluster --name osdk-test --kubeconfig {{ kubeconfig }}
shell: |
cat <<EOF | kind create cluster --name osdk-test --kubeconfig {{ kubeconfig }} --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
extraPortMappings:
- containerPort: 80
hostPort: 80
protocol: TCP
- containerPort: 443
hostPort: 443
protocol: TCP
EOF

View File

@@ -13,7 +13,6 @@ platforms:
provisioner:
name: ansible
playbooks:
prepare: ../default/prepare.yml
verify: ../default/verify.yml
lint: |
set -e

29
molecule/kind/prepare.yml Normal file
View File

@@ -0,0 +1,29 @@
---
- name: Prepare
hosts: localhost
connection: local
gather_facts: false
collections:
- kubernetes.core
vars:
nginx_ingress_definition: 'https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml'
tasks:
- name: Install NGINX ingress
k8s:
definition: |
{{ lookup('url', nginx_ingress_definition, split_lines=False) | from_yaml_all }}
- name: Wait for NGINX ingress to become available
k8s_info:
kind: Pod
namespace: ingress-nginx
label_selectors:
- app.kubernetes.io/component=controller
wait: yes
wait_timeout: 30
wait_condition:
type: Ready
register: result # For some reason, this task always fails on the first try...
until: result is not failed
- import_playbook: ../default/prepare.yml