Beispiel #1
0
func (s *UserdataSuite) TestAzureUnknownOS(c *gc.C) {
	renderer := azure.AzureRenderer{}
	cloudcfg := &cloudinittest.CloudConfig{YAML: []byte("yaml")}

	_, err := renderer.Render(cloudcfg, os.Arch)
	c.Assert(err, gc.ErrorMatches, "Cannot encode userdata for OS: Arch")
}
Beispiel #2
0
func (s *UserdataSuite) TestAzureWindows(c *gc.C) {
	renderer := azure.AzureRenderer{}
	cloudcfg := &cloudinittest.CloudConfig{YAML: []byte("yaml")}

	result, err := renderer.Render(cloudcfg, os.Windows)
	c.Assert(err, jc.ErrorIsNil)
	expected := base64.StdEncoding.EncodeToString(renderers.WinEmbedInScript(cloudcfg.YAML))
	c.Assert(string(result), jc.DeepEquals, expected)
}
Beispiel #3
0
func (s *UserdataSuite) TestAzureCentOS(c *gc.C) {
	renderer := azure.AzureRenderer{}
	cloudcfg := &cloudinittest.CloudConfig{Script: "script"}

	result, err := renderer.Render(cloudcfg, os.CentOS)
	c.Assert(err, jc.ErrorIsNil)
	expected := base64.StdEncoding.EncodeToString([]byte(cloudcfg.Script))
	c.Assert(string(result), jc.DeepEquals, expected)
}