From d741f949b190f0bcafc2edfc4a0d41acb8b3c141 Mon Sep 17 00:00:00 2001 From: Lakshman Patel Date: Thu, 16 Jul 2026 08:24:45 +0530 Subject: [PATCH 1/2] test: fix preflight tests that were skipped due to environment - Added failingStore mock type for deterministic credential fail testing - TestPreflight_NotReady_WhenCredentialsFail now uses failing store - TestPreflight_MultipleFailures now uses failing store - Eliminates environment-dependent test skips --- runtime/preflight_test.go | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/runtime/preflight_test.go b/runtime/preflight_test.go index 077a26c..f86dcf5 100644 --- a/runtime/preflight_test.go +++ b/runtime/preflight_test.go @@ -3,6 +3,7 @@ package runtime import ( "context" "encoding/json" + "errors" "os" "path/filepath" "strings" @@ -12,6 +13,28 @@ import ( "github.com/GrayCodeAI/eyrie/credentials" ) +// failingStore is a mock credential store that always returns errors. +type failingStore struct{} + +func (f *failingStore) Set(ctx context.Context, account, secret string) error { + _ = ctx + _ = account + _ = secret + return errors.New("mock failing store: Set not implemented") +} + +func (f *failingStore) Get(ctx context.Context, account string) (string, error) { + _ = ctx + _ = account + return "", errors.New("mock failing store: Get not implemented") +} + +func (f *failingStore) Delete(ctx context.Context, account string) error { + _ = ctx + _ = account + return errors.New("mock failing store: Delete not implemented") +} + // --- PreflightStatus constants --- func TestPreflightStatusConstants(t *testing.T) { @@ -176,6 +199,9 @@ func TestPreflight_KeychainCheck(t *testing.T) { func TestPreflight_NotReady_WhenCredentialsFail(t *testing.T) { setupPreflightEnv(t, "{}\n") + // Use failing store to ensure credentials check fails + credentials.SetDefaultStore(&failingStore{}) + r := Preflight(context.Background()) // If credentials check fails, Ready should be false. for _, c := range r.Checks { @@ -186,8 +212,7 @@ func TestPreflight_NotReady_WhenCredentialsFail(t *testing.T) { return } } - // If creds check doesn't fail (edge case), skip - t.Skip("credentials check did not fail in this environment") // TODO: https://github.com/GrayCodeAI/eyrie/issues/28 + t.Fatal("expected credentials check to fail with failing store") } func TestPreflight_WithValidModel(t *testing.T) { @@ -394,6 +419,9 @@ func TestPreflight_CheckNames(t *testing.T) { func TestPreflight_MultipleFailures(t *testing.T) { setupPreflightEnv(t, "{}\n") + // Use failing store to ensure credential failures + credentials.SetDefaultStore(&failingStore{}) + r := Preflight(context.Background()) failCount := 0 for _, c := range r.Checks { @@ -402,7 +430,7 @@ func TestPreflight_MultipleFailures(t *testing.T) { } } if failCount == 0 { - t.Skip("no failures detected in this environment") // TODO: https://github.com/GrayCodeAI/eyrie/issues/29 + t.Fatal("expected at least one failure with failing store") } if r.Ready { t.Fatal("expected not ready with failures") @@ -420,4 +448,4 @@ func TestPreflightCheck_DetailAlwaysSet(t *testing.T) { t.Fatalf("expected non-empty detail for check %q", c.Name) } } -} +} \ No newline at end of file From 2d833f3de263406cf1a484334e9f729967d075a3 Mon Sep 17 00:00:00 2001 From: Lakshman Patel Date: Thu, 16 Jul 2026 09:37:47 +0530 Subject: [PATCH 2/2] fix: add missing newline at end of file --- runtime/preflight_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/preflight_test.go b/runtime/preflight_test.go index f86dcf5..91ceadd 100644 --- a/runtime/preflight_test.go +++ b/runtime/preflight_test.go @@ -448,4 +448,4 @@ func TestPreflightCheck_DetailAlwaysSet(t *testing.T) { t.Fatalf("expected non-empty detail for check %q", c.Name) } } -} \ No newline at end of file +}