diff --git a/test/integration/targets/k8s_raw/aliases b/test/integration/targets/k8s_raw/aliases new file mode 100644 index 00000000000..cf8f3653184 --- /dev/null +++ b/test/integration/targets/k8s_raw/aliases @@ -0,0 +1,2 @@ +cloud/openshift +posix/ci/cloud/group4/openshift diff --git a/test/integration/targets/k8s_raw/tasks/main.yml b/test/integration/targets/k8s_raw/tasks/main.yml new file mode 100644 index 00000000000..cdb8ce48da8 --- /dev/null +++ b/test/integration/targets/k8s_raw/tasks/main.yml @@ -0,0 +1,128 @@ +- name: Install requirements + pip: + name: openshift + +- name: Create a namespace + k8s_raw: + name: testing + kind: namespace + register: output + +- name: show output + debug: + var: output + +- name: Create a service + k8s_raw: + state: present + resource_definition: &svc + apiVersion: v1 + kind: Service + metadata: + name: web + namespace: testing + labels: + app: galaxy + service: web + spec: + selector: + app: galaxy + service: web + ports: + - protocol: TCP + targetPort: 8000 + name: port-8000-tcp + port: 8000 + register: output + +- name: show output + debug: + var: output + +- name: Create the service again + k8s_raw: + state: present + resource_definition: *svc + register: output + +- name: Service creation should be idempotent + assert: + that: not output.changed + +- name: Create PVC + k8s_raw: + state: present + inline: &pvc + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: elastic-volume + namespace: testing + spec: + resources: + requests: + storage: 5Gi + accessModes: + - ReadWriteOnce + +- name: Show output + debug: + var: output + +- name: Create the PVC again + k8s_raw: + state: present + inline: *pvc + +- name: PVC creation should be idempotent + assert: + that: not output.changed + +- name: Create deployment + k8s_raw: + state: present + inline: &dc + apiVersion: Apps/V1Beta1 + kind: Deployment + metadata: + name: elastic + labels: + app: galaxy + service: elastic + namespace: testing + spec: + template: + metadata: + labels: + app: galaxy + service: elastic + spec: + containers: + - name: elastic + volumeMounts: + - mountPath: /usr/share/elasticsearch/data + name: elastic-volume + command: ['elasticsearch'] + image: 'ansible/galaxy-elasticsearch:2.4.6' + volumes: + - name: elastic-volume + persistentVolumeClaim: + claimName: elastic-volume + replicas: 1 + strategy: + type: RollingUpdate + register: output + +- name: Show output + debug: + var: output + +- name: Create deployment again + k8s_raw: + state: present + inline: *dc + register: output + +- name: Deployment creation should be idempotent + assert: + that: not output.changed diff --git a/test/integration/targets/openshift_raw/tasks/main.yml b/test/integration/targets/openshift_raw/tasks/main.yml index 1a133baddb2..8e792315293 100644 --- a/test/integration/targets/openshift_raw/tasks/main.yml +++ b/test/integration/targets/openshift_raw/tasks/main.yml @@ -18,7 +18,7 @@ - name: Create a service openshift_raw: state: present - resource_definition: + resource_definition: &svc apiVersion: v1 kind: Service metadata: @@ -42,13 +42,15 @@ debug: var: output -- name: Delete an existing PVC +- name: Create the service again openshift_raw: - name: web - namespace: testing - api: v1 - kind: persistent_volume_claim - state: absent + state: present + resource_definition: *svc + register: output + +- name: Service creation should be idempotent + assert: + that: not output.changed - name: Create PVC openshift_raw: @@ -70,28 +72,15 @@ debug: var: output -- name: Create PVC +- name: Create the PVC again openshift_raw: state: present inline: *pvc - register: output - -- name: Show output - debug: - var: output -- name: PVC should be idempotent +- name: PVC creation should be idempotent assert: that: not output.changed -- name: Delete an existing deployment config - openshift_raw: - name: elastic - namespace: testing - api: v1 - kind: DeploymentConfig - state: absent - - name: Create deployment config openshift_raw: state: present @@ -121,7 +110,7 @@ volumes: - name: elastic-volume persistentVolumeClaim: - claimName: elastic-volume + claimName: elastic-volume replicas: 1 strategy: type: Rolling @@ -130,3 +119,13 @@ - name: Show output debug: var: output + +- name: Create deployment config again + openshift_raw: + state: present + inline: *dc + register: output + +- name: DC creation should be idempotent + assert: + that: not output.changed diff --git a/test/runner/lib/cloud/openshift.py b/test/runner/lib/cloud/openshift.py index 93cf54da4c3..acfb6758d86 100644 --- a/test/runner/lib/cloud/openshift.py +++ b/test/runner/lib/cloud/openshift.py @@ -44,7 +44,7 @@ class OpenShiftCloudProvider(CloudProvider): super(OpenShiftCloudProvider, self).__init__(args, config_extension='.kubeconfig') # The image must be pinned to a specific version to guarantee CI passes with the version used. - self.image = 'openshift/origin:v3.9.0' + self.image = 'openshift/origin:v3.7.1' self.container_name = '' def filter(self, targets, exclude):