Beispiel #1
0
func (s *toolsSuite) TestValidateUploadAllowedIncompatibleHostOS(c *gc.C) {
	// Host runs Ubuntu, want win2012 tools.
	s.PatchValue(&os.HostOS, func() os.OSType { return os.Ubuntu })
	env := newEnviron("foo", useDefaultKeys, nil)
	series := "win2012"
	err := bootstrap.ValidateUploadAllowed(env, nil, &series)
	c.Assert(err, gc.ErrorMatches, `cannot build tools for "win2012" using a machine running "Ubuntu"`)
}
Beispiel #2
0
func (s *toolsSuite) TestValidateUploadAllowed(c *gc.C) {
	env := newEnviron("foo", useDefaultKeys, nil)
	// Host runs arm64, environment supports arm64.
	arm64 := "arm64"
	s.PatchValue(&arch.HostArch, func() string { return arm64 })
	err := bootstrap.ValidateUploadAllowed(env, &arm64)
	c.Assert(err, jc.ErrorIsNil)
}
Beispiel #3
0
func (s *toolsSuite) TestValidateUploadAllowed(c *gc.C) {
	env := newEnviron("foo", useDefaultKeys, nil)
	// Host runs arm64, environment supports arm64.
	arm64 := "arm64"
	centos7 := "centos7"
	s.PatchValue(&arch.HostArch, func() string { return arm64 })
	s.PatchValue(&os.HostOS, func() os.OSType { return os.CentOS })
	validator, err := env.ConstraintsValidator()
	c.Assert(err, jc.ErrorIsNil)
	err = bootstrap.ValidateUploadAllowed(env, &arm64, &centos7, validator)
	c.Assert(err, jc.ErrorIsNil)
}
Beispiel #4
0
func (s *toolsSuite) TestValidateUploadAllowedIncompatibleTargetArch(c *gc.C) {
	// Host runs ppc64el, environment only supports amd64, arm64.
	s.PatchValue(&arch.HostArch, func() string { return arch.PPC64EL })
	// Force a dev version by having a non zero build number.
	// This is because we have not uploaded any tools and auto
	// upload is only enabled for dev versions.
	devVersion := version.Current
	devVersion.Build = 1234
	s.PatchValue(&version.Current, devVersion)
	env := newEnviron("foo", useDefaultKeys, nil)
	err := bootstrap.ValidateUploadAllowed(env, nil, nil)
	c.Assert(err, gc.ErrorMatches, `model "foo" of type dummy does not support instances running on "ppc64el"`)
}
Beispiel #5
0
func (s *toolsSuite) TestValidateUploadAllowedIncompatibleHostArch(c *gc.C) {
	// Host runs amd64, want ppc64 tools.
	s.PatchValue(&arch.HostArch, func() string { return arch.AMD64 })
	// Force a dev version by having a non zero build number.
	// This is because we have not uploaded any tools and auto
	// upload is only enabled for dev versions.
	devVersion := version.Current
	devVersion.Build = 1234
	s.PatchValue(&version.Current, devVersion)
	env := newEnviron("foo", useDefaultKeys, nil)
	arch := arch.PPC64EL
	err := bootstrap.ValidateUploadAllowed(env, &arch, nil)
	c.Assert(err, gc.ErrorMatches, `cannot build tools for "ppc64el" using a machine running on "amd64"`)
}