-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correctly identify local paths in libraries section (#702)
## Changes Fixes #699 ## Tests Added unit test
- Loading branch information
1 parent
5477afe
commit 842cd8b
Showing
2 changed files
with
60 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package libraries | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/databricks/databricks-sdk-go/service/compute" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
var testCases map[string]bool = map[string]bool{ | ||
"./some/local/path": true, | ||
"/some/full/path": true, | ||
"/Workspace/path/to/package": false, | ||
"/Users/path/to/package": false, | ||
"file://path/to/package": true, | ||
"C:\\path\\to\\package": true, | ||
"dbfs://path/to/package": false, | ||
"s3://path/to/package": false, | ||
"abfss://path/to/package": false, | ||
} | ||
|
||
func TestIsLocalLbrary(t *testing.T) { | ||
for p, result := range testCases { | ||
lib := compute.Library{ | ||
Whl: p, | ||
} | ||
require.Equal(t, result, isLocalLibrary(&lib), fmt.Sprintf("isLocalLibrary must return %t for path %s ", result, p)) | ||
} | ||
} |