Merge pull request #42458 from enisoc/e2e-resize-rc

e2e/framework: Deflake cleanup of RCs in service_util.
This commit is contained in:
Clayton Coleman 2017-03-02 22:36:20 -05:00 committed by GitHub
commit 815b340f8d

View File

@ -844,15 +844,11 @@ func (t *ServiceTestFixture) Cleanup() []error {
for rcName := range t.rcs {
By("stopping RC " + rcName + " in namespace " + t.Namespace)
// First, resize the RC to 0.
old, err := t.Client.Core().ReplicationControllers(t.Namespace).Get(rcName, metav1.GetOptions{})
patch := `{"spec":{"replicas":0}}`
_, err := t.Client.Core().ReplicationControllers(t.Namespace).Patch(rcName, types.StrategicMergePatchType, []byte(patch))
if err != nil {
errs = append(errs, err)
}
x := int32(0)
old.Spec.Replicas = &x
if _, err := t.Client.Core().ReplicationControllers(t.Namespace).Update(old); err != nil {
errs = append(errs, err)
}
// TODO(mikedanese): Wait.
// Then, delete the RC altogether.
if err := t.Client.Core().ReplicationControllers(t.Namespace).Delete(rcName, nil); err != nil {