name: CSI Integration Tests on: push: branches: [master] pull_request: workflow_dispatch: jobs: integration-test: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Go uses: actions/setup-go@v5 with: go-version: '1.25' - name: Build CSI driver run: | go build -o _output/seaweedfs-csi-driver ./cmd/seaweedfs-csi-driver go build -o _output/seaweedfs-mount ./cmd/seaweedfs-mount - name: Create kind cluster uses: helm/kind-action@v1.10.0 with: cluster_name: csi-test - name: Build and load Docker images run: | # Build CSI driver image docker build -t seaweedfs-csi-driver:test -f cmd/seaweedfs-csi-driver/Dockerfile . kind load docker-image seaweedfs-csi-driver:test --name csi-test # Build mount service image docker build -t seaweedfs-mount:test -f cmd/seaweedfs-mount/Dockerfile . kind load docker-image seaweedfs-mount:test --name csi-test - name: Deploy SeaweedFS run: | # Deploy SeaweedFS using a simple manifest with proper health checks kubectl apply -f - </dev/null; then echo "SeaweedFS filer is ready" exit 0 fi echo "Waiting for filer... ($i/60)" sleep 3 done echo "SeaweedFS filer did not become ready in time" echo "=== Pod Status ===" kubectl get pods -n seaweedfs -o wide echo "=== Pod Logs ===" kubectl logs -n seaweedfs -l app=seaweedfs --tail=100 exit 1 - name: Deploy CSI Driver run: | # Deploy CSI driver with test images and correct filer address # The seaweedfs-csi.yaml deploys to 'default' namespace cat deploy/kubernetes/seaweedfs-csi.yaml | \ sed 's|chrislusf/seaweedfs-csi-driver:dev|seaweedfs-csi-driver:test|g' | \ sed 's|chrislusf/seaweedfs-mount:dev|seaweedfs-mount:test|g' | \ sed 's|SEAWEEDFS_FILER:8888|seaweedfs.seaweedfs.svc.cluster.local:8888|g' | \ kubectl apply -f - # Wait for CSI driver pods to be ready (fail fast if they don't start) sleep 15 kubectl wait --for=condition=ready pod -l app=seaweedfs-controller --timeout=120s kubectl wait --for=condition=ready pod -l app=seaweedfs-node --timeout=120s kubectl wait --for=condition=ready pod -l app=seaweedfs-mount --timeout=120s kubectl get pods -l 'app in (seaweedfs-controller,seaweedfs-node,seaweedfs-mount)' - name: Create StorageClass and test PVC run: | # Create StorageClass kubectl apply -f - < /data/test.txt' # Test read kubectl exec test-pod -- cat /data/test.txt | grep "Hello SeaweedFS CSI" # Test file listing kubectl exec test-pod -- ls -la /data/ echo "✅ Functional test passed!" - name: Cleanup if: always() run: | kubectl delete pod test-pod --ignore-not-found kubectl delete pvc test-pvc --ignore-not-found - name: Collect logs on failure if: failure() run: | echo "=== CSI Controller Logs ===" kubectl logs -l app=seaweedfs-controller --tail=200 || true echo "=== CSI Node Logs ===" kubectl logs -l app=seaweedfs-node --tail=200 || true echo "=== Mount Service Logs ===" kubectl logs -l app=seaweedfs-mount --tail=200 || true echo "=== SeaweedFS Logs ===" kubectl logs -n seaweedfs -l app=seaweedfs --tail=200 || true echo "=== All Pods ===" kubectl get pods -A echo "=== Events ===" kubectl get events --sort-by='.lastTimestamp' | tail -50