func (s *UserdataSuite) TestOpenstackWindows(c *gc.C) { renderer := openstack.OpenstackRenderer{} data := []byte("test") result, err := renderer.EncodeUserdata(data, os.Windows) c.Assert(err, jc.ErrorIsNil) c.Assert(result, jc.DeepEquals, renderers.WinEmbedInScript(data)) }
func (s *UserdataSuite) TestOpenstackUnix(c *gc.C) { renderer := openstack.OpenstackRenderer{} data := []byte("test") result, err := renderer.EncodeUserdata(data, os.Ubuntu) c.Assert(err, jc.ErrorIsNil) c.Assert(result, jc.DeepEquals, utils.Gzip(data)) data = []byte("test") result, err = renderer.EncodeUserdata(data, os.CentOS) c.Assert(err, jc.ErrorIsNil) c.Assert(result, jc.DeepEquals, utils.Gzip(data)) }
func (s *UserdataSuite) TestOpenstackUnknownOS(c *gc.C) { renderer := openstack.OpenstackRenderer{} result, err := renderer.EncodeUserdata(nil, os.Arch) c.Assert(result, gc.IsNil) c.Assert(err, gc.ErrorMatches, "Cannot encode userdata for OS: Arch") }