convert EndpointNamespace showing string rather than pointer
Signed-off-by: Zou Nengren <zouyee1989@gmail.com> Kubernetes-commit: 96928b9f8b6df751815fe49007cfc73272cc1cdb
This commit is contained in:
		
							parent
							
								
									fd71b0d816
								
							
						
					
					
						commit
						90d15aea78
					
				| 
						 | 
				
			
			@ -997,12 +997,16 @@ func printGlusterfsVolumeSource(glusterfs *corev1.GlusterfsVolumeSource, w Prefi
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
func printGlusterfsPersistentVolumeSource(glusterfs *corev1.GlusterfsPersistentVolumeSource, w PrefixWriter) {
 | 
			
		||||
	endpointsNamespace := "<unset>"
 | 
			
		||||
	if glusterfs.EndpointsNamespace != nil {
 | 
			
		||||
		endpointsNamespace = *glusterfs.EndpointsNamespace
 | 
			
		||||
	}
 | 
			
		||||
	w.Write(LEVEL_2, "Type:\tGlusterfs (a Glusterfs mount on the host that shares a pod's lifetime)\n"+
 | 
			
		||||
		"    EndpointsName:\t%v\n"+
 | 
			
		||||
		"    EndpointsNamespace:\t%v\n"+
 | 
			
		||||
		"    Path:\t%v\n"+
 | 
			
		||||
		"    ReadOnly:\t%v\n",
 | 
			
		||||
		glusterfs.EndpointsName, glusterfs.EndpointsNamespace, glusterfs.Path, glusterfs.ReadOnly)
 | 
			
		||||
		glusterfs.EndpointsName, endpointsNamespace, glusterfs.Path, glusterfs.ReadOnly)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func printPersistentVolumeClaimVolumeSource(claim *corev1.PersistentVolumeClaimVolumeSource, w PrefixWriter) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -937,6 +937,7 @@ func TestGetPodsTotalRequests(t *testing.T) {
 | 
			
		|||
func TestPersistentVolumeDescriber(t *testing.T) {
 | 
			
		||||
	block := corev1.PersistentVolumeBlock
 | 
			
		||||
	file := corev1.PersistentVolumeFilesystem
 | 
			
		||||
	foo := "glusterfsendpointname"
 | 
			
		||||
	deletionTimestamp := metav1.Time{Time: time.Now().UTC().AddDate(-10, 0, 0)}
 | 
			
		||||
	testCases := []struct {
 | 
			
		||||
		name               string
 | 
			
		||||
| 
						 | 
				
			
			@ -1023,6 +1024,7 @@ func TestPersistentVolumeDescriber(t *testing.T) {
 | 
			
		|||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			expectedElements:   []string{"EndpointsNamespace", "<unset>"},
 | 
			
		||||
			unexpectedElements: []string{"VolumeMode", "Filesystem"},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
| 
						 | 
				
			
			@ -1273,6 +1275,22 @@ func TestPersistentVolumeDescriber(t *testing.T) {
 | 
			
		|||
			},
 | 
			
		||||
			expectedElements: []string{"Driver", "VolumeHandle", "ReadOnly", "VolumeAttributes"},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name:   "test19",
 | 
			
		||||
			plugin: "gluster",
 | 
			
		||||
			pv: &corev1.PersistentVolume{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{Name: "bar"},
 | 
			
		||||
				Spec: corev1.PersistentVolumeSpec{
 | 
			
		||||
					PersistentVolumeSource: corev1.PersistentVolumeSource{
 | 
			
		||||
						Glusterfs: &corev1.GlusterfsPersistentVolumeSource{
 | 
			
		||||
							EndpointsNamespace: &foo,
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			expectedElements:   []string{"EndpointsNamespace", "glusterfsendpointname"},
 | 
			
		||||
			unexpectedElements: []string{"VolumeMode", "Filesystem"},
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for _, test := range testCases {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue