mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Adds k8s_raw, openshift_raw tests (#36228)
This commit is contained in:
parent
a1241d99ee
commit
53cfd70b7d
4 changed files with 153 additions and 24 deletions
2
test/integration/targets/k8s_raw/aliases
Normal file
2
test/integration/targets/k8s_raw/aliases
Normal file
|
@ -0,0 +1,2 @@
|
|||
cloud/openshift
|
||||
posix/ci/cloud/group4/openshift
|
128
test/integration/targets/k8s_raw/tasks/main.yml
Normal file
128
test/integration/targets/k8s_raw/tasks/main.yml
Normal file
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue