testing config/secrets are showing in pretty print

Signed-off-by: Essam A. Hassan <es.hassan187@gmail.com>
This commit is contained in:
Essam A. Hassan 2018-04-16 01:39:41 +02:00
parent 2b1f27ea5e
commit 8238644796
1 changed files with 13 additions and 0 deletions

View File

@ -48,12 +48,18 @@ func formatServiceInspect(t *testing.T, format formatter.Format, now time.Time)
{
ConfigID: "mtc3i44r1awdoziy2iceg73z8",
ConfigName: "configtest.conf",
File: &swarm.ConfigReferenceFileTarget{
Name: "/configtest.conf",
},
},
},
Secrets: []*swarm.SecretReference{
{
SecretID: "3hv39ehbbb4hdozo7spod9ftn",
SecretName: "secrettest.conf",
File: &swarm.SecretReferenceFileTarget{
Name: "/secrettest.conf",
},
},
},
},
@ -145,3 +151,10 @@ func TestJSONFormatWithNoUpdateConfig(t *testing.T) {
}
assert.Check(t, is.DeepEqual(m1, m2))
}
func TestPrettyPrintWithConfigsAndSecrets(t *testing.T) {
s := formatServiceInspect(t, formatter.NewServiceFormat("pretty"), time.Now())
assert.Check(t, is.Contains(s, "Configs:"), "Pretty print missing configs")
assert.Check(t, is.Contains(s, "Secrets:"), "Pretty print missing secrets")
}