From 09f3d67fbf7f952b729f709fc428a3be0f6ef721 Mon Sep 17 00:00:00 2001 From: chrislu Date: Mon, 25 Aug 2025 22:03:21 -0700 Subject: [PATCH] fix tests --- .github/workflows/s3-iam-tests.yml | 8 ++++++-- test/s3/iam/s3_iam_integration_test.go | 4 ++++ test/s3/iam/setup_all_tests.sh | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/s3-iam-tests.yml b/.github/workflows/s3-iam-tests.yml index 8649ab3cd..3acb86edb 100644 --- a/.github/workflows/s3-iam-tests.yml +++ b/.github/workflows/s3-iam-tests.yml @@ -304,11 +304,15 @@ jobs: exit 1 } - curl -f http://localhost:8333 || { + # For IAM-enabled S3 API, we expect a 403 response when accessing without auth + # This indicates the server is running and IAM is working correctly + if curl -s http://localhost:8333 > /dev/null 2>&1; then + echo "✅ SeaweedFS S3 API is responding (IAM-protected endpoint)" + else echo "❌ SeaweedFS S3 API not accessible" cat weed-s3.log || true exit 1 - } + fi # Run Keycloak-specific tests echo "=== Running Keycloak Tests ===" diff --git a/test/s3/iam/s3_iam_integration_test.go b/test/s3/iam/s3_iam_integration_test.go index 24081b5b2..ccd7d1a0b 100644 --- a/test/s3/iam/s3_iam_integration_test.go +++ b/test/s3/iam/s3_iam_integration_test.go @@ -22,6 +22,10 @@ const ( testObjectData = "Hello, SeaweedFS IAM Integration!" ) +var ( + testBucket = testBucketPrefix +) + // TestS3IAMAuthentication tests S3 API authentication with IAM JWT tokens func TestS3IAMAuthentication(t *testing.T) { framework := NewS3IAMTestFramework(t) diff --git a/test/s3/iam/setup_all_tests.sh b/test/s3/iam/setup_all_tests.sh index b847d6873..c7630b27f 100755 --- a/test/s3/iam/setup_all_tests.sh +++ b/test/s3/iam/setup_all_tests.sh @@ -602,7 +602,8 @@ main() { echo -e "\n${BLUE}🔍 Environment Status:${NC}" echo -e " Keycloak: $(curl -s http://localhost:8080/health/ready > /dev/null 2>&1 && echo -e "${GREEN}✅ Running${NC}" || echo -e "${RED}❌ Not running${NC}")" - echo -e " S3 API: $(curl -s http://localhost:8333 > /dev/null 2>&1 && echo -e "${GREEN}✅ Running${NC}" || echo -e "${RED}❌ Not running${NC}")" + # For IAM-enabled S3 API, any response (including 403) indicates the service is running + echo -e " S3 API: $(curl -s http://localhost:8333 > /dev/null 2>&1 && echo -e "${GREEN}✅ Running (IAM-protected)${NC}" || echo -e "${RED}❌ Not running${NC}")" if ! curl -s http://localhost:8333 > /dev/null 2>&1; then echo -e "\n${YELLOW}💡 To start SeaweedFS services:${NC}"