ScaleIO - API source code update

This commit tracks all human-generated code for API source updates.
This commit is contained in:
Vladimir Vivien
2017-10-13 22:57:37 -04:00
parent 7b588817ca
commit 3fb3cc7122
14 changed files with 455 additions and 154 deletions

View File

@@ -25,6 +25,7 @@ import (
api "k8s.io/api/core/v1"
utiltesting "k8s.io/client-go/util/testing"
"k8s.io/kubernetes/pkg/volume"
)
var (
@@ -48,7 +49,7 @@ var (
confKey.gateway: "http://sio/",
confKey.volSpecName: testSioVolName,
confKey.volumeName: "sio-vol",
confKey.secretRef: "sio-secret",
confKey.secretName: "sio-secret",
confKey.protectionDomain: "defaultPD",
confKey.storagePool: "deraultSP",
confKey.fsType: "xfs",
@@ -60,7 +61,7 @@ var (
func TestUtilMapVolumeSource(t *testing.T) {
data := make(map[string]string)
mapVolumeSource(data, vol.VolumeSource.ScaleIO)
mapVolumeSpec(data, volume.NewSpecFromVolume(vol))
if data[confKey.gateway] != "http://test.scaleio:1111" {
t.Error("Unexpected gateway value")
}
@@ -79,9 +80,6 @@ func TestUtilMapVolumeSource(t *testing.T) {
if data[confKey.fsType] != "ext4" {
t.Error("Unexpected fstype value")
}
if data[confKey.secretRef] != "test-secret" {
t.Error("Unexpected secret ref value")
}
if data[confKey.sslEnabled] != "false" {
t.Error("Unexpected sslEnabled value")
}
@@ -92,8 +90,8 @@ func TestUtilMapVolumeSource(t *testing.T) {
func TestUtilValidateConfigs(t *testing.T) {
data := map[string]string{
confKey.secretRef: "sio-secret",
confKey.system: "sio",
confKey.secretName: "sio-secret",
confKey.system: "sio",
}
if err := validateConfigs(data); err != gatewayNotProvidedErr {
t.Error("Expecting error for missing gateway, but did not get it")
@@ -105,7 +103,7 @@ func TestUtilApplyConfigDefaults(t *testing.T) {
confKey.system: "sio",
confKey.gateway: "http://sio/",
confKey.volumeName: "sio-vol",
confKey.secretRef: "test-secret",
confKey.secretName: "test-secret",
}
applyConfigDefaults(data)
@@ -130,7 +128,7 @@ func TestUtilApplyConfigDefaults(t *testing.T) {
if data[confKey.storageMode] != "ThinProvisioned" {
t.Error("Unexpected storage mode value")
}
if data[confKey.secretRef] != "test-secret" {
if data[confKey.secretName] != "test-secret" {
t.Error("Unexpected secret ref value")
}
if data[confKey.sslEnabled] != "false" {
@@ -157,7 +155,7 @@ func TestUtilSaveConfig(t *testing.T) {
config := path.Join(tmpDir, testConfigFile)
data := map[string]string{
confKey.gateway: "https://test-gateway/",
confKey.secretRef: "sio-secret",
confKey.secretName: "sio-secret",
confKey.sslEnabled: "false",
}
if err := saveConfig(config, data); err != nil {
@@ -178,7 +176,7 @@ func TestUtilSaveConfig(t *testing.T) {
}
func TestUtilAttachSecret(t *testing.T) {
plugMgr, tmpDir := newPluginMgr(t)
plugMgr, tmpDir := newPluginMgr(t, makeScaleIOSecret(testSecret, testns))
defer os.RemoveAll(tmpDir)
plug, err := plugMgr.FindPluginByName(sioPluginName)