diff options
| author | chrislu <chris.lu@gmail.com> | 2025-08-31 09:02:05 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2025-08-31 09:02:05 -0700 |
| commit | 7d683702717f45b3fe197143b335ab4727a1619a (patch) | |
| tree | a3e121d0c24647013c8d1dd61ef9edf1f5b287ac | |
| parent | 523ba5b7c12c088a59711bf294dd237be3ca5399 (diff) | |
| download | seaweedfs-7d683702717f45b3fe197143b335ab4727a1619a.tar.xz seaweedfs-7d683702717f45b3fe197143b335ab4727a1619a.zip | |
fix tests
| -rw-r--r-- | .github/workflows/posix-compliance.yml | 11 | ||||
| -rw-r--r-- | weed/iam/sts/test_utils_test.go | 53 |
2 files changed, 6 insertions, 58 deletions
diff --git a/.github/workflows/posix-compliance.yml b/.github/workflows/posix-compliance.yml index 589bc06eb..1df0f041c 100644 --- a/.github/workflows/posix-compliance.yml +++ b/.github/workflows/posix-compliance.yml @@ -102,11 +102,11 @@ jobs: - name: Build SeaweedFS run: | make - # Verify binary exists and is executable - ./weed version + # Verify binary exists and is executable (it's installed to GOPATH/bin) + weed version - # Make weed binary available in PATH - sudo cp ./weed /usr/local/bin/weed + # Make weed binary available in PATH (it's already there from go install) + sudo cp $(which weed) /usr/local/bin/weed which weed weed version @@ -490,7 +490,8 @@ jobs: - name: Build SeaweedFS run: | make - ./weed version + # Verify binary exists and is executable (it's installed to GOPATH/bin) + weed version - name: Run critical POSIX tests (macOS) continue-on-error: true # macOS FUSE can be more restrictive diff --git a/weed/iam/sts/test_utils_test.go b/weed/iam/sts/test_utils_test.go deleted file mode 100644 index 58de592dc..000000000 --- a/weed/iam/sts/test_utils_test.go +++ /dev/null @@ -1,53 +0,0 @@ -package sts - -import ( - "context" - "fmt" - "strings" - - "github.com/seaweedfs/seaweedfs/weed/iam/providers" -) - -// MockTrustPolicyValidator is a simple mock for testing STS functionality -type MockTrustPolicyValidator struct{} - -// ValidateTrustPolicyForWebIdentity allows valid JWT test tokens for STS testing -func (m *MockTrustPolicyValidator) ValidateTrustPolicyForWebIdentity(ctx context.Context, roleArn string, webIdentityToken string) error { - // Reject non-existent roles for testing - if strings.Contains(roleArn, "NonExistentRole") { - return fmt.Errorf("trust policy validation failed: role does not exist") - } - - // For STS unit tests, allow JWT tokens that look valid (contain dots for JWT structure) - // In real implementation, this would validate against actual trust policies - if len(webIdentityToken) > 20 && strings.Count(webIdentityToken, ".") >= 2 { - // This appears to be a JWT token - allow it for testing - return nil - } - - // Legacy support for specific test tokens during migration - if webIdentityToken == "valid_test_token" || webIdentityToken == "valid-oidc-token" { - return nil - } - - // Reject invalid tokens - if webIdentityToken == "invalid_token" || webIdentityToken == "expired_token" || webIdentityToken == "invalid-token" { - return fmt.Errorf("trust policy denies token") - } - - return nil -} - -// ValidateTrustPolicyForCredentials allows valid test identities for STS testing -func (m *MockTrustPolicyValidator) ValidateTrustPolicyForCredentials(ctx context.Context, roleArn string, identity *providers.ExternalIdentity) error { - // Reject non-existent roles for testing - if strings.Contains(roleArn, "NonExistentRole") { - return fmt.Errorf("trust policy validation failed: role does not exist") - } - - // For STS unit tests, allow test identities - if identity != nil && identity.UserID != "" { - return nil - } - return fmt.Errorf("invalid identity for role assumption") -} |
