Skip to content

Commit 366613b

Browse files
committed
E2E: role-update PASS
1 parent 99f85ab commit 366613b

File tree

8 files changed

+121
-0
lines changed

8 files changed

+121
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
apiVersion: kuttl.dev/v1beta1
3+
kind: TestAssert
4+
resourceRefs:
5+
- apiVersion: openstack.k-orc.cloud/v1alpha1
6+
kind: Role
7+
name: role-update
8+
ref: role
9+
assertAll:
10+
- celExpr: "!has(role.status.resource.description)"
11+
---
12+
apiVersion: openstack.k-orc.cloud/v1alpha1
13+
kind: Role
14+
metadata:
15+
name: role-update
16+
status:
17+
resource:
18+
name: role-update
19+
# TODO(scaffolding): Add matches for more fields
20+
conditions:
21+
- type: Available
22+
status: "True"
23+
reason: Success
24+
- type: Progressing
25+
status: "False"
26+
reason: Success
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
apiVersion: openstack.k-orc.cloud/v1alpha1
3+
kind: Role
4+
metadata:
5+
name: role-update
6+
spec:
7+
cloudCredentialsRef:
8+
# TODO(scaffolding): Use openstack-admin if the resouce needs admin credentials to be created or updated
9+
cloudName: openstack-admin
10+
secretName: openstack-clouds
11+
managementPolicy: managed
12+
# TODO(scaffolding): Only add the mandatory fields. It's possible the resource
13+
# doesn't have mandatory fields, in that case, leave it empty.
14+
resource: {}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
apiVersion: kuttl.dev/v1beta1
3+
kind: TestStep
4+
commands:
5+
- command: kubectl create secret generic openstack-clouds --from-file=clouds.yaml=${E2E_KUTTL_OSCLOUDS} ${E2E_KUTTL_CACERT_OPT}
6+
namespaced: true
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
apiVersion: openstack.k-orc.cloud/v1alpha1
3+
kind: Role
4+
metadata:
5+
name: role-update
6+
status:
7+
resource:
8+
name: role-update-updated
9+
# TODO(scaffolding): match all fields that were modified
10+
conditions:
11+
- type: Available
12+
status: "True"
13+
reason: Success
14+
- type: Progressing
15+
status: "False"
16+
reason: Success
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
apiVersion: openstack.k-orc.cloud/v1alpha1
3+
kind: Role
4+
metadata:
5+
name: role-update
6+
spec:
7+
resource:
8+
name: role-update-updated
9+
# TODO(scaffolding): update all mutable fields
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
apiVersion: kuttl.dev/v1beta1
3+
kind: TestAssert
4+
resourceRefs:
5+
- apiVersion: openstack.k-orc.cloud/v1alpha1
6+
kind: Role
7+
name: role-update
8+
ref: role
9+
assertAll:
10+
- celExpr: "!has(role.status.resource.description)"
11+
---
12+
apiVersion: openstack.k-orc.cloud/v1alpha1
13+
kind: Role
14+
metadata:
15+
name: role-update
16+
status:
17+
resource:
18+
name: role-update
19+
# TODO(scaffolding): validate that updated fields were all reverted to their original value
20+
conditions:
21+
- type: Available
22+
status: "True"
23+
reason: Success
24+
- type: Progressing
25+
status: "False"
26+
reason: Success
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# NOTE: kuttl only does patch updates, which means we can't delete a field.
2+
# We have to use a kubectl apply command instead.
3+
apiVersion: kuttl.dev/v1beta1
4+
kind: TestStep
5+
commands:
6+
- command: kubectl replace -f 00-minimal-resource.yaml
7+
namespaced: true
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Update Role
2+
3+
## Step 00
4+
5+
Create a Role using only mandatory fields.
6+
7+
## Step 01
8+
9+
Update all mutable fields.
10+
11+
## Step 02
12+
13+
Revert the resource to its original value and verify the resulting object is similar to when if was first created.
14+
15+
## Reference
16+
17+
https://k-orc.cloud/development/writing-tests/#update

0 commit comments

Comments
 (0)