Exemple #1
0
func (s *outputTabularSuite) TestFormatTabularMulti(c *gc.C) {
	p10A := status.NewPayload("spam", "a-service", 1, 0)
	p10A.Labels = []string{"a-tag"}
	p21A := status.NewPayload("spam", "a-service", 2, 1)
	p21A.Status = "stopped"
	p21A.Labels = []string{"a-tag"}
	p21B := status.NewPayload("spam", "a-service", 2, 1)
	p21B.ID += "B"
	p21x := status.NewPayload("eggs", "a-service", 2, 1)
	p21x.Type = "kvm"
	p22A := status.NewPayload("spam", "a-service", 2, 2)
	p10x := status.NewPayload("ham", "another-service", 1, 0)
	p10x.Labels = []string{"other", "extra"}
	formatted := status.Formatted(
		p10A,
		p21A,
		p21B,
		p21x,
		p22A,
		p10x,
	)
	data, err := status.FormatTabular(formatted)
	c.Assert(err, jc.ErrorIsNil)

	c.Check(string(data), gc.Equals, `
[Unit Payloads]
UNIT              MACHINE PAYLOAD-CLASS STATUS  TYPE   ID      TAGS        
a-service/0       1       spam          running docker idspam  a-tag       
a-service/1       2       spam          stopped docker idspam  a-tag       
a-service/1       2       spam          running docker idspamB             
a-service/1       2       eggs          running kvm    ideggs              
a-service/2       2       spam          running docker idspam              
another-service/0 1       ham           running docker idham   other extra 
`[1:])
}
Exemple #2
0
func (s *outputTabularSuite) TestFormatTabularMinimal(c *gc.C) {
	payload := status.NewPayload("spam", "a-service", 1, 0)
	formatted := status.Formatted(payload)
	data, err := status.FormatTabular(formatted)
	c.Assert(err, jc.ErrorIsNil)

	c.Check(string(data), gc.Equals, `
[Unit Payloads]
UNIT        MACHINE PAYLOAD-CLASS STATUS  TYPE   ID     TAGS 
a-service/0 1       spam          running docker idspam      
`[1:])
}
Exemple #3
0
func (s *outputTabularSuite) TestFormatTabularMinimal(c *gc.C) {
	payload := status.NewPayload("spam", "a-application", 1, 0)
	formatted := status.Formatted(payload)
	buff := &bytes.Buffer{}
	err := status.FormatTabular(buff, formatted)
	c.Assert(err, jc.ErrorIsNil)

	c.Check(buff.String(), gc.Equals, `
[Unit Payloads]
UNIT             MACHINE  PAYLOAD-CLASS  STATUS   TYPE    ID      TAGS  
a-application/0  1        spam           running  docker  idspam        
`[1:])
}
Exemple #4
0
func (s *outputTabularSuite) TestFormatTabularMinimal(c *gc.C) {
	payload := status.NewPayload("spam", "a-application", 1, 0)
	formatted := status.Formatted(payload)
	buff := &bytes.Buffer{}
	err := status.FormatTabular(buff, formatted)
	c.Assert(err, jc.ErrorIsNil)

	c.Check(buff.String(), gc.Equals, `
[Unit Payloads]
Unit             Machine  Payload class  Status   Type    Id      Tags  
a-application/0  1        spam           running  docker  idspam        
`[1:])
}
Exemple #5
0
func (s *outputTabularSuite) TestFormatTabularMulti(c *gc.C) {
	p10A := status.NewPayload("spam", "a-application", 1, 0)
	p10A.Labels = []string{"a-tag"}
	p21A := status.NewPayload("spam", "a-application", 2, 1)
	p21A.Status = "stopped"
	p21A.Labels = []string{"a-tag"}
	p21B := status.NewPayload("spam", "a-application", 2, 1)
	p21B.ID += "B"
	p21x := status.NewPayload("eggs", "a-application", 2, 1)
	p21x.Type = "kvm"
	p22A := status.NewPayload("spam", "a-application", 2, 2)
	p10x := status.NewPayload("ham", "another-application", 1, 0)
	p10x.Labels = []string{"other", "extra"}
	formatted := status.Formatted(
		p10A,
		p21A,
		p21B,
		p21x,
		p22A,
		p10x,
	)
	buff := &bytes.Buffer{}
	err := status.FormatTabular(buff, formatted)
	c.Assert(err, jc.ErrorIsNil)

	c.Check(buff.String(), gc.Equals, `
[Unit Payloads]
Unit                   Machine  Payload class  Status   Type    Id       Tags         
a-application/0        1        spam           running  docker  idspam   a-tag        
a-application/1        2        spam           stopped  docker  idspam   a-tag        
a-application/1        2        spam           running  docker  idspamB               
a-application/1        2        eggs           running  kvm     ideggs                
a-application/2        2        spam           running  docker  idspam                
another-application/0  1        ham            running  docker  idham    other extra  
`[1:])
}