Skip to content

Commit

Permalink
Fix workspace import test (#844)
Browse files Browse the repository at this point in the history
Windows and unix have different new line characters. Separating the
string assertions here to make the test pass.
  • Loading branch information
shreyas-goenka authored Oct 6, 2023
1 parent 847b6f4 commit 054df2b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/workspace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,8 @@ func TestAccImportFileFormatAuto(t *testing.T) {

// Upload as file if path has no extension
RequireSuccessfulRun(t, "workspace", "import", path.Join(targetDir, "py-nb-as-file"), "--file", "./testdata/import_dir/pyNotebook.py", "--format=AUTO")
assertFilerFileContents(t, ctx, workspaceFiler, "py-nb-as-file", "# Databricks notebook source\nprint(\"python\")")
assertFilerFileContents(t, ctx, workspaceFiler, "py-nb-as-file", "# Databricks notebook source")
assertFilerFileContents(t, ctx, workspaceFiler, "py-nb-as-file", "print(\"python\")")
assertWorkspaceFileType(t, ctx, workspaceFiler, "py-nb-as-file", workspace.ObjectTypeFile)

// Upload as notebook if path has extension
Expand All @@ -379,6 +380,6 @@ func TestAccImportFileFormatAuto(t *testing.T) {

// Upload as file if content is not notebook (even if path has .py extension)
RequireSuccessfulRun(t, "workspace", "import", path.Join(targetDir, "not-a-notebook.py"), "--file", "./testdata/import_dir/file-a", "--format=AUTO")
assertFilerFileContents(t, ctx, workspaceFiler, "not-a-notebook.py", "hello, world\n")
assertFilerFileContents(t, ctx, workspaceFiler, "not-a-notebook.py", "hello, world")
assertWorkspaceFileType(t, ctx, workspaceFiler, "not-a-notebook.py", workspace.ObjectTypeFile)
}

0 comments on commit 054df2b

Please sign in to comment.