Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Hui Kang committed Jun 15, 2021
1 parent bbae2a9 commit 73a4cad
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions pkg/kubectl-argo-rollouts/cmd/undo/undo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,34 +120,6 @@ func TestUndoCmdToRevision(t *testing.T) {
}

func TestUndoCmdToRevisionOfWorkloadRef(t *testing.T) {
rolloutObjs := testdata.NewCanaryRollout()
ro := rolloutObjs.Rollouts[1]
ro.Spec.Template = corev1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Name: "test",
},
}
tf, o := options.NewFakeArgoRolloutsOptions(rolloutObjs.AllObjects()...)
o.RESTClientGetter = tf.WithNamespace(ro.Namespace)
defer tf.Cleanup()
cmd := NewCmdUndo(o)
cmd.PersistentPreRunE = o.PersistentPreRunE
cmd.SetArgs([]string{ro.Name, "--to-revision=29"})

err := cmd.Execute()
assert.Nil(t, err)

// Verify the current RS has been patched by the oldRS's template
currentRs, _ := o.KubeClient.AppsV1().ReplicaSets(ro.Namespace).Get(context.TODO(), "canary-demo-65fb5ffc84", metav1.GetOptions{})
assert.Equal(t, "argoproj/rollouts-demo:asdf", currentRs.Spec.Template.Spec.Containers[0].Image)

stdout := o.Out.(*bytes.Buffer).String()
stderr := o.ErrOut.(*bytes.Buffer).String()
assert.Equal(t, fmt.Sprintf("rollout '%s' undo\n", ro.Name), stdout)
assert.Empty(t, stderr)
}

func TestUndoCmdToRevisionOfWorkloadRefs(t *testing.T) {

roTests := []struct {
idx int
Expand Down

0 comments on commit 73a4cad

Please sign in to comment.