Exemplo n.º 1
0
func (s *syncToolsSuite) SetUpTest(c *C) {
	s.LoggingSuite.SetUpTest(c)
	s.origVersion = version.Current
	// It's important that this be v1 to match the test data.
	version.Current.Number = version.MustParse("1.2.3")

	// Create a target environments.yaml and make sure its environment is empty.
	s.home = testing.MakeFakeHome(c, `
environments:
    test-target:
        type: dummy
        state-server: false
        authorized-keys: "not-really-one"
`)
	var err error
	s.targetEnv, err = environs.NewFromName("test-target")
	c.Assert(err, IsNil)
	envtesting.RemoveAllTools(c, s.targetEnv)

	// Create a source storage.
	s.storage, err = envtesting.NewEC2HTTPTestStorage("127.0.0.1")
	c.Assert(err, IsNil)

	// Create a local tools directory.
	s.localStorage = c.MkDir()

	// Populate both with the public tools.
	for _, vers := range vAll {
		s.storage.PutBinary(vers)
		putBinary(c, s.localStorage, vers)
	}

	s.origLocation = defaultToolsLocation
	defaultToolsLocation = s.storage.Location()
}
Exemplo n.º 2
0
func (s *storageSuite) SetUpTest(c *C) {
	var err error

	s.storage, err = testing.NewEC2HTTPTestStorage("127.0.0.1")
	c.Assert(err, IsNil)

	for _, v := range versions {
		s.storage.PutBinary(v)
	}
}
Exemplo n.º 3
0
// createToolsStore creates the fake tools store.
func createToolsStore(c *gc.C) func() {
	storage, err := envtesting.NewEC2HTTPTestStorage("127.0.0.1")
	c.Assert(err, gc.IsNil)
	origLocation := sync.DefaultToolsLocation
	sync.DefaultToolsLocation = storage.Location()
	for _, vers := range vAll {
		storage.PutBinary(vers)
	}
	restore := func() {
		sync.DefaultToolsLocation = origLocation
	}
	return restore
}