mirror of https://github.com/databricks/cli.git
31 lines
778 B
Go
31 lines
778 B
Go
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))
|
|
}
|
|
}
|