func TestCreatePod(t *testing.T) {
	mockRegistry := MockPodRegistry{
		pod: &api.Pod{
			JSONBase: api.JSONBase{ID: "foo"},
			CurrentState: api.PodState{
				Host: "machine",
			},
		},
	}
	storage := PodRegistryStorage{
		registry:      &mockRegistry,
		podPollPeriod: time.Millisecond * 100,
		scheduler:     scheduler.MakeRoundRobinScheduler(),
		minionLister:  MakeMinionRegistry([]string{"machine"}),
	}
	desiredState := api.PodState{
		Manifest: api.ContainerManifest{
			Version: "v1beta1",
		},
	}
	pod := &api.Pod{
		JSONBase:     api.JSONBase{ID: "foo"},
		DesiredState: desiredState,
	}
	channel, err := storage.Create(pod)
	if err != nil {
		t.Errorf("unexpected error: %v", err)
	}

	select {
	case <-time.After(time.Millisecond * 100):
		// Do nothing, this is expected.
	case <-channel:
		t.Error("Unexpected read from async channel")
	}
	mockRegistry.UpdatePod(api.Pod{
		JSONBase: api.JSONBase{ID: "foo"},
		CurrentState: api.PodState{
			Status: api.PodRunning,
		},
	})
	select {
	case <-time.After(time.Second * 1):
		t.Error("Unexpected timeout")
	case <-channel:
		// Do nothing, this is expected.
	}
}
func TestCreatePod(t *testing.T) {
	mockRegistry := MockPodRegistry{
		pod: &api.Pod{
			JSONBase: api.JSONBase{ID: "foo"},
			CurrentState: api.PodState{
				Status: api.PodPending,
			},
		},
	}
	storage := PodRegistryStorage{
		registry:      &mockRegistry,
		podPollPeriod: time.Millisecond * 100,
		scheduler:     scheduler.MakeRoundRobinScheduler(),
		minionLister:  MakeMinionRegistry([]string{"machine"}),
	}
	pod := api.Pod{
		JSONBase: api.JSONBase{ID: "foo"},
	}
	channel, err := storage.Create(pod)
	expectNoError(t, err)
	select {
	case <-time.After(time.Millisecond * 100):
		// Do nothing, this is expected.
	case <-channel:
		t.Error("Unexpected read from async channel")
	}
	mockRegistry.UpdatePod(api.Pod{
		JSONBase: api.JSONBase{ID: "foo"},
		CurrentState: api.PodState{
			Status: api.PodRunning,
		},
	})
	select {
	case <-time.After(time.Second * 1):
		t.Error("Unexpected timeout")
	case <-channel:
		// Do nothing, this is expected.
	}
}