func TestCreatePod(t *testing.T) { mockRegistry := registrytest.PodRegistry{ Pod: &api.Pod{ JSONBase: api.JSONBase{ID: "foo"}, CurrentState: api.PodState{ Host: "machine", }, }, } storage := RegistryStorage{ registry: &mockRegistry, podPollPeriod: time.Millisecond * 100, scheduler: scheduler.MakeRoundRobinScheduler(), minionLister: minion.NewRegistry([]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. } }