test(auth): keep portable fixtures platform-neutral

This commit is contained in:
修雨
2026-07-16 13:55:58 +08:00
parent 57d753cd1d
commit 07d2e4597e
2 changed files with 9 additions and 0 deletions
+6
View File
@@ -1234,6 +1234,12 @@ func TestCrossPlatformCoveragePortableAuthBundleCoverageEdges(t *testing.T) {
})
t.Run("import validation", func(t *testing.T) {
oldGOOS := portableRuntimeGOOS
t.Cleanup(func() {
portableRuntimeGOOS = oldGOOS
})
portableRuntimeGOOS = func() string { return "linux" }
t.Setenv(keychain.StorageDirEnv, t.TempDir())
if _, err := ImportPortableAuthBundle(t.TempDir(), nil); err == nil {
t.Fatal("nil portable reader succeeded")
+3
View File
@@ -91,6 +91,7 @@ func TestCrossPlatformCoverageTokenPersistencePreflightRemainingEdges(t *testing
}
func TestCrossPlatformCoveragePortableExportRemainingEdges(t *testing.T) {
origGOOS := portableRuntimeGOOS
origStat := portableStat
origConfigFiles := portableConfigFilesForExport
origManifest := portableWriteManifest
@@ -99,6 +100,7 @@ func TestCrossPlatformCoveragePortableExportRemainingEdges(t *testing.T) {
origKeychainGet := authKeychainGet
origKeychainExists := authKeychainExists
t.Cleanup(func() {
portableRuntimeGOOS = origGOOS
portableStat = origStat
portableConfigFilesForExport = origConfigFiles
portableWriteManifest = origManifest
@@ -107,6 +109,7 @@ func TestCrossPlatformCoveragePortableExportRemainingEdges(t *testing.T) {
authKeychainGet = origKeychainGet
authKeychainExists = origKeychainExists
})
portableRuntimeGOOS = func() string { return "linux" }
t.Setenv(keychain.StorageDirEnv, t.TempDir())
t.Setenv(keychain.DisableKeychainEnv, "1")