Merge pull request #62787 from humblec/volumenameprefix-test

Automatic merge from submit-queue (batch tested with PRs 62803, 62787). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Add `volumenameprefix` tests for glusterfs dynamic provisioner.

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>



**What this PR does / why we need it**:

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note

```
This commit is contained in:
Kubernetes Submit Queue 2018-04-19 07:08:07 -07:00 committed by GitHub
commit 8306b692b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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{