Skip to content

Commit 18961de

Browse files
committed
[tests] Add pre-cleanup, fix port-forward race, fix temp leak
- Add pre-cleanup of stale resources to all app E2E tests so retries start fresh instead of patching stuck state - Wait for port-forward to be ready before using it in kubernetes tests (fixes race condition) - Reduce version check sleep from 5s to 1s for faster retries - Clean up temp directory on test failure in cozytest.sh Assisted-By: Claude <[email protected]> Signed-off-by: Aleksei Sviridkin <[email protected]>
1 parent 64b370b commit 18961de

13 files changed

Lines changed: 16 additions & 1 deletion

‎hack/cozytest.sh‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ run_one() {
6565
echo "----- captured output -----------------------------------------"
6666
grep -v '^__RC__' "$log"
6767
echo "$LINE"
68+
rm -rf "$tmp"
6869
exit "$rc"
6970
fi
7071

‎hack/e2e-apps/bucket.bats‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
@test "Create and Verify Seeweedfs Bucket" {
44
# Create the bucket resource with readwrite and readonly users
55
name='test'
6+
kubectl -n tenant-test delete bucket.apps.cozystack.io $name --ignore-not-found --timeout=2m || true
67
kubectl apply -f - <<EOF
78
apiVersion: apps.cozystack.io/v1alpha1
89
kind: Bucket

‎hack/e2e-apps/clickhouse.bats‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
@test "Create DB ClickHouse" {
44
name='test'
5+
kubectl -n tenant-test delete clickhouse.apps.cozystack.io $name --ignore-not-found --timeout=2m || true
56
kubectl apply -f- <<EOF
67
apiVersion: apps.cozystack.io/v1alpha1
78
kind: ClickHouse

‎hack/e2e-apps/foundationdb.bats‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
@test "Create DB FoundationDB" {
44
name='test'
5+
kubectl -n tenant-test delete foundationdb.apps.cozystack.io $name --ignore-not-found --timeout=2m || true
56
kubectl apply -f - <<EOF
67
apiVersion: apps.cozystack.io/v1alpha1
78
kind: FoundationDB

‎hack/e2e-apps/kafka.bats‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
@test "Create Kafka" {
44
name='test'
5+
kubectl -n tenant-test delete kafka.apps.cozystack.io $name --ignore-not-found --timeout=2m || true
56
kubectl apply -f- <<EOF
67
apiVersion: apps.cozystack.io/v1alpha1
78
kind: Kafka

‎hack/e2e-apps/mariadb.bats‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
@test "Create DB MariaDB" {
44
name='test'
5+
kubectl -n tenant-test delete mariadbs.apps.cozystack.io $name --ignore-not-found --timeout=2m || true
56
kubectl apply -f- <<EOF
67
apiVersion: apps.cozystack.io/v1alpha1
78
kind: MariaDB

‎hack/e2e-apps/mongodb.bats‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
@test "Create DB MongoDB" {
44
name='test'
5+
kubectl -n tenant-test delete mongodbs.apps.cozystack.io $name --ignore-not-found --timeout=2m || true
56
kubectl apply -f - <<EOF
67
apiVersion: apps.cozystack.io/v1alpha1
78
kind: MongoDB

‎hack/e2e-apps/openbao.bats‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
@test "Create OpenBAO (standalone)" {
44
name='test'
5+
kubectl -n tenant-test delete openbao.apps.cozystack.io $name --ignore-not-found --timeout=2m || true
56
kubectl apply -f- <<EOF
67
apiVersion: apps.cozystack.io/v1alpha1
78
kind: OpenBAO

‎hack/e2e-apps/postgres.bats‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
@test "Create DB PostgreSQL" {
44
name='test'
5+
kubectl -n tenant-test delete postgreses.apps.cozystack.io $name --ignore-not-found --timeout=2m || true
56
kubectl apply -f - <<EOF
67
apiVersion: apps.cozystack.io/v1alpha1
78
kind: Postgres

‎hack/e2e-apps/qdrant.bats‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
@test "Create Qdrant" {
44
name='test'
5+
kubectl -n tenant-test delete qdrant.apps.cozystack.io $name --ignore-not-found --timeout=2m || true
56
kubectl apply -f- <<EOF
67
apiVersion: apps.cozystack.io/v1alpha1
78
kind: Qdrant

0 commit comments

Comments
 (0)