예제 #1
0
func (s *syncSuite) TestSyncing(c *gc.C) {
	for _, test := range tests {
		// Perform all tests in a "clean" environment.
		func() {
			s.setUpTest(c)
			defer s.tearDownTest(c)

			c.Log(test.description)

			if test.source {
				test.ctx.Source = s.localStorage
			}

			err := sync.SyncTools(test.ctx)
			c.Assert(err, gc.IsNil)

			targetTools, err := environs.FindAvailableTools(s.targetEnv, 1)
			c.Assert(err, gc.IsNil)
			assertToolsList(c, targetTools, test.tools)

			if test.emptyPublic {
				assertEmpty(c, s.targetEnv.PublicStorage())
			} else {
				assertEmpty(c, s.targetEnv.Storage())
			}
		}()
	}
}
예제 #2
0
func (s *syncSuite) TestCopyToDummyPublicBlockedByPrivate(c *gc.C) {
	s.setUpTest(c)
	defer s.tearDownTest(c)

	envtesting.UploadFakeToolsVersion(c, s.targetEnv.Storage(), v200p64)
	ctx := &sync.SyncContext{
		EnvName:      "test-target",
		PublicBucket: true,
	}
	err := sync.SyncTools(ctx)
	c.Assert(err, gc.ErrorMatches, "private tools present: public tools would be ignored")
	assertEmpty(c, s.targetEnv.PublicStorage())
}