Skip to content

Commit 3f6d2c3

Browse files
committed
Rework kuttl test to be organize like in nova-operator
1 parent 3f8c9ec commit 3f6d2c3

20 files changed

+1182
-0
lines changed

Makefile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,3 +364,43 @@ scale-down-placement-controller-csv:
364364
if [ "$(has_webhooks)" != "null" ]; then \
365365
oc patch csv -n $(OPERATOR_NAMESPACE) placement-operator.v0.0.1 --type json -p='[{"op": "remove", "path": "/spec/webhookdefinitions"}]'; \
366366
fi
367+
368+
KUTTL_SUITE ?= default
369+
KUTTL_NAMESPACE ?= placement-kuttl-$(KUTTL_SUITE)
370+
KUTTL_SUITE_DIR ?= tests/kuttl/test-suites/$(KUTTL_SUITE)
371+
372+
.PHONY: kuttl-test-prep
373+
kuttl-test-prep:
374+
oc apply -k $(KUTTL_SUITE_DIR)/deps/ --timeout=120s
375+
oc wait -n $(KUTTL_NAMESPACE) openstackcontrolplane openstack --for condition=Ready --timeout=300s
376+
377+
.PHONY: kuttl-test-run
378+
kuttl-test-run: export NAMESPACE = $(KUTTL_NAMESPACE)
379+
kuttl-test-run:
380+
oc kuttl test --v 1 --start-kind=false --config $(KUTTL_SUITE_DIR)/config.yaml
381+
382+
.PHONY: kuttl-test
383+
kuttl-test: kuttl-test-prep kuttl-test-run
384+
385+
.PHONY: kuttl-test-cleanup
386+
kuttl-test-cleanup:
387+
# only cleanup if the $(KUTTL_NAMESPACE) exists
388+
$(eval namespace_exists=$(shell oc get namespace $(KUTTL_NAMESPACE) --ignore-not-found -o name))
389+
# We need to order the deletion. Simply deleting the namespace will
390+
# result in errors in mariadb- and keystone-operator and then
391+
# finalizer removal get stuck blocking the namespace deletion.
392+
if [ "${namespace_exists}" != "" ]; then \
393+
if [ "$(KUTTL_SUITE)" == "autoscaling" ]; then \
394+
oc delete --wait=true --all=true -n $(KUTTL_NAMESPACE) --timeout=120s Autoscaling; \
395+
fi; \
396+
if [ "$(KUTTL_SUITE)" == "ceilometer" ]; then \
397+
oc delete --wait=true --all=true -n $(KUTTL_NAMESPACE) --timeout=120s Ceilometer; \
398+
fi; \
399+
if [ "$(KUTTL_SUITE)" == "default" ]; then \
400+
oc delete --wait=true --all=true -n $(KUTTL_NAMESPACE) --timeout=120s Telemetry; \
401+
fi; \
402+
oc delete --wait=true --all=true -n $(KUTTL_NAMESPACE) --timeout=120s OpenStackControlPlane; \
403+
oc delete --wait=true namespace $(KUTTL_NAMESPACE); \
404+
else \
405+
echo "Namespce already cleaned up. Nothing to do"; \
406+
fi
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: kuttl.dev/v1beta1
2+
kind: TestSuite
3+
reportFormat: JSON
4+
reportName: kuttl-test-placement
5+
namespace: placement-kuttl-tests
6+
# we could set this lower, but the initial image pull can take a while
7+
timeout: 300
8+
parallel: 1
9+
skipDelete: true
10+
testDirs:
11+
- tests/kuttl/test-suites/default/
12+
suppress:
13+
- events
14+
artifactsDir: test/kuttl/test-suites/default/output
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: core.openstack.org/v1beta1
2+
kind: OpenStackControlPlane
3+
metadata:
4+
name: openstack
5+
spec:
6+
storageClass: "crc-csi-hostpath-provisioner"
7+
ironic:
8+
enabled: false
9+
template:
10+
ironicConductors: []
11+
manila:
12+
enabled: false
13+
template:
14+
manilaShares: {}
15+
horizon:
16+
enabled: false
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
apiVersion: core.openstack.org/v1beta1
2+
kind: OpenStackControlPlane
3+
metadata:
4+
name: openstack
5+
spec:
6+
mariadb:
7+
enabled: false
8+
galera:
9+
enabled: true
10+
templates:
11+
openstack:
12+
storageRequest: 500M
13+
openstack-cell1:
14+
storageRequest: 500M
15+
rabbitmq:
16+
templates:
17+
rabbitmq:
18+
replicas: 1
19+
rabbitmq-cell1:
20+
replicas: 1
21+
memcached:
22+
templates:
23+
memcached:
24+
replicas: 1
25+
ovn:
26+
enabled: false
27+
template:
28+
ovnController:
29+
external-ids:
30+
ovn-encap-type: geneve
31+
ovs:
32+
enabled: false
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: core.openstack.org/v1beta1
2+
kind: OpenStackControlPlane
3+
metadata:
4+
name: openstack
5+
spec:
6+
keystone:
7+
template:
8+
databaseInstance: openstack
9+
secret: osp-secret
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
namespace: placement-kuttl-tests
4+
5+
secretGenerator:
6+
- literals:
7+
- AdminPassword=password
8+
- DbRootPassword=password
9+
- DatabasePassword=password
10+
- KeystoneDatabasePassword=password
11+
- PlacementPassword=password
12+
- PlacementDatabasePassword=password
13+
- GlancePassword=password
14+
- GlanceDatabasePassword=password
15+
- NeutronPassword=password
16+
- NeutronDatabasePassword=password
17+
- NovaPassword=password
18+
- NovaAPIDatabasePassword=password
19+
- NovaCell0DatabasePassword=password
20+
- NovaCell1DatabasePassword=password
21+
- MetadataSecret=42
22+
name: osp-secret
23+
generatorOptions:
24+
disableNameSuffixHash: true
25+
labels:
26+
type: osp-secret
27+
28+
resources:
29+
- namespace.yaml
30+
- OpenStackControlPlane.yaml
31+
32+
patches:
33+
- patch: |-
34+
apiVersion: core.openstack.org/v1beta1
35+
kind: OpenStackControlPlane
36+
metadata:
37+
name: openstack
38+
spec:
39+
secret: osp-secret
40+
- path: infra.yaml
41+
- path: keystone.yaml
42+
- path: placement.yaml
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: nova-kuttl-multi-cell
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: core.openstack.org/v1beta1
2+
kind: OpenStackControlPlane
3+
metadata:
4+
name: openstack
5+
spec:
6+
placement:
7+
template:
8+
databaseInstance: openstack
9+
secret: osp-secret

tests/kuttl/test-suites/default/output/.keep

Whitespace-only changes.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "",
3+
"tests": 3,
4+
"failures": 0,
5+
"time": "214.322",
6+
"testsuite": [
7+
{
8+
"tests": 3,
9+
"failures": 0,
10+
"timestamp": "2023-08-04T11:39:21.251975663+02:00",
11+
"time": "202.907",
12+
"name": "test/kuttl/test-suites/default/",
13+
"testcase": [
14+
{
15+
"classname": "default",
16+
"name": "deps",
17+
"timestamp": "2023-08-04T11:39:21.252056484+02:00",
18+
"time": "0.000"
19+
},
20+
{
21+
"classname": "default",
22+
"name": "scale-tests",
23+
"timestamp": "2023-08-04T11:39:21.257387947+02:00",
24+
"time": "202.901",
25+
"assertions": 69
26+
},
27+
{
28+
"classname": "default",
29+
"name": "output",
30+
"timestamp": "2023-08-04T11:42:44.158903202+02:00",
31+
"time": "0.000"
32+
}
33+
]
34+
}
35+
]
36+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: kuttl.dev/v1beta1
2+
kind: TestStep
3+
delete:
4+
- apiVersion: placement.openstack.org/v1beta1
5+
kind: PlacementAPI
6+
name: placement

0 commit comments

Comments
 (0)