mirror of https://github.com/knative/client.git
service describe command : Move Cluster URL to --verbose from default output (#543)
* move cluster url to verbose in svc desc * move cluster url to verbose in svc desc
This commit is contained in:
parent
5deba393cb
commit
8e010d0cbd
|
|
@ -162,10 +162,12 @@ func describe(w io.Writer, service *v1alpha1.Service, revisions []*revisionDesc,
|
||||||
func writeService(dw printers.PrefixWriter, service *v1alpha1.Service) {
|
func writeService(dw printers.PrefixWriter, service *v1alpha1.Service) {
|
||||||
commands.WriteMetadata(dw, &service.ObjectMeta, printDetails)
|
commands.WriteMetadata(dw, &service.ObjectMeta, printDetails)
|
||||||
dw.WriteAttribute("URL", extractURL(service))
|
dw.WriteAttribute("URL", extractURL(service))
|
||||||
|
if printDetails {
|
||||||
if service.Status.Address != nil {
|
if service.Status.Address != nil {
|
||||||
url := service.Status.Address.GetURL()
|
url := service.Status.Address.GetURL()
|
||||||
dw.WriteAttribute("Cluster", url.String())
|
dw.WriteAttribute("Cluster", url.String())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (service.Spec.Template != nil) && (service.Spec.Template.Spec.ServiceAccountName != "") {
|
if (service.Spec.Template != nil) && (service.Spec.Template.Spec.ServiceAccountName != "") {
|
||||||
dw.WriteAttribute("ServiceAccount", service.Spec.Template.Spec.ServiceAccountName)
|
dw.WriteAttribute("ServiceAccount", service.Spec.Template.Spec.ServiceAccountName)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -292,6 +292,7 @@ func TestServiceDescribeScaling(t *testing.T) {
|
||||||
} else {
|
} else {
|
||||||
assert.Assert(t, !strings.Contains(output, "Concurrency:"))
|
assert.Assert(t, !strings.Contains(output, "Concurrency:"))
|
||||||
}
|
}
|
||||||
|
assert.Assert(t, cmp.Regexp("Cluster:\\s+http://foo.default.svc.cluster.local", output))
|
||||||
|
|
||||||
validateOutputLine(t, output, "Scale", data.scaleOut)
|
validateOutputLine(t, output, "Scale", data.scaleOut)
|
||||||
validateOutputLine(t, output, "Limit", data.limit)
|
validateOutputLine(t, output, "Limit", data.limit)
|
||||||
|
|
@ -355,6 +356,8 @@ func TestServiceDescribeResources(t *testing.T) {
|
||||||
|
|
||||||
validateServiceOutput(t, "foo", output)
|
validateServiceOutput(t, "foo", output)
|
||||||
|
|
||||||
|
assert.Assert(t, cmp.Regexp("Cluster:\\s+http://foo.default.svc.cluster.local", output))
|
||||||
|
|
||||||
validateOutputLine(t, output, "Memory", data.memoryOut)
|
validateOutputLine(t, output, "Memory", data.memoryOut)
|
||||||
validateOutputLine(t, output, "CPU", data.cpuOut)
|
validateOutputLine(t, output, "CPU", data.cpuOut)
|
||||||
|
|
||||||
|
|
@ -450,6 +453,7 @@ func TestServiceDescribeVerbose(t *testing.T) {
|
||||||
|
|
||||||
validateServiceOutput(t, "foo", output)
|
validateServiceOutput(t, "foo", output)
|
||||||
|
|
||||||
|
assert.Assert(t, cmp.Regexp("Cluster:\\s+http://foo.default.svc.cluster.local", output))
|
||||||
assert.Assert(t, util.ContainsAll(output, "Image", "Name", "gcr.io/test/image (at 123456)", "50%", "(0s)"))
|
assert.Assert(t, util.ContainsAll(output, "Image", "Name", "gcr.io/test/image (at 123456)", "50%", "(0s)"))
|
||||||
assert.Assert(t, util.ContainsAll(output, "Env:", "label1=lval1\n", "label2=lval2\n"))
|
assert.Assert(t, util.ContainsAll(output, "Env:", "label1=lval1\n", "label2=lval2\n"))
|
||||||
assert.Assert(t, util.ContainsAll(output, "Annotations:", "anno1=aval1\n", "anno2=aval2\n"))
|
assert.Assert(t, util.ContainsAll(output, "Annotations:", "anno1=aval1\n", "anno2=aval2\n"))
|
||||||
|
|
@ -489,7 +493,6 @@ func TestServiceDescribeMachineReadable(t *testing.T) {
|
||||||
func validateServiceOutput(t *testing.T, service string, output string) {
|
func validateServiceOutput(t *testing.T, service string, output string) {
|
||||||
assert.Assert(t, cmp.Regexp("Name:\\s+"+service, output))
|
assert.Assert(t, cmp.Regexp("Name:\\s+"+service, output))
|
||||||
assert.Assert(t, cmp.Regexp("Namespace:\\s+default", output))
|
assert.Assert(t, cmp.Regexp("Namespace:\\s+default", output))
|
||||||
assert.Assert(t, cmp.Regexp("Cluster:\\s+http://"+service+".default.svc.cluster.local", output))
|
|
||||||
assert.Assert(t, cmp.Regexp("URL:\\s+"+service+".default.example.com", output))
|
assert.Assert(t, cmp.Regexp("URL:\\s+"+service+".default.example.com", output))
|
||||||
|
|
||||||
assert.Assert(t, util.ContainsAll(output, "Age:", "Revisions:", "Conditions:", "Labels:", "Annotations:"))
|
assert.Assert(t, util.ContainsAll(output, "Age:", "Revisions:", "Conditions:", "Labels:", "Annotations:"))
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ func (test *e2eTest) serviceDescribe(t *testing.T, serviceName string) {
|
||||||
|
|
||||||
assert.Assert(t, util.ContainsAll(out, serviceName, test.kn.namespace, KnDefaultTestImage))
|
assert.Assert(t, util.ContainsAll(out, serviceName, test.kn.namespace, KnDefaultTestImage))
|
||||||
assert.Assert(t, util.ContainsAll(out, "Conditions", "ConfigurationsReady", "Ready", "RoutesReady"))
|
assert.Assert(t, util.ContainsAll(out, "Conditions", "ConfigurationsReady", "Ready", "RoutesReady"))
|
||||||
assert.Assert(t, util.ContainsAll(out, "Name", "Namespace", "URL", "Cluster", "Age", "Revisions"))
|
assert.Assert(t, util.ContainsAll(out, "Name", "Namespace", "URL", "Age", "Revisions"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (test *e2eTest) serviceUpdate(t *testing.T, serviceName string, args []string) {
|
func (test *e2eTest) serviceUpdate(t *testing.T, serviceName string, args []string) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue