Skip to content

Commit

Permalink
chore: add test for ignored context
Browse files Browse the repository at this point in the history
  • Loading branch information
jackwotherspoon committed Jul 17, 2024
1 parent 78057cf commit c4b113e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions internal/proxy/fuse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,27 @@ func TestFUSEReadDir(t *testing.T) {
}
}

func TestLookupIgnoresContext(t *testing.T) {
if testing.Short() {
t.Skip("skipping fuse tests in short mode.")
}
// create context and cancel it immediately
ctx, cancel := context.WithCancel(context.Background())
cancel()
d := &fakeDialer{}
c, _, _ := newTestClient(t, d, randTmpDir(t), randTmpDir(t))

// invoke Lookup with cancelled context, should ignore context and succeed
_, err := c.Lookup(ctx, "proj:reg:mysql", nil)
if err != fs.OK {
t.Fatalf("proxy.Client.Lookup(): %v", err)
}
// Close the client to close all open sockets.
if err := c.Close(); err != nil {
t.Fatalf("c.Close(): %v", err)
}
}

func TestFUSEErrors(t *testing.T) {
if testing.Short() {
t.Skip("skipping fuse tests in short mode.")
Expand Down

0 comments on commit c4b113e

Please sign in to comment.