(t *testing.T, tmpDir, host string, dsn string)
| 47 | } |
| 48 | |
| 49 | func testFUSE(t *testing.T, tmpDir, host string, dsn string) { |
| 50 | tmpDir2, cleanup2 := createTempDir(t) |
| 51 | defer cleanup2() |
| 52 | |
| 53 | waitForFUSE := func() error { |
| 54 | var err error |
| 55 | for i := 0; i < 10; i++ { |
| 56 | _, err = os.Stat(host) |
| 57 | if err == nil { |
| 58 | return nil |
| 59 | } |
| 60 | time.Sleep(500 * time.Millisecond) |
| 61 | } |
| 62 | return fmt.Errorf("failed to find FUSE mounted Unix socket: %v", err) |
| 63 | } |
| 64 | |
| 65 | tcs := []struct { |
| 66 | desc string |
| 67 | dbUser string |
| 68 | args []string |
| 69 | }{ |
| 70 | { |
| 71 | desc: "using default fuse", |
| 72 | args: []string{fmt.Sprintf("--fuse=%s", tmpDir), fmt.Sprintf("--fuse-tmp-dir=%s", tmpDir2)}, |
| 73 | }, |
| 74 | { |
| 75 | desc: "using fuse with auto-iam-authn", |
| 76 | args: []string{fmt.Sprintf("--fuse=%s", tmpDir), "--auto-iam-authn"}, |
| 77 | }, |
| 78 | } |
| 79 | |
| 80 | for _, tc := range tcs { |
| 81 | t.Run(tc.desc, func(t *testing.T) { |
| 82 | proxyConnTestWithReady(t, tc.args, "pgx", dsn, waitForFUSE) |
| 83 | // given the kernel some time to unmount the fuse |
| 84 | time.Sleep(100 * time.Millisecond) |
| 85 | }) |
| 86 | } |
| 87 | |
| 88 | } |
no test coverage detected