use write testutil

This commit is contained in:
Shreyas Goenka 2025-01-03 00:01:55 +05:30
parent f4623ebbb9
commit ee9499bc68
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
2 changed files with 4 additions and 9 deletions

View File

@ -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()

View File

@ -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)