From cecc3390ae1491adb708e34c23e5febbc1c31f88 Mon Sep 17 00:00:00 2001 From: Humble Chirammal Date: Wed, 18 Apr 2018 19:10:10 +0530 Subject: [PATCH] Add volumenameprefix tests for glusterfs dynamic provisioner. Signed-off-by: Humble Chirammal --- pkg/volume/glusterfs/glusterfs_test.go | 45 ++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/pkg/volume/glusterfs/glusterfs_test.go b/pkg/volume/glusterfs/glusterfs_test.go index 266e69bda5d..2e8d0af83dc 100644 --- a/pkg/volume/glusterfs/glusterfs_test.go +++ b/pkg/volume/glusterfs/glusterfs_test.go @@ -534,6 +534,29 @@ func TestParseClassParameters(t *testing.T) { thinPoolSnapFactor: float32(50), }, }, + + { + "valid volumenameprefix: dept-dev", + map[string]string{ + "resturl": "https://localhost:8080", + "restauthenabled": "false", + "gidMin": "4000", + "gidMax": "5000", + "volumetype": "disperse:4:2", + "snapfactor": "50", + "volumenameprefix": "dept-dev", + }, + &secret, + false, // expect error + &provisionerConfig{ + url: "https://localhost:8080", + gidMin: 4000, + gidMax: 5000, + volumeType: gapi.VolumeDurabilityInfo{Type: "disperse", Replicate: gapi.ReplicaDurability{Replica: 0}, Disperse: gapi.DisperseDurability{Data: 4, Redundancy: 2}}, + thinPoolSnapFactor: float32(50), + volumeNamePrefix: "dept-dev", + }, + }, { "invalid volumetype (disperse) parameter", map[string]string{ @@ -589,6 +612,28 @@ func TestParseClassParameters(t *testing.T) { true, // expect error nil, }, + { + "invalid volumenameprefix: string starting with '_'", + map[string]string{ + "resturl": "https://localhost:8080", + "restauthenabled": "false", + "volumenameprefix": "_", + }, + &secret, + true, // expect error + nil, + }, + { + "invalid volumenameprefix: string with '_'", + map[string]string{ + "resturl": "https://localhost:8080", + "restauthenabled": "false", + "volumenameprefix": "qe_dept", + }, + &secret, + true, // expect error + nil, + }, { "invalid thinPoolSnapFactor: value out of range", map[string]string{