mirror of https://github.com/knative/client.git
fix: Fix var initialization in lib/service function (#1107)
This commit is contained in:
parent
1b7985eac5
commit
9610c933b6
|
|
@ -43,16 +43,6 @@ type ExpectedRevisionListOption func(*servingv1.RevisionList)
|
||||||
// ExpectedKNExportOption enables further configuration of a Export.
|
// ExpectedKNExportOption enables further configuration of a Export.
|
||||||
type ExpectedKNExportOption func(*clientv1alpha1.Export)
|
type ExpectedKNExportOption func(*clientv1alpha1.Export)
|
||||||
|
|
||||||
var revisionSpec = servingv1.RevisionSpec{
|
|
||||||
PodSpec: corev1.PodSpec{
|
|
||||||
Containers: []corev1.Container{{
|
|
||||||
Image: pkgtest.ImagePath("helloworld"),
|
|
||||||
}},
|
|
||||||
EnableServiceLinks: ptr.Bool(false),
|
|
||||||
},
|
|
||||||
TimeoutSeconds: ptr.Int64(config.DefaultRevisionTimeoutSeconds),
|
|
||||||
}
|
|
||||||
|
|
||||||
// ServiceCreate verifies given service creation in sync mode and also verifies output
|
// ServiceCreate verifies given service creation in sync mode and also verifies output
|
||||||
func ServiceCreate(r *KnRunResultCollector, serviceName string) {
|
func ServiceCreate(r *KnRunResultCollector, serviceName string) {
|
||||||
out := r.KnTest().Kn().Run("service", "create", serviceName, "--image", pkgtest.ImagePath("helloworld"))
|
out := r.KnTest().Kn().Run("service", "create", serviceName, "--image", pkgtest.ImagePath("helloworld"))
|
||||||
|
|
@ -222,7 +212,7 @@ func BuildConfigurationSpec(co ...servingtest.ConfigOption) *servingv1.Configura
|
||||||
c := &servingv1.Configuration{
|
c := &servingv1.Configuration{
|
||||||
Spec: servingv1.ConfigurationSpec{
|
Spec: servingv1.ConfigurationSpec{
|
||||||
Template: servingv1.RevisionTemplateSpec{
|
Template: servingv1.RevisionTemplateSpec{
|
||||||
Spec: *revisionSpec.DeepCopy(),
|
Spec: *BuildRevisionSpec(pkgtest.ImagePath("helloworld")),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -233,6 +223,19 @@ func BuildConfigurationSpec(co ...servingtest.ConfigOption) *servingv1.Configura
|
||||||
return &c.Spec
|
return &c.Spec
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BuildRevisionSpec for provided image
|
||||||
|
func BuildRevisionSpec(image string) *servingv1.RevisionSpec {
|
||||||
|
return &servingv1.RevisionSpec{
|
||||||
|
PodSpec: corev1.PodSpec{
|
||||||
|
Containers: []corev1.Container{{
|
||||||
|
Image: image,
|
||||||
|
}},
|
||||||
|
EnableServiceLinks: ptr.Bool(false),
|
||||||
|
},
|
||||||
|
TimeoutSeconds: ptr.Int64(config.DefaultRevisionTimeoutSeconds),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// BuildServiceWithOptions returns ksvc with options provided
|
// BuildServiceWithOptions returns ksvc with options provided
|
||||||
func BuildServiceWithOptions(name string, so ...servingtest.ServiceOption) *servingv1.Service {
|
func BuildServiceWithOptions(name string, so ...servingtest.ServiceOption) *servingv1.Service {
|
||||||
svc := servingtest.ServiceWithoutNamespace(name, so...)
|
svc := servingtest.ServiceWithoutNamespace(name, so...)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue