diff --git a/pkg/kn/commands/service/service_update_test.go b/pkg/kn/commands/service/service_update_test.go index dbd7192ada..916a55ea44 100644 --- a/pkg/kn/commands/service/service_update_test.go +++ b/pkg/kn/commands/service/service_update_test.go @@ -67,7 +67,7 @@ func fakeServiceUpdate(original *v1alpha1.Service, args []string) ( } func TestServiceUpdateRevisionNameExplicit(t *testing.T) { - orig := newEmptyService() + orig := newEmptyServiceBeta() template, err := servinglib.RevisionTemplateOfService(orig) if err != nil { @@ -102,7 +102,7 @@ func TestServiceUpdateRevisionNameExplicit(t *testing.T) { } func TestServiceUpdateRevisionNameGenerated(t *testing.T) { - orig := newEmptyService() + orig := newEmptyServiceBeta() template, err := servinglib.RevisionTemplateOfService(orig) if err != nil { @@ -126,7 +126,7 @@ func TestServiceUpdateRevisionNameGenerated(t *testing.T) { } func TestServiceUpdateRevisionNameCleared(t *testing.T) { - orig := newEmptyService() + orig := newEmptyServiceBeta() template, err := servinglib.RevisionTemplateOfService(orig) if err != nil { @@ -150,7 +150,7 @@ func TestServiceUpdateRevisionNameCleared(t *testing.T) { } func TestServiceUpdateRevisionNameNoMutationNoChange(t *testing.T) { - orig := newEmptyService() + orig := newEmptyServiceBeta() template, err := servinglib.RevisionTemplateOfService(orig) if err != nil { @@ -439,6 +439,23 @@ func newEmptyService() *v1alpha1.Service { } } +func newEmptyServiceBeta() *v1alpha1.Service { + ret := &v1alpha1.Service{ + TypeMeta: metav1.TypeMeta{ + Kind: "Service", + APIVersion: "knative.dev/v1alpha1", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: "foo", + Namespace: "default", + }, + Spec: v1alpha1.ServiceSpec{}, + } + ret.Spec.Template = &v1alpha1.RevisionTemplateSpec{} + ret.Spec.Template.Spec.Containers = []corev1.Container{{}} + return ret +} + func createMockServiceWithResources(t *testing.T, requestCPU, requestMemory, limitsCPU, limitsMemory string) *v1alpha1.Service { service := &v1alpha1.Service{ TypeMeta: metav1.TypeMeta{