Browse Source

FIX #2171 Fix faulty flag and add tests for SetConfigFromFlags

Signed-off-by: David Gageot <david@gageot.net>
changes/52/448852/1
David Gageot 3 years ago
parent
commit
f47ab21dd0
1 changed files with 29 additions and 0 deletions
  1. 29
    0
      drivers/openstack/openstack_test.go

+ 29
- 0
drivers/openstack/openstack_test.go View File

@@ -0,0 +1,29 @@
1
+package openstack
2
+
3
+import (
4
+	"testing"
5
+
6
+	"github.com/docker/machine/libmachine/drivers"
7
+	"github.com/stretchr/testify/assert"
8
+)
9
+
10
+func TestSetConfigFromFlags(t *testing.T) {
11
+	driver := NewDriver("default", "path")
12
+
13
+	checkFlags := &drivers.CheckDriverOptions{
14
+		FlagsValues: map[string]interface{}{
15
+			"openstack-auth-url":  "http://url",
16
+			"openstack-username":  "user",
17
+			"openstack-password":  "pwd",
18
+			"openstack-tenant-id": "ID",
19
+			"openstack-flavor-id": "ID",
20
+			"openstack-image-id":  "ID",
21
+		},
22
+		CreateFlags: driver.GetCreateFlags(),
23
+	}
24
+
25
+	err := driver.SetConfigFromFlags(checkFlags)
26
+
27
+	assert.NoError(t, err)
28
+	assert.Empty(t, checkFlags.InvalidFlags)
29
+}

Loading…
Cancel
Save