Skip to content

Commit

Permalink
Merge pull request #174 from cschwede/kuttl-tests
Browse files Browse the repository at this point in the history
Add more Kuttl tests
  • Loading branch information
openshift-merge-bot[bot] authored Mar 19, 2024
2 parents 8b38ff1 + 437e153 commit fdb6c99
Show file tree
Hide file tree
Showing 15 changed files with 233 additions and 14 deletions.
7 changes: 7 additions & 0 deletions tests/kuttl/common/00-deps.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |
if ! [[ `oc get crd openstackdataplanenodesets.dataplane.openstack.org` ]]; then
oc apply -f ../../deps/dataplane.openstack.org_openstackdataplanenodesets.yaml
fi
9 changes: 9 additions & 0 deletions tests/kuttl/common/scripts/check_ring_rebalance_output.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
# Check that all storage pods were included in the rebalance job
oc wait --for=condition=complete -n $NAMESPACE job swift-ring-rebalance
LOGS=$(oc logs -n $NAMESPACE job/swift-ring-rebalance)
PODS=$(oc get pods -n $NAMESPACE -l component=swift-storage -o name | cut -f 2 -d "/")

for pod in $PODS; do
echo $LOGS | grep -q $pod || exit 1
done
7 changes: 0 additions & 7 deletions tests/kuttl/tests/basic-deploy/00-deps.yaml

This file was deleted.

1 change: 1 addition & 0 deletions tests/kuttl/tests/basic-deploy/00-deps.yaml
91 changes: 91 additions & 0 deletions tests/kuttl/tests/basic-deploy/01-assert-deploy-swift.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
apiVersion: swift.openstack.org/v1beta1
kind: Swift
metadata:
Expand Down Expand Up @@ -50,3 +51,93 @@ status:
reason: Ready
status: "True"
type: SwiftStorageReady
---
apiVersion: v1
kind: Pod
metadata:
labels:
component: swift-proxy
service: swift
status:
containerStatuses:
- name: proxy-httpd
ready: true
started: true
- name: proxy-server
ready: true
started: true
- name: ring-sync
ready: true
started: true
---
apiVersion: v1
kind: Pod
metadata:
labels:
component: swift-storage
service: swift
name: swift-storage-0
status:
containerStatuses:
- name: account-auditor
ready: true
started: true
- name: account-reaper
ready: true
started: true
- name: account-replicator
ready: true
started: true
- name: account-server
ready: true
started: true
- name: container-auditor
ready: true
started: true
- name: container-replicator
ready: true
started: true
- name: container-server
ready: true
started: true
- name: container-updater
ready: true
started: true
- name: object-auditor
ready: true
started: true
- name: object-expirer
ready: true
started: true
- name: object-replicator
ready: true
started: true
- name: object-server
ready: true
started: true
- name: object-updater
ready: true
started: true
- name: ring-sync
ready: true
started: true
- name: rsync
ready: true
started: true
- name: swift-recon-cron
ready: true
started: true
---
apiVersion: batch/v1
kind: Job
metadata:
labels:
job-name: swift-ring-rebalance
name: swift-ring-rebalance
status:
succeeded: 1
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
commands:
- script: $SWIFT_KUTTL_DIR/../common/scripts/check_ring_rebalance_output.sh
7 changes: 0 additions & 7 deletions tests/kuttl/tests/basic-deploy_tls/00-deps.yaml

This file was deleted.

1 change: 1 addition & 0 deletions tests/kuttl/tests/basic-deploy_tls/00-deps.yaml
1 change: 1 addition & 0 deletions tests/kuttl/tests/replication/00-deps.yaml
53 changes: 53 additions & 0 deletions tests/kuttl/tests/replication/01-assert-deploy-swift.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
apiVersion: swift.openstack.org/v1beta1
kind: Swift
metadata:
name: swift
spec:
swiftRing:
ringReplicas: 3
swiftStorage:
storageClass: local-storage
replicas: 3
swiftProxy:
replicas: 1
passwordSelectors:
service: SwiftPassword
status:
conditions:
- message: Setup complete
reason: Ready
status: "True"
type: Ready
- message: " Memcached instance has been provisioned"
reason: Ready
status: "True"
type: MemcachedReady
- message: RoleBinding created
reason: Ready
status: "True"
type: RoleBindingReady
- message: Role created
reason: Ready
status: "True"
type: RoleReady
- message: ServiceAccount created
reason: Ready
status: "True"
type: ServiceAccountReady
- message: Service config create completed
reason: Ready
status: "True"
type: ServiceConfigReady
- message: Setup complete
reason: Ready
status: "True"
type: SwiftProxyReady
- message: Setup complete
reason: Ready
status: "True"
type: SwiftRingReady
- message: Setup complete
reason: Ready
status: "True"
type: SwiftStorageReady
6 changes: 6 additions & 0 deletions tests/kuttl/tests/replication/01-deploy-swift.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |
cp ../../../../config/samples/swift_v1beta1_swift.yaml deploy
oc kustomize deploy | oc apply -n $NAMESPACE -f -
6 changes: 6 additions & 0 deletions tests/kuttl/tests/replication/02-assert-store-data.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
commands:
- script: |
oc debug -n $NAMESPACE --keep-labels=true job/swift-ring-rebalance -- /bin/sh -c 'swift-ring-tool get && swift-dispersion-report --object-only' | grep '100.00% of object copies found'
6 changes: 6 additions & 0 deletions tests/kuttl/tests/replication/02-store-data.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |
oc debug -n $NAMESPACE --keep-labels=true job/swift-ring-rebalance -- /bin/sh -c 'swift-ring-tool get && swift-dispersion-populate --object-only'
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
commands:
- script: |
oc debug -n $NAMESPACE --keep-labels=true job/swift-ring-rebalance -- /bin/sh -c 'swift-ring-tool get && swift-dispersion-report --object-only' | grep '100.00% of object copies found'
6 changes: 6 additions & 0 deletions tests/kuttl/tests/replication/03-force-replication.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |
oc rsh -n $NAMESPACE pod/swift-storage-0 /bin/sh -c 'rm -rf /srv/node/d1/* || true'
11 changes: 11 additions & 0 deletions tests/kuttl/tests/replication/04-cleanup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
delete:
- apiVersion: swift.openstack.org/v1beta1
kind: Swift
name: swift
commands:
- script: |
oc delete --ignore-not-found=true -n $NAMESPACE pvc srv-swift-storage-0
oc delete --ignore-not-found=true -n $NAMESPACE pvc srv-swift-storage-1
oc delete --ignore-not-found=true -n $NAMESPACE pvc srv-swift-storage-2
15 changes: 15 additions & 0 deletions tests/kuttl/tests/replication/04-errors-cleanup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: swift.openstack.org/v1beta1
kind: Swift
metadata:
name: swift
---
apiVersion: v1
kind: Pod
metadata:
labels:
app.kubernetes.io/name: SwiftProxy
---
apiVersion: v1
kind: Pod
metadata:
name: swift-storage-0
14 changes: 14 additions & 0 deletions tests/kuttl/tests/replication/deploy/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./swift_v1beta1_swift.yaml
patches:
- patch: |-
- op: replace
path: /spec/swiftRing/ringReplicas
value: 3
- op: replace
path: /spec/swiftStorage/replicas
value: 3
target:
kind: Swift

0 comments on commit fdb6c99

Please sign in to comment.