Merge pull request #943 from smarterclayton/only_wait_for_acceptance

Clients must wait for completion of actions
This commit is contained in:
brendandburns
2014-08-20 21:01:21 -07:00
13 changed files with 328 additions and 70 deletions

View File

@@ -48,7 +48,7 @@ func NewRegistryStorage(registry Registry, podRegistry pod.Registry) apiserver.R
}
}
// Create registers then given ReplicationController.
// Create registers the given ReplicationController.
func (rs *RegistryStorage) Create(obj interface{}) (<-chan interface{}, error) {
controller, ok := obj.(*api.ReplicationController)
if !ok {
@@ -70,7 +70,7 @@ func (rs *RegistryStorage) Create(obj interface{}) (<-chan interface{}, error) {
if err != nil {
return nil, err
}
return rs.waitForController(*controller)
return rs.registry.GetController(controller.ID)
}), nil
}
@@ -124,7 +124,7 @@ func (rs *RegistryStorage) Update(obj interface{}) (<-chan interface{}, error) {
if err != nil {
return nil, err
}
return rs.waitForController(*controller)
return rs.registry.GetController(controller.ID)
}), nil
}

View File

@@ -239,30 +239,10 @@ func TestCreateController(t *testing.T) {
}
select {
case <-channel:
// expected case
case <-time.After(time.Millisecond * 100):
// Do nothing, this is expected.
case <-channel:
t.Error("Unexpected read from async channel")
}
mockPodRegistry.Lock()
mockPodRegistry.Pods = []api.Pod{
{
JSONBase: api.JSONBase{ID: "foo"},
Labels: map[string]string{"a": "b"},
},
{
JSONBase: api.JSONBase{ID: "bar"},
Labels: map[string]string{"a": "b"},
},
}
mockPodRegistry.Unlock()
select {
case <-time.After(time.Second * 1):
t.Error("Unexpected timeout")
case <-channel:
// Do nothing, this is expected
t.Error("Unexpected timeout from async channel")
}
}