Move integration test suite from molecule to ansible-test (#392)

Move integration test suite from molecule to ansible-test

SUMMARY

molecule has been replaced with ansible-test
some test cases have been updated

k8s_apply : remove duplicated tasks increasing the running time of the test
helm: use different namespaces for different test cases in order to wait for the namespace deletion before moving to the next test.
all: remove wait: yes at the end of each test when deleting namespace, the role used to create namespace will ensure that it is deleted before if existing.


ISSUE TYPE


Feature Pull Request

COMPONENT NAME

integration testing

Reviewed-by: Mike Graves <mgraves@redhat.com>
Reviewed-by: Gonéri Le Bouder <goneri@lebouder.net>
Reviewed-by: None <None>
This commit is contained in:
abikouo
2022-03-11 09:03:00 +01:00
committed by GitHub
parent db78d3a505
commit fd61f8b15d
199 changed files with 1172 additions and 1835 deletions

View File

@@ -0,0 +1,2 @@
time=22
k8s

View File

@@ -0,0 +1,2 @@
---
test_namespace: "crd"

View File

@@ -0,0 +1,21 @@
---
apiVersion: certmanager.k8s.io/v1alpha1
kind: Certificate
metadata:
name: acme-crt
spec:
secretName: acme-crt-secret
dnsNames:
- foo.example.com
- bar.example.com
acme:
config:
- ingressClass: nginx
domains:
- foo.example.com
- bar.example.com
issuerRef:
name: letsencrypt-prod
# We can reference ClusterIssuers by changing the kind here.
# The default value is Issuer (i.e. a locally namespaced Issuer)
kind: Issuer

View File

@@ -0,0 +1,15 @@
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: certificates.certmanager.k8s.io
spec:
group: certmanager.k8s.io
version: v1alpha1
scope: Namespaced
names:
kind: Certificate
plural: certificates
shortNames:
- cert
- certs

View File

@@ -0,0 +1,3 @@
---
dependencies:
- setup_namespace

View File

@@ -0,0 +1,61 @@
---
- block:
- name: Install custom resource definitions
k8s:
definition: "{{ lookup('file', 'setup-crd.yml') }}"
- name: Pause 5 seconds to avoid race condition
pause:
seconds: 5
- name: Create custom resource definition
k8s:
definition: "{{ lookup('file', 'crd-resource.yml') }}"
namespace: "{{ test_namespace }}"
apply: "{{ create_crd_with_apply | default(omit) }}"
register: create_crd
- name: Patch custom resource definition
k8s:
definition: "{{ lookup('file', 'crd-resource.yml') }}"
namespace: "{{ test_namespace }}"
register: recreate_crd
ignore_errors: yes
- name: Assert that recreating crd is as expected
assert:
that:
- recreate_crd is not failed
- block:
- name: Recreate custom resource definition with merge_type
k8s:
definition: "{{ lookup('file', 'crd-resource.yml') }}"
merge_type:
- merge
namespace: "{{ test_namespace }}"
register: recreate_crd_with_merge
- name: Recreate custom resource definition with merge_type list
k8s:
definition: "{{ lookup('file', 'crd-resource.yml') }}"
merge_type:
- strategic-merge
- merge
namespace: "{{ test_namespace }}"
register: recreate_crd_with_merge_list
when: recreate_crd is successful
- name: Remove crd
k8s:
definition: "{{ lookup('file', 'crd-resource.yml') }}"
namespace: "{{ test_namespace }}"
state: absent
always:
- name: Remove crd namespace
k8s:
kind: Namespace
name: "{{ test_namespace }}"
state: absent