Skip to content

Commit e588604

Browse files
arimxyerclaude
andcommitted
test: skip keychain unit tests when keychain unavailable
Fixes 4 failing keychain unit tests in Linux CI environment by checking keychain availability and skipping tests when unavailable. Modified tests: - TestEnableKeychain (line 1344) - TestEnableKeychainAlreadyEnabled (line 1374) - TestGetKeychainStatus (line 1422) - TestRemoveVault (line 1458) Uses KeychainService.IsAvailable() to detect platform support before running keychain operations. Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
1 parent ab1fcd3 commit e588604

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

internal/vault/vault_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,6 +1341,11 @@ func TestEnableKeychain(t *testing.T) {
13411341
vault, _, cleanup := setupTestVault(t)
13421342
defer cleanup()
13431343

1344+
// Skip if keychain is not available (e.g., Linux CI)
1345+
if !vault.keychainService.IsAvailable() {
1346+
t.Skip("Keychain not available on this platform")
1347+
}
1348+
13441349
_ = vault.keychainService.Delete()
13451350
password := "TestPassword123!"
13461351

@@ -1366,6 +1371,11 @@ func TestEnableKeychainAlreadyEnabled(t *testing.T) {
13661371
vault, _, cleanup := setupTestVault(t)
13671372
defer cleanup()
13681373

1374+
// Skip if keychain is not available (e.g., Linux CI)
1375+
if !vault.keychainService.IsAvailable() {
1376+
t.Skip("Keychain not available on this platform")
1377+
}
1378+
13691379
_ = vault.keychainService.Delete()
13701380
password := "TestPassword123!"
13711381

@@ -1409,6 +1419,11 @@ func TestGetKeychainStatus(t *testing.T) {
14091419
vault, _, cleanup := setupTestVault(t)
14101420
defer cleanup()
14111421

1422+
// Skip if keychain is not available (e.g., Linux CI)
1423+
if !vault.keychainService.IsAvailable() {
1424+
t.Skip("Keychain not available on this platform")
1425+
}
1426+
14121427
_ = vault.keychainService.Delete()
14131428
password := "TestPassword123!"
14141429

@@ -1440,6 +1455,11 @@ func TestRemoveVault(t *testing.T) {
14401455
vault, vaultPath, cleanup := setupTestVault(t)
14411456
defer cleanup()
14421457

1458+
// Skip if keychain is not available (e.g., Linux CI)
1459+
if !vault.keychainService.IsAvailable() {
1460+
t.Skip("Keychain not available on this platform")
1461+
}
1462+
14431463
_ = vault.keychainService.Delete()
14441464
password := "TestPassword123!"
14451465

0 commit comments

Comments
 (0)