Skip to content

Commit

Permalink
fix tests again
Browse files Browse the repository at this point in the history
  • Loading branch information
sixolet committed Jul 20, 2019
1 parent 0eb0c77 commit 5baceca
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions pkg/kn/commands/service/service_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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{
Expand Down

0 comments on commit 5baceca

Please sign in to comment.