mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Make PodList span multiple lines for readability
This commit is contained in:
		@@ -552,7 +552,13 @@ func TestSyncPodsDeletesWhenSourcesAreReady(t *testing.T) {
 | 
				
			|||||||
	kubelet.sourcesReady = func() bool { return ready }
 | 
						kubelet.sourcesReady = func() bool { return ready }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fakeRuntime.PodList = []*kubecontainer.Pod{
 | 
						fakeRuntime.PodList = []*kubecontainer.Pod{
 | 
				
			||||||
		{ID: "12345678", Name: "foo", Namespace: "new", Containers: []*kubecontainer.Container{{Name: "bar"}}},
 | 
							{
 | 
				
			||||||
 | 
								ID:   "12345678",
 | 
				
			||||||
 | 
								Name: "foo", Namespace: "new",
 | 
				
			||||||
 | 
								Containers: []*kubecontainer.Container{
 | 
				
			||||||
 | 
									{Name: "bar"},
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if err := kubelet.SyncPods([]*api.Pod{}, emptyPodUIDs, map[string]*api.Pod{}, time.Now()); err != nil {
 | 
						if err := kubelet.SyncPods([]*api.Pod{}, emptyPodUIDs, map[string]*api.Pod{}, time.Now()); err != nil {
 | 
				
			||||||
		t.Errorf("unexpected error: %v", err)
 | 
							t.Errorf("unexpected error: %v", err)
 | 
				
			||||||
@@ -733,7 +739,17 @@ func TestGetContainerInfo(t *testing.T) {
 | 
				
			|||||||
	mockCadvisor := testKubelet.fakeCadvisor
 | 
						mockCadvisor := testKubelet.fakeCadvisor
 | 
				
			||||||
	mockCadvisor.On("DockerContainer", containerID, cadvisorReq).Return(containerInfo, nil)
 | 
						mockCadvisor.On("DockerContainer", containerID, cadvisorReq).Return(containerInfo, nil)
 | 
				
			||||||
	fakeRuntime.PodList = []*kubecontainer.Pod{
 | 
						fakeRuntime.PodList = []*kubecontainer.Pod{
 | 
				
			||||||
		{ID: "12345678", Name: "qux", Namespace: "ns", Containers: []*kubecontainer.Container{{Name: "foo", ID: types.UID(containerID)}}},
 | 
							{
 | 
				
			||||||
 | 
								ID:        "12345678",
 | 
				
			||||||
 | 
								Name:      "qux",
 | 
				
			||||||
 | 
								Namespace: "ns",
 | 
				
			||||||
 | 
								Containers: []*kubecontainer.Container{
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										Name: "foo",
 | 
				
			||||||
 | 
										ID:   types.UID(containerID),
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	stats, err := kubelet.GetContainerInfo("qux_ns", "", "foo", cadvisorReq)
 | 
						stats, err := kubelet.GetContainerInfo("qux_ns", "", "foo", cadvisorReq)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
@@ -806,7 +822,16 @@ func TestGetContainerInfoWhenCadvisorFailed(t *testing.T) {
 | 
				
			|||||||
	cadvisorReq := &cadvisorApi.ContainerInfoRequest{}
 | 
						cadvisorReq := &cadvisorApi.ContainerInfoRequest{}
 | 
				
			||||||
	mockCadvisor.On("DockerContainer", containerID, cadvisorReq).Return(containerInfo, cadvisorApiFailure)
 | 
						mockCadvisor.On("DockerContainer", containerID, cadvisorReq).Return(containerInfo, cadvisorApiFailure)
 | 
				
			||||||
	fakeRuntime.PodList = []*kubecontainer.Pod{
 | 
						fakeRuntime.PodList = []*kubecontainer.Pod{
 | 
				
			||||||
		{ID: "uuid", Name: "qux", Namespace: "ns", Containers: []*kubecontainer.Container{{Name: "foo", ID: types.UID(containerID)}}},
 | 
							{
 | 
				
			||||||
 | 
								ID:        "uuid",
 | 
				
			||||||
 | 
								Name:      "qux",
 | 
				
			||||||
 | 
								Namespace: "ns",
 | 
				
			||||||
 | 
								Containers: []*kubecontainer.Container{
 | 
				
			||||||
 | 
									{Name: "foo",
 | 
				
			||||||
 | 
										ID: types.UID(containerID),
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	stats, err := kubelet.GetContainerInfo("qux_ns", "uuid", "foo", cadvisorReq)
 | 
						stats, err := kubelet.GetContainerInfo("qux_ns", "uuid", "foo", cadvisorReq)
 | 
				
			||||||
	if stats != nil {
 | 
						if stats != nil {
 | 
				
			||||||
@@ -881,7 +906,15 @@ func TestGetContainerInfoWithNoMatchingContainers(t *testing.T) {
 | 
				
			|||||||
	kubelet := testKubelet.kubelet
 | 
						kubelet := testKubelet.kubelet
 | 
				
			||||||
	mockCadvisor := testKubelet.fakeCadvisor
 | 
						mockCadvisor := testKubelet.fakeCadvisor
 | 
				
			||||||
	fakeRuntime.PodList = []*kubecontainer.Pod{
 | 
						fakeRuntime.PodList = []*kubecontainer.Pod{
 | 
				
			||||||
		{ID: "12345678", Name: "qux", Namespace: "ns", Containers: []*kubecontainer.Container{{Name: "bar", ID: types.UID("fakeID")}}},
 | 
							{
 | 
				
			||||||
 | 
								ID:        "12345678",
 | 
				
			||||||
 | 
								Name:      "qux",
 | 
				
			||||||
 | 
								Namespace: "ns",
 | 
				
			||||||
 | 
								Containers: []*kubecontainer.Container{
 | 
				
			||||||
 | 
									{Name: "bar",
 | 
				
			||||||
 | 
										ID: types.UID("fakeID"),
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
								}},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	stats, err := kubelet.GetContainerInfo("qux_ns", "", "foo", nil)
 | 
						stats, err := kubelet.GetContainerInfo("qux_ns", "", "foo", nil)
 | 
				
			||||||
@@ -967,7 +1000,16 @@ func TestRunInContainer(t *testing.T) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	containerID := "abc1234"
 | 
						containerID := "abc1234"
 | 
				
			||||||
	fakeRuntime.PodList = []*kubecontainer.Pod{
 | 
						fakeRuntime.PodList = []*kubecontainer.Pod{
 | 
				
			||||||
		{ID: "12345678", Name: "podFoo", Namespace: "nsFoo", Containers: []*kubecontainer.Container{{Name: "containerFoo", ID: types.UID(containerID)}}},
 | 
							{
 | 
				
			||||||
 | 
								ID:        "12345678",
 | 
				
			||||||
 | 
								Name:      "podFoo",
 | 
				
			||||||
 | 
								Namespace: "nsFoo",
 | 
				
			||||||
 | 
								Containers: []*kubecontainer.Container{
 | 
				
			||||||
 | 
									{Name: "containerFoo",
 | 
				
			||||||
 | 
										ID: types.UID(containerID),
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	cmd := []string{"ls"}
 | 
						cmd := []string{"ls"}
 | 
				
			||||||
	_, err := kubelet.RunInContainer("podFoo_nsFoo", "", "containerFoo", cmd)
 | 
						_, err := kubelet.RunInContainer("podFoo_nsFoo", "", "containerFoo", cmd)
 | 
				
			||||||
@@ -1942,7 +1984,15 @@ func TestExecInContainerNoSuchContainer(t *testing.T) {
 | 
				
			|||||||
	podNamespace := "nsFoo"
 | 
						podNamespace := "nsFoo"
 | 
				
			||||||
	containerID := "containerFoo"
 | 
						containerID := "containerFoo"
 | 
				
			||||||
	fakeRuntime.PodList = []*kubecontainer.Pod{
 | 
						fakeRuntime.PodList = []*kubecontainer.Pod{
 | 
				
			||||||
		{ID: "12345678", Name: podName, Namespace: podNamespace, Containers: []*kubecontainer.Container{{Name: "bar", ID: "barID"}}},
 | 
							{
 | 
				
			||||||
 | 
								ID:        "12345678",
 | 
				
			||||||
 | 
								Name:      podName,
 | 
				
			||||||
 | 
								Namespace: podNamespace,
 | 
				
			||||||
 | 
								Containers: []*kubecontainer.Container{
 | 
				
			||||||
 | 
									{Name: "bar",
 | 
				
			||||||
 | 
										ID: "barID"},
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err := kubelet.ExecInContainer(
 | 
						err := kubelet.ExecInContainer(
 | 
				
			||||||
@@ -1997,8 +2047,16 @@ func TestExecInContainer(t *testing.T) {
 | 
				
			|||||||
	stderr := &fakeReadWriteCloser{}
 | 
						stderr := &fakeReadWriteCloser{}
 | 
				
			||||||
	tty := true
 | 
						tty := true
 | 
				
			||||||
	fakeRuntime.PodList = []*kubecontainer.Pod{
 | 
						fakeRuntime.PodList = []*kubecontainer.Pod{
 | 
				
			||||||
		{ID: "12345678", Name: podName, Namespace: podNamespace, Containers: []*kubecontainer.Container{
 | 
							{
 | 
				
			||||||
			{Name: containerID, ID: types.UID(containerID)}}},
 | 
								ID:        "12345678",
 | 
				
			||||||
 | 
								Name:      podName,
 | 
				
			||||||
 | 
								Namespace: podNamespace,
 | 
				
			||||||
 | 
								Containers: []*kubecontainer.Container{
 | 
				
			||||||
 | 
									{Name: containerID,
 | 
				
			||||||
 | 
										ID: types.UID(containerID),
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err := kubelet.ExecInContainer(
 | 
						err := kubelet.ExecInContainer(
 | 
				
			||||||
@@ -2076,7 +2134,15 @@ func TestPortForwardNoSuchContainer(t *testing.T) {
 | 
				
			|||||||
	var port uint16 = 5000
 | 
						var port uint16 = 5000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fakeRuntime.PodList = []*kubecontainer.Pod{
 | 
						fakeRuntime.PodList = []*kubecontainer.Pod{
 | 
				
			||||||
		{ID: "12345678", Name: podName, Namespace: podNamespace, Containers: []*kubecontainer.Container{{Name: "bar", ID: "barID"}}},
 | 
							{
 | 
				
			||||||
 | 
								ID:        "12345678",
 | 
				
			||||||
 | 
								Name:      podName,
 | 
				
			||||||
 | 
								Namespace: podNamespace,
 | 
				
			||||||
 | 
								Containers: []*kubecontainer.Container{
 | 
				
			||||||
 | 
									{Name: "bar",
 | 
				
			||||||
 | 
										ID: "barID"},
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err := kubelet.PortForward(
 | 
						err := kubelet.PortForward(
 | 
				
			||||||
@@ -2898,8 +2964,17 @@ func TestGetContainerInfoForMirrorPods(t *testing.T) {
 | 
				
			|||||||
	kubelet := testKubelet.kubelet
 | 
						kubelet := testKubelet.kubelet
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fakeRuntime.PodList = []*kubecontainer.Pod{
 | 
						fakeRuntime.PodList = []*kubecontainer.Pod{
 | 
				
			||||||
		{ID: "1234", Name: "qux", Namespace: "ns", Containers: []*kubecontainer.Container{
 | 
							{
 | 
				
			||||||
			{Name: "foo", ID: types.UID(containerID)}}},
 | 
								ID:        "1234",
 | 
				
			||||||
 | 
								Name:      "qux",
 | 
				
			||||||
 | 
								Namespace: "ns",
 | 
				
			||||||
 | 
								Containers: []*kubecontainer.Container{
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										Name: "foo",
 | 
				
			||||||
 | 
										ID:   types.UID(containerID),
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	kubelet.podManager.SetPods(pods)
 | 
						kubelet.podManager.SetPods(pods)
 | 
				
			||||||
@@ -3265,7 +3340,14 @@ func TestSyncPodsSetStatusToFailedForPodsThatRunTooLong(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fakeRuntime.PodList = []*kubecontainer.Pod{
 | 
						fakeRuntime.PodList = []*kubecontainer.Pod{
 | 
				
			||||||
		{ID: "12345678", Name: "bar", Namespace: "new", Containers: []*kubecontainer.Container{{Name: "foo"}}},
 | 
							{
 | 
				
			||||||
 | 
								ID:        "12345678",
 | 
				
			||||||
 | 
								Name:      "bar",
 | 
				
			||||||
 | 
								Namespace: "new",
 | 
				
			||||||
 | 
								Containers: []*kubecontainer.Container{
 | 
				
			||||||
 | 
									{Name: "foo"},
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Let the pod worker sets the status to fail after this sync.
 | 
						// Let the pod worker sets the status to fail after this sync.
 | 
				
			||||||
@@ -3313,7 +3395,14 @@ func TestSyncPodsDoesNotSetPodsThatDidNotRunTooLongToFailed(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fakeRuntime.PodList = []*kubecontainer.Pod{
 | 
						fakeRuntime.PodList = []*kubecontainer.Pod{
 | 
				
			||||||
		{ID: "12345678", Name: "bar", Namespace: "new", Containers: []*kubecontainer.Container{{Name: "foo"}}},
 | 
							{
 | 
				
			||||||
 | 
								ID:        "12345678",
 | 
				
			||||||
 | 
								Name:      "bar",
 | 
				
			||||||
 | 
								Namespace: "new",
 | 
				
			||||||
 | 
								Containers: []*kubecontainer.Container{
 | 
				
			||||||
 | 
									{Name: "foo"},
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	kubelet.podManager.SetPods(pods)
 | 
						kubelet.podManager.SetPods(pods)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user