Esempio n. 1
0
func (s *BaseSuiteUnpatched) NewBaseInstance(c *gc.C, id string) *google.Instance {
	diskSpec := google.DiskSpec{
		SizeHintGB: 15,
		ImageURL:   "some/image/path",
		Boot:       true,
		Scratch:    false,
		Readonly:   false,
		AutoDelete: true,
	}
	instanceSpec := google.InstanceSpec{
		ID:                id,
		Type:              "mtype",
		Disks:             []google.DiskSpec{diskSpec},
		Network:           google.NetworkSpec{Name: "somenetwork"},
		NetworkInterfaces: []string{"somenetif"},
		Metadata:          s.Metadata,
		Tags:              []string{id},
	}
	summary := google.InstanceSummary{
		ID:        id,
		ZoneName:  "home-zone",
		Status:    google.StatusRunning,
		Metadata:  s.Metadata,
		Addresses: s.Addresses,
	}
	return google.NewInstance(summary, &instanceSpec)
}
func (s *environInstSuite) TestControllerInstancesMixed(c *gc.C) {
	other := google.NewInstance(google.InstanceSummary{}, nil)
	s.FakeConn.Insts = []google.Instance{*s.BaseInstance, *other}

	ids, err := s.Env.ControllerInstances()
	c.Assert(err, jc.ErrorIsNil)

	c.Check(ids, jc.DeepEquals, []instance.Id{"spam"})
}