func newProviders(c *gc.C, config azure.ProviderConfig) (environs.EnvironProvider, storage.Provider) {
	if config.NewStorageClient == nil {
		var storage azuretesting.MockStorageClient
		config.NewStorageClient = storage.NewClient
	}
	if config.StorageAccountNameGenerator == nil {
		config.StorageAccountNameGenerator = func() string {
			return fakeStorageAccount
		}
	}
	environProvider, storageProvider, err := azure.NewProviders(config)
	c.Assert(err, jc.ErrorIsNil)
	return environProvider, storageProvider
}
Exemple #2
0
func newProvider(c *gc.C, config azure.ProviderConfig) environs.EnvironProvider {
	if config.NewStorageClient == nil {
		var storage azuretesting.MockStorageClient
		config.NewStorageClient = storage.NewClient
	}
	if config.RetryClock == nil {
		config.RetryClock = jujutesting.NewClock(time.Time{})
	}
	if config.InteractiveCreateServicePrincipal == nil {
		config.InteractiveCreateServicePrincipal = azureauth.InteractiveCreateServicePrincipal
	}
	config.RandomWindowsAdminPassword = func() string { return "sorandom" }
	environProvider, err := azure.NewProvider(config)
	c.Assert(err, jc.ErrorIsNil)
	return environProvider
}