mirror of https://github.com/databricks/cli.git
use write testutil
This commit is contained in:
parent
f4623ebbb9
commit
ee9499bc68
|
@ -909,8 +909,7 @@ func TestDbfsFilerForStreamingUploads(t *testing.T) {
|
||||||
|
|
||||||
// Write a file to local disk.
|
// Write a file to local disk.
|
||||||
tmpDir := t.TempDir()
|
tmpDir := t.TempDir()
|
||||||
err := os.WriteFile(filepath.Join(tmpDir, "foo.txt"), []byte("foobar"), 0o644)
|
testutil.WriteFile(t, filepath.Join(tmpDir, "foo.txt"), "foobar")
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
fd, err := os.Open(filepath.Join(tmpDir, "foo.txt"))
|
fd, err := os.Open(filepath.Join(tmpDir, "foo.txt"))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -941,11 +940,8 @@ func TestDbfsFilerForPutUploads(t *testing.T) {
|
||||||
|
|
||||||
// Write a file to local disk.
|
// Write a file to local disk.
|
||||||
tmpDir := t.TempDir()
|
tmpDir := t.TempDir()
|
||||||
err := os.WriteFile(filepath.Join(tmpDir, "foo.txt"), []byte("foobar"), 0o644)
|
testutil.WriteFile(t, filepath.Join(tmpDir, "foo.txt"), "foobar")
|
||||||
require.NoError(t, err)
|
testutil.WriteFile(t, filepath.Join(tmpDir, "bar.txt"), "barfoo")
|
||||||
err = os.WriteFile(filepath.Join(tmpDir, "bar.txt"), []byte("barfoo"), 0o644)
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
fdFoo, err := os.Open(filepath.Join(tmpDir, "foo.txt"))
|
fdFoo, err := os.Open(filepath.Join(tmpDir, "foo.txt"))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer fdFoo.Close()
|
defer fdFoo.Close()
|
||||||
|
|
|
@ -41,8 +41,7 @@ func TestDbfsClientForSmallFiles(t *testing.T) {
|
||||||
// write file to local disk
|
// write file to local disk
|
||||||
tmp := t.TempDir()
|
tmp := t.TempDir()
|
||||||
localPath := filepath.Join(tmp, "hello.txt")
|
localPath := filepath.Join(tmp, "hello.txt")
|
||||||
err := os.WriteFile(localPath, []byte("hello world"), 0o644)
|
testutil.WriteFile(t, localPath, "hello world")
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
// setup DBFS client with mocks
|
// setup DBFS client with mocks
|
||||||
m := mocks.NewMockWorkspaceClient(t)
|
m := mocks.NewMockWorkspaceClient(t)
|
||||||
|
|
Loading…
Reference in New Issue