Merge pull request #51258 from dixudx/fix_hostpath_fuzzer

Automatic merge from submit-queue

fix fuzzer for hostpath type that the path can be an empty string

**What this PR does / why we need it**:
It seems the path of `HostPath` generated by fuzzer can be an empty string. This is causing [pull-kubernetes-unit](https://k8s-gubernator.appspot.com/builds/kubernetes-jenkins/pr-logs/directory/pull-kubernetes-unit) failing.

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

**Special notes for your reviewer**:
/assign @thockin @luxas @ixdy 

**Release note**:

```release-note
None
```
This commit is contained in:
Kubernetes Submit Queue 2017-08-24 19:05:55 -07:00 committed by GitHub
commit 657db0eae7

View File

@ -360,7 +360,7 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
types := []api.HostPathType{api.HostPathUnset, api.HostPathDirectoryOrCreate, api.HostPathDirectory,
api.HostPathFileOrCreate, api.HostPathFile, api.HostPathSocket, api.HostPathCharDev, api.HostPathBlockDev}
typeVol := types[c.Rand.Intn(len(types))]
if obj.Path != "" && obj.Type == nil {
if obj.Type == nil {
obj.Type = &typeVol
}
},