From cb1fac4590af7770f723899a3ccd71ca17741dce Mon Sep 17 00:00:00 2001 From: Miguel Diaz Date: Tue, 24 Feb 2026 00:56:29 +0100 Subject: [PATCH 1/3] =?UTF-8?q?=E2=9C=A8=20fix(test):=20avoid=20ignored-er?= =?UTF-8?q?ror=20failures=20by=20explicitly=20discarding=20Close/Serve=20e?= =?UTF-8?q?rrors=20in=20oauth=20relay=20tests=20and=20darwin=20helper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/vm/oauth_relay_darwin.go | 2 +- internal/vm/oauth_relay_test.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/vm/oauth_relay_darwin.go b/internal/vm/oauth_relay_darwin.go index a7d5715..f693565 100644 --- a/internal/vm/oauth_relay_darwin.go +++ b/internal/vm/oauth_relay_darwin.go @@ -101,6 +101,6 @@ func startOAuthRelay(done <-chan struct{}, bootstrapDir string, port string) err _ = srv.Shutdown(ctx) }() - go srv.Serve(ln) + go func() { _ = srv.Serve(ln) }() return nil } diff --git a/internal/vm/oauth_relay_test.go b/internal/vm/oauth_relay_test.go index 96c1475..50fb5dc 100644 --- a/internal/vm/oauth_relay_test.go +++ b/internal/vm/oauth_relay_test.go @@ -118,7 +118,7 @@ func TestStartOAuthRelay(t *testing.T) { t.Fatal(err) } port := ln.Addr().(*net.TCPAddr).Port - ln.Close() + _ = ln.Close() tmpDir := t.TempDir() done := make(chan struct{}) @@ -134,7 +134,7 @@ func TestStartOAuthRelay(t *testing.T) { if err != nil { t.Fatalf("GET: %v", err) } - defer resp.Body.Close() + defer func() { _ = resp.Body.Close() }() if resp.StatusCode != http.StatusOK { t.Errorf("status = %d, want 200", resp.StatusCode) @@ -158,7 +158,7 @@ func TestStartOAuthRelayPortConflict(t *testing.T) { if err != nil { t.Fatal(err) } - defer ln.Close() + defer func() { _ = ln.Close() }() port := ln.Addr().(*net.TCPAddr).Port portStr := fmt.Sprintf("%d", port) From 80cf05854aa47c0ef45729201ca313e735cbefde Mon Sep 17 00:00:00 2001 From: Miguel Diaz Date: Tue, 24 Feb 2026 01:58:53 +0100 Subject: [PATCH 2/3] =?UTF-8?q?=E2=9C=A8=20feat:=20fix=20tests=20to=20use?= =?UTF-8?q?=20real=20temp=20dirs=20and=20disable=20homedir=20cache?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/config/config_test.go | 6 +++++- internal/git/root_test.go | 8 +++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/internal/config/config_test.go b/internal/config/config_test.go index 5c1fb9d..26c182e 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -12,7 +12,11 @@ import ( ) func TestLoadDefaults(t *testing.T) { - // Load config without a config file present + // Point HOME at an empty temp dir so no real config file is found. + t.Setenv("HOME", t.TempDir()) + homedir.DisableCache = true + t.Cleanup(func() { homedir.DisableCache = false }) + cfg, err := Load() require.NoError(t, err) require.NotNil(t, cfg) diff --git a/internal/git/root_test.go b/internal/git/root_test.go index de86fea..9b64a15 100644 --- a/internal/git/root_test.go +++ b/internal/git/root_test.go @@ -32,7 +32,8 @@ func initGitRepo(t *testing.T, dir string) { } func TestFindRoot_ReturnsRepoRoot(t *testing.T) { - dir := t.TempDir() + dir, err := filepath.EvalSymlinks(t.TempDir()) + require.NoError(t, err) initGitRepo(t, dir) got := FindRoot(dir) @@ -40,11 +41,12 @@ func TestFindRoot_ReturnsRepoRoot(t *testing.T) { } func TestFindRoot_Subdir_ReturnsRepoRoot(t *testing.T) { - dir := t.TempDir() + dir, err := filepath.EvalSymlinks(t.TempDir()) + require.NoError(t, err) initGitRepo(t, dir) subdir := filepath.Join(dir, "some", "nested", "subdir") - err := os.MkdirAll(subdir, 0o755) + err = os.MkdirAll(subdir, 0o755) require.NoError(t, err) got := FindRoot(subdir) From 982c2c75f9cdd4bb1bb95a737a9a9aa75f58a260 Mon Sep 17 00:00:00 2001 From: Miguel Diaz Date: Tue, 24 Feb 2026 02:12:17 +0100 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=A7=B9=20vm:=20remove=20non-darwin=20?= =?UTF-8?q?build=20stubs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/vm/oauth_relay_stub.go | 6 ------ internal/vm/open_url_stub.go | 6 ------ 2 files changed, 12 deletions(-) delete mode 100644 internal/vm/oauth_relay_stub.go delete mode 100644 internal/vm/open_url_stub.go diff --git a/internal/vm/oauth_relay_stub.go b/internal/vm/oauth_relay_stub.go deleted file mode 100644 index 6a777d6..0000000 --- a/internal/vm/oauth_relay_stub.go +++ /dev/null @@ -1,6 +0,0 @@ -//go:build !darwin - -package vm - -func parseOAuthRedirect(rawURL string) (string, bool) { return "", false } -func startOAuthRelay(done <-chan struct{}, bootstrapDir string, port string) error { return nil } diff --git a/internal/vm/open_url_stub.go b/internal/vm/open_url_stub.go deleted file mode 100644 index e9aa4c3..0000000 --- a/internal/vm/open_url_stub.go +++ /dev/null @@ -1,6 +0,0 @@ -//go:build !darwin - -package vm - -// watchOpenURL is a no-op on non-darwin platforms. -func watchOpenURL(done <-chan struct{}, bootstrapDir string) {}