Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion internal/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 5 additions & 3 deletions internal/git/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,21 @@ 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)
assert.Equal(t, dir, got)
}

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)
Expand Down
2 changes: 1 addition & 1 deletion internal/vm/oauth_relay_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
6 changes: 0 additions & 6 deletions internal/vm/oauth_relay_stub.go

This file was deleted.

6 changes: 3 additions & 3 deletions internal/vm/oauth_relay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{})
Expand All @@ -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)
Expand All @@ -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)
Expand Down
6 changes: 0 additions & 6 deletions internal/vm/open_url_stub.go

This file was deleted.

Loading