From ee9499bc68ef5b9248ecedb3c1a07707ac292381 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Fri, 3 Jan 2025 00:01:55 +0530 Subject: [PATCH] use write testutil --- integration/libs/filer/filer_test.go | 10 +++------- libs/filer/dbfs_client_test.go | 3 +-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/integration/libs/filer/filer_test.go b/integration/libs/filer/filer_test.go index 9e65af396..8bba493f4 100644 --- a/integration/libs/filer/filer_test.go +++ b/integration/libs/filer/filer_test.go @@ -909,8 +909,7 @@ func TestDbfsFilerForStreamingUploads(t *testing.T) { // Write a file to local disk. tmpDir := t.TempDir() - err := os.WriteFile(filepath.Join(tmpDir, "foo.txt"), []byte("foobar"), 0o644) - require.NoError(t, err) + testutil.WriteFile(t, filepath.Join(tmpDir, "foo.txt"), "foobar") fd, err := os.Open(filepath.Join(tmpDir, "foo.txt")) require.NoError(t, err) @@ -941,11 +940,8 @@ func TestDbfsFilerForPutUploads(t *testing.T) { // Write a file to local disk. tmpDir := t.TempDir() - err := os.WriteFile(filepath.Join(tmpDir, "foo.txt"), []byte("foobar"), 0o644) - require.NoError(t, err) - err = os.WriteFile(filepath.Join(tmpDir, "bar.txt"), []byte("barfoo"), 0o644) - require.NoError(t, err) - + testutil.WriteFile(t, filepath.Join(tmpDir, "foo.txt"), "foobar") + testutil.WriteFile(t, filepath.Join(tmpDir, "bar.txt"), "barfoo") fdFoo, err := os.Open(filepath.Join(tmpDir, "foo.txt")) require.NoError(t, err) defer fdFoo.Close() diff --git a/libs/filer/dbfs_client_test.go b/libs/filer/dbfs_client_test.go index a63ed856c..506bff2dd 100644 --- a/libs/filer/dbfs_client_test.go +++ b/libs/filer/dbfs_client_test.go @@ -41,8 +41,7 @@ func TestDbfsClientForSmallFiles(t *testing.T) { // write file to local disk tmp := t.TempDir() localPath := filepath.Join(tmp, "hello.txt") - err := os.WriteFile(localPath, []byte("hello world"), 0o644) - require.NoError(t, err) + testutil.WriteFile(t, localPath, "hello world") // setup DBFS client with mocks m := mocks.NewMockWorkspaceClient(t)