Skip to content

Commit 64cc392

Browse files
committed
hostaggregate: Add update test
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
1 parent d25824d commit 64cc392

8 files changed

Lines changed: 114 additions & 0 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
apiVersion: kuttl.dev/v1beta1
3+
kind: TestAssert
4+
resourceRefs:
5+
- apiVersion: openstack.k-orc.cloud/v1alpha1
6+
kind: HostAggregate
7+
name: hostaggregate-update
8+
ref: hostaggregate
9+
assertAll: []
10+
---
11+
apiVersion: openstack.k-orc.cloud/v1alpha1
12+
kind: HostAggregate
13+
metadata:
14+
name: hostaggregate-update
15+
status:
16+
resource:
17+
name: hostaggregate-update
18+
# TODO(scaffolding): Add matches for more fields
19+
conditions:
20+
- type: Available
21+
status: "True"
22+
reason: Success
23+
- type: Progressing
24+
status: "False"
25+
reason: Success
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
apiVersion: openstack.k-orc.cloud/v1alpha1
3+
kind: HostAggregate
4+
metadata:
5+
name: hostaggregate-update
6+
spec:
7+
cloudCredentialsRef:
8+
cloudName: openstack-admin
9+
secretName: openstack-clouds
10+
managementPolicy: managed
11+
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: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
apiVersion: openstack.k-orc.cloud/v1alpha1
3+
kind: HostAggregate
4+
metadata:
5+
name: hostaggregate-update
6+
status:
7+
resource:
8+
name: hostaggregate-update-updated
9+
conditions:
10+
- type: Available
11+
status: "True"
12+
reason: Success
13+
- type: Progressing
14+
status: "False"
15+
reason: Success
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
apiVersion: openstack.k-orc.cloud/v1alpha1
3+
kind: HostAggregate
4+
metadata:
5+
name: hostaggregate-update
6+
spec:
7+
resource:
8+
name: hostaggregate-update-updated
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
apiVersion: kuttl.dev/v1beta1
3+
kind: TestAssert
4+
resourceRefs:
5+
- apiVersion: openstack.k-orc.cloud/v1alpha1
6+
kind: HostAggregate
7+
name: hostaggregate-update
8+
ref: hostaggregate
9+
assertAll: []
10+
---
11+
apiVersion: openstack.k-orc.cloud/v1alpha1
12+
kind: HostAggregate
13+
metadata:
14+
name: hostaggregate-update
15+
status:
16+
resource:
17+
name: hostaggregate-update
18+
# TODO(scaffolding): validate that updated fields were all reverted to their original value
19+
conditions:
20+
- type: Available
21+
status: "True"
22+
reason: Success
23+
- type: Progressing
24+
status: "False"
25+
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 HostAggregate
2+
3+
## Step 00
4+
5+
Create a HostAggregate 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)