MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/cloud-sql-proxy / TestFUSEReadDir

Function TestFUSEReadDir

internal/proxy/fuse_test.go:263–293  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

261}
262
263func TestFUSEReadDir(t *testing.T) {
264 if testing.Short() {
265 t.Skip("skipping fuse tests in short mode.")
266 }
267 if os.Getenv("SKIP_FUSE_E2E_TESTS") == "true" {
268 t.Skip("skipping Postgres FUSE integration tests because SKIP_FUSE_E2E_TESTS is set")
269 }
270 fuseDir := randTmpDir(t)
271 _, _, cleanup := newTestClient(t, &fakeDialer{}, fuseDir, randTmpDir(t))
272 defer cleanup()
273
274 // Initiate a connection so the FUSE server will list it in the dir entries.
275 conn := tryDialUnix(t, filepath.Join(fuseDir, "proj:reg:mysql"))
276 defer conn.Close()
277
278 entries, err := os.ReadDir(fuseDir)
279 if err != nil {
280 t.Fatalf("os.ReadDir(): %v", err)
281 }
282 // len should be README plus the proj:reg:mysql socket
283 if got, want := len(entries), 2; got != want {
284 t.Fatalf("want = %v, got = %v", want, got)
285 }
286 var names []string
287 for _, e := range entries {
288 names = append(names, e.Name())
289 }
290 if names[0] != "README" || names[1] != "proj:reg:mysql" {
291 t.Fatalf("want = %v, got = %v", []string{"README", "proj:reg:mysql"}, names)
292 }
293}
294
295func TestLookupIgnoresContext(t *testing.T) {
296 if testing.Short() {

Callers

nothing calls this directly

Calls 4

randTmpDirFunction · 0.85
newTestClientFunction · 0.85
tryDialUnixFunction · 0.85
CloseMethod · 0.45

Tested by

no test coverage detected