Skip to content
Snippets Groups Projects
Unverified Commit 4018a7b2 authored by Adrien Kohlbecker's avatar Adrien Kohlbecker
Browse files

Update test

parent 5f733078
Branches
No related tags found
No related merge requests found
...@@ -27,22 +27,49 @@ func TestAdditionalTags(t *testing.T) { ...@@ -27,22 +27,49 @@ func TestAdditionalTags(t *testing.T) {
assert.Equal(t, []string{"docker-machine", "tag1", "tag2"}, tags) assert.Equal(t, []string{"docker-machine", "tag1", "tag2"}, tags)
} }
func TestDefaultLabel(t *testing.T) { func TestLabels(t *testing.T) {
labels := parseLabels(&Driver{Labels: []string{}}) tests := map[string]struct {
labels []string
assert.Equal(t, map[string]string{}, labels) expectedLabels map[string]string
}{
"no labels": {
labels: []string{},
expectedLabels: map[string]string{},
},
"1 label": {
labels: []string{"key1:value1"},
expectedLabels: map[string]string{
"key1": "value1",
},
},
"multiple label": {
labels: []string{"key1: value1", "key2: value2"},
expectedLabels: map[string]string{
"key1": "value1",
"key2": "value2",
},
},
"label missing key": {
labels: []string{"value1"},
expectedLabels: map[string]string{
"value1": "",
},
},
"label missing value": {
labels: []string{"key1:"},
expectedLabels: map[string]string{
"key1": "",
},
},
} }
func TestAdditionalLabel(t *testing.T) { for tn, tt := range tests {
labels := parseLabels(&Driver{Labels: []string{"key1:value1"}}) t.Run(tn, func(t *testing.T) {
labels := parseLabels(&Driver{Labels: tt.labels})
assert.Equal(t, map[string]string{"key1": "value1"}, labels) assert.Equal(t, tt.expectedLabels, labels)
})
} }
func TestAdditionalLabels(t *testing.T) {
labels := parseLabels(&Driver{Labels: []string{"key1: value1", "key2: value2"}})
assert.Equal(t, map[string]string{"key1": "value1", "key2": "value2"}, labels)
} }
func TestPortsUsed(t *testing.T) { func TestPortsUsed(t *testing.T) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment