diff --git a/hack/e2e-apps/bucket.bats b/hack/e2e-apps/bucket.bats new file mode 100644 index 00000000..2621812a --- /dev/null +++ b/hack/e2e-apps/bucket.bats @@ -0,0 +1,47 @@ +#!/usr/bin/env bats + +@test "Create and Verify Seeweedfs Bucket" { + # Create the bucket resource + name='test' + kubectl apply -f - < bucket-test-credentials.json + + # Get credentials from the secret + ACCESS_KEY=$(jq -r '.spec.secretS3.accessKeyID' bucket-test-credentials.json) + SECRET_KEY=$(jq -r '.spec.secretS3.accessSecretKey' bucket-test-credentials.json) + BUCKET_NAME=$(jq -r '.spec.bucketName' bucket-test-credentials.json) + + # Start port-forwarding + bash -c 'timeout 100s kubectl port-forward service/seaweedfs-s3 -n tenant-root 8333:8333 > /dev/null 2>&1 &' + + # Wait for port-forward to be ready + timeout 30 sh -ec 'until nc -z localhost 8333; do sleep 1; done' + + # Set up MinIO alias with error handling + mc alias set local https://localhost:8333 $ACCESS_KEY $SECRET_KEY --insecure + + # Upload file to bucket + mc cp bucket-test-credentials.json $BUCKET_NAME/bucket-test-credentials.json + + # Verify file was uploaded + mc ls $BUCKET_NAME/bucket-test-credentials.json + + # Clean up uploaded file + mc rm $BUCKET_NAME/bucket-test-credentials.json + + kubectl -n tenant-test delete bucket.apps.cozystack.io ${name} +} diff --git a/hack/e2e-install-cozystack.bats b/hack/e2e-install-cozystack.bats index 80a0b2d0..d55324b3 100644 --- a/hack/e2e-install-cozystack.bats +++ b/hack/e2e-install-cozystack.bats @@ -123,10 +123,10 @@ EOF @test "Configure Tenant and wait for applications" { # Patch root tenant and wait for its releases - kubectl patch tenants/root -n tenant-root --type merge -p '{"spec":{"host":"example.org","ingress":true,"monitoring":true,"etcd":true,"isolated":true}}' + kubectl patch tenants/root -n tenant-root --type merge -p '{"spec":{"host":"example.org","ingress":true,"monitoring":true,"etcd":true,"isolated":true, "seaweedfs": true}}' - timeout 60 sh -ec 'until kubectl get hr -n tenant-root etcd ingress monitoring tenant-root >/dev/null 2>&1; do sleep 1; done' - kubectl wait hr/etcd hr/ingress hr/tenant-root -n tenant-root --timeout=2m --for=condition=ready + timeout 60 sh -ec 'until kubectl get hr -n tenant-root etcd ingress monitoring seaweedfs tenant-root >/dev/null 2>&1; do sleep 1; done' + kubectl wait hr/etcd hr/ingress hr/tenant-root hr/seaweedfs -n tenant-root --timeout=4m --for=condition=ready if ! kubectl wait hr/monitoring -n tenant-root --timeout=2m --for=condition=ready; then flux reconcile hr monitoring -n tenant-root --force diff --git a/packages/core/testing/images/e2e-sandbox/Dockerfile b/packages/core/testing/images/e2e-sandbox/Dockerfile index d67dec13..069a1905 100755 --- a/packages/core/testing/images/e2e-sandbox/Dockerfile +++ b/packages/core/testing/images/e2e-sandbox/Dockerfile @@ -19,6 +19,7 @@ RUN curl -sSL "https://github.com/mikefarah/yq/releases/download/v4.44.3/yq_${TA && chmod +x /usr/local/bin/yq RUN curl -sSL "https://fluxcd.io/install.sh" | bash RUN curl -sSL "https://github.com/cozystack/cozypkg/raw/refs/heads/main/hack/install.sh" | sh -s -- -v "${COZYPKG_VERSION}" - +RUN curl https://dl.min.io/client/mc/release/${TARGETOS}-${TARGETARCH}/mc --create-dirs -o /usr/local/bin/mc \ +&& chmod +x /usr/local/bin/mc COPY entrypoint.sh /usr/local/bin/entrypoint.sh ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]