-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,40 @@ | ||
package databricks | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestNewVolume(t *testing.T) { | ||
{ | ||
// Invalid | ||
{ | ||
// Missing name | ||
_, err := NewVolume(map[string]any{"path": "path"}) | ||
assert.ErrorContains(t, err, "volume name is missing") | ||
} | ||
{ | ||
// Name isn't string | ||
_, err := NewVolume(map[string]any{"name": 1, "path": "path"}) | ||
assert.ErrorContains(t, err, "volume name is not a string") | ||
} | ||
{ | ||
// Missing path | ||
_, err := NewVolume(map[string]any{"name": "name"}) | ||
assert.ErrorContains(t, err, "volume path is missing") | ||
} | ||
{ | ||
// Path isn't string | ||
_, err := NewVolume(map[string]any{"name": "name", "path": 1}) | ||
assert.ErrorContains(t, err, "volume path is not a string") | ||
} | ||
} | ||
{ | ||
// Valid | ||
volume, err := NewVolume(map[string]any{"name": "name", "path": "path"}) | ||
assert.Nil(t, err) | ||
assert.Equal(t, "name", volume.name) | ||
assert.Equal(t, "path", volume.path) | ||
} | ||
} |