Commit 19f73899 authored by changyaowei's avatar changyaowei

modify test case

parent c70ee427
...@@ -44,11 +44,11 @@ type TestGenericPLEG struct { ...@@ -44,11 +44,11 @@ type TestGenericPLEG struct {
clock *clock.FakeClock clock *clock.FakeClock
} }
func newTestGenericPLEGWithLargeChannel() *TestGenericPLEG { func newTestGenericPLEG() *TestGenericPLEG {
return newTestGenericPLEG(largeChannelCap) return newTestGenericPLEGWithChannelSize(largeChannelCap)
} }
func newTestGenericPLEG(eventChannelCap int) *TestGenericPLEG { func newTestGenericPLEGWithChannelSize(eventChannelCap int) *TestGenericPLEG {
fakeRuntime := &containertest.FakeRuntime{} fakeRuntime := &containertest.FakeRuntime{}
clock := clock.NewFakeClock(time.Time{}) clock := clock.NewFakeClock(time.Time{})
// The channel capacity should be large enough to hold all events in a // The channel capacity should be large enough to hold all events in a
...@@ -99,7 +99,7 @@ func verifyEvents(t *testing.T, expected, actual []*PodLifecycleEvent) { ...@@ -99,7 +99,7 @@ func verifyEvents(t *testing.T, expected, actual []*PodLifecycleEvent) {
} }
func TestRelisting(t *testing.T) { func TestRelisting(t *testing.T) {
testPleg := newTestGenericPLEGWithLargeChannel() testPleg := newTestGenericPLEG()
pleg, runtime := testPleg.pleg, testPleg.runtime pleg, runtime := testPleg.pleg, testPleg.runtime
ch := pleg.Watch() ch := pleg.Watch()
// The first relist should send a PodSync event to each pod. // The first relist should send a PodSync event to each pod.
...@@ -165,7 +165,7 @@ func TestRelisting(t *testing.T) { ...@@ -165,7 +165,7 @@ func TestRelisting(t *testing.T) {
// TestEventChannelFull test when channel is full, the events will be discard. // TestEventChannelFull test when channel is full, the events will be discard.
func TestEventChannelFull(t *testing.T) { func TestEventChannelFull(t *testing.T) {
testPleg := newTestGenericPLEG(4) testPleg := newTestGenericPLEGWithChannelSize(4)
pleg, runtime := testPleg.pleg, testPleg.runtime pleg, runtime := testPleg.pleg, testPleg.runtime
ch := pleg.Watch() ch := pleg.Watch()
// The first relist should send a PodSync event to each pod. // The first relist should send a PodSync event to each pod.
...@@ -233,7 +233,7 @@ func TestDetectingContainerDeaths(t *testing.T) { ...@@ -233,7 +233,7 @@ func TestDetectingContainerDeaths(t *testing.T) {
} }
func testReportMissingContainers(t *testing.T, numRelists int) { func testReportMissingContainers(t *testing.T, numRelists int) {
testPleg := newTestGenericPLEGWithLargeChannel() testPleg := newTestGenericPLEG()
pleg, runtime := testPleg.pleg, testPleg.runtime pleg, runtime := testPleg.pleg, testPleg.runtime
ch := pleg.Watch() ch := pleg.Watch()
runtime.AllPodList = []*containertest.FakePod{ runtime.AllPodList = []*containertest.FakePod{
...@@ -274,7 +274,7 @@ func testReportMissingContainers(t *testing.T, numRelists int) { ...@@ -274,7 +274,7 @@ func testReportMissingContainers(t *testing.T, numRelists int) {
} }
func testReportMissingPods(t *testing.T, numRelists int) { func testReportMissingPods(t *testing.T, numRelists int) {
testPleg := newTestGenericPLEGWithLargeChannel() testPleg := newTestGenericPLEG()
pleg, runtime := testPleg.pleg, testPleg.runtime pleg, runtime := testPleg.pleg, testPleg.runtime
ch := pleg.Watch() ch := pleg.Watch()
runtime.AllPodList = []*containertest.FakePod{ runtime.AllPodList = []*containertest.FakePod{
...@@ -410,7 +410,7 @@ func TestRemoveCacheEntry(t *testing.T) { ...@@ -410,7 +410,7 @@ func TestRemoveCacheEntry(t *testing.T) {
} }
func TestHealthy(t *testing.T) { func TestHealthy(t *testing.T) {
testPleg := newTestGenericPLEGWithLargeChannel() testPleg := newTestGenericPLEG()
// pleg should initially be unhealthy // pleg should initially be unhealthy
pleg, _, clock := testPleg.pleg, testPleg.runtime, testPleg.clock pleg, _, clock := testPleg.pleg, testPleg.runtime, testPleg.clock
...@@ -506,7 +506,7 @@ func TestRelistWithReinspection(t *testing.T) { ...@@ -506,7 +506,7 @@ func TestRelistWithReinspection(t *testing.T) {
// Test detecting sandbox state changes. // Test detecting sandbox state changes.
func TestRelistingWithSandboxes(t *testing.T) { func TestRelistingWithSandboxes(t *testing.T) {
testPleg := newTestGenericPLEGWithLargeChannel() testPleg := newTestGenericPLEG()
pleg, runtime := testPleg.pleg, testPleg.runtime pleg, runtime := testPleg.pleg, testPleg.runtime
ch := pleg.Watch() ch := pleg.Watch()
// The first relist should send a PodSync event to each pod. // The first relist should send a PodSync event to each pod.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment