Code review comment for lp:~thumper/juju-core/better-container-instance-tests

Revision history for this message
Tim Penhey (thumper) wrote :

Reviewers: mp+194975_code.launchpad.net,

Message:
Please take a look.

Description:
instance container method tests

Be explicit in the container type equality.
Test the parsing of KVM.
Change the tests names to be consistent with the functions.

https://code.launchpad.net/~thumper/juju-core/better-container-instance-tests/+merge/194975

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/25460045/

Affected files (+24, -6 lines):
   A [revision details]
   M instance/container_test.go

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-20131113015012-y3lnl9jzz40v7h6v
+New revision: <email address hidden>

Index: instance/container_test.go
=== modified file 'instance/container_test.go'
--- instance/container_test.go 2013-11-12 01:59:52 +0000
+++ instance/container_test.go 2013-11-13 01:40:16 +0000
@@ -19,19 +19,35 @@

  var _ = gc.Suite(&InstanceSuite{})

-func (s *InstanceSuite) TestParseAllowedContainerType(c *gc.C) {
+func (s *InstanceSuite) TestParseContainerType(c *gc.C) {
   ctype, err := instance.ParseContainerType("lxc")
   c.Assert(err, gc.IsNil)
- c.Assert(ctype, gc.Equals, instance.ContainerType("lxc"))
+ c.Assert(ctype, gc.Equals, instance.LXC)
+
+ ctype, err = instance.ParseContainerType("kvm")
+ c.Assert(err, gc.IsNil)
+ c.Assert(ctype, gc.Equals, instance.KVM)
+
   ctype, err = instance.ParseContainerType("none")
- c.Assert(err, gc.Not(gc.IsNil))
+ c.Assert(err, gc.ErrorMatches, `invalid container type "none"`)
+
+ ctype, err = instance.ParseContainerType("omg")
+ c.Assert(err, gc.ErrorMatches, `invalid container type "omg"`)
  }

-func (s *InstanceSuite) TestParseAllowedContainerTypeOrNone(c *gc.C) {
+func (s *InstanceSuite) TestParseContainerTypeOrNone(c *gc.C) {
   ctype, err := instance.ParseContainerTypeOrNone("lxc")
   c.Assert(err, gc.IsNil)
- c.Assert(ctype, gc.Equals, instance.ContainerType("lxc"))
+ c.Assert(ctype, gc.Equals, instance.LXC)
+
+ ctype, err = instance.ParseContainerTypeOrNone("kvm")
+ c.Assert(err, gc.IsNil)
+ c.Assert(ctype, gc.Equals, instance.KVM)
+
   ctype, err = instance.ParseContainerTypeOrNone("none")
   c.Assert(err, gc.IsNil)
- c.Assert(ctype, gc.Equals, instance.ContainerType("none"))
+ c.Assert(ctype, gc.Equals, instance.NONE)
+
+ ctype, err = instance.ParseSupportedContainerTypeOrNone("omg")
+ c.Assert(err, gc.ErrorMatches, `invalid container type "omg"`)
  }

« Back to merge proposal