Skip to content

Commit

Permalink
CI - enable acctest distribution across subscriptions and enable loca…
Browse files Browse the repository at this point in the history
…tion rotation (#15826)
  • Loading branch information
jackofallops authored Mar 21, 2022
1 parent 7c005b0 commit bb3ddf0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
15 changes: 10 additions & 5 deletions .teamcity/components/build_azure.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,23 @@ class ClientConfiguration(var clientId: String,
class LocationConfiguration(var primary : String, var secondary : String, var ternary : String, var rotate : Boolean) {
}

fun ParametrizedWithType.ConfigureAzureSpecificTestParameters(environment: String, config: ClientConfiguration, locationsForEnv: LocationConfiguration) {
fun ParametrizedWithType.ConfigureAzureSpecificTestParameters(environment: String, config: ClientConfiguration, locationsForEnv: LocationConfiguration, useAltSubscription: Boolean = false) {
hiddenPasswordVariable("env.ARM_CLIENT_ID", config.clientId, "The ID of the Service Principal used for Testing")
hiddenPasswordVariable("env.ARM_CLIENT_ID_ALT", config.clientIdAlt, "The ID of the Alternate Service Principal used for Testing")
hiddenPasswordVariable("env.ARM_CLIENT_SECRET", config.clientSecret, "The Client Secret of the Service Principal used for Testing")
hiddenPasswordVariable("env.ARM_CLIENT_SECRET_ALT", config.clientSecretAlt, "The Client Secret of the Alternate Service Principal used for Testing")
hiddenVariable("env.ARM_ENVIRONMENT", environment, "The Azure Environment in which the tests are running")
hiddenVariable("env.ARM_PROVIDER_DYNAMIC_TEST", "%b".format(locationsForEnv.rotate), "Should tests rotate between the supported regions?")
hiddenPasswordVariable("env.ARM_SUBSCRIPTION_ID", config.subscriptionId, "The ID of the Azure Subscription used for Testing")
hiddenPasswordVariable("env.ARM_SUBSCRIPTION_ID_ALT", config.subscriptionIdAlt, "The ID of the Alternate Azure Subscription used for Testing")
if (useAltSubscription) {
hiddenPasswordVariable("env.ARM_SUBSCRIPTION_ID", config.subscriptionIdAlt, "The ID of the Azure Subscription used for Testing (swapped)")
hiddenPasswordVariable("env.ARM_SUBSCRIPTION_ID_ALT", config.subscriptionId, "The ID of the Alternate Azure Subscription used for Testing (swapped)")
} else {
hiddenPasswordVariable("env.ARM_SUBSCRIPTION_ID", config.subscriptionId, "The ID of the Azure Subscription used for Testing")
hiddenPasswordVariable("env.ARM_SUBSCRIPTION_ID_ALT", config.subscriptionIdAlt, "The ID of the Alternate Azure Subscription used for Testing")
}
hiddenPasswordVariable("env.ARM_TENANT_ID", config.tenantId, "The ID of the Azure Tenant used for Testing")
hiddenVariable("env.ARM_TEST_LOCATION", locationsForEnv.primary, "The Primary region which should be used for testing")
hiddenVariable("env.ARM_TEST_LOCATION_ALT", locationsForEnv.secondary, "The Primary region which should be used for testing")
hiddenVariable("env.ARM_TEST_LOCATION_ALT2", locationsForEnv.ternary, "The Primary region which should be used for testing")
hiddenVariable("env.ARM_TEST_LOCATION_ALT", locationsForEnv.secondary, "The Secondary region which should be used for testing")
hiddenVariable("env.ARM_TEST_LOCATION_ALT2", locationsForEnv.ternary, "The Tertiary region which should be used for testing")
hiddenVariable("env.ARM_THREEPOINTZERO_BETA", "true", "Opt into the use of 3.0 beta resources")
}
5 changes: 3 additions & 2 deletions .teamcity/components/project.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fun buildConfigurationsForServices(services: Map<String, String>, providerName :
var service = serviceDetails(serviceName, displayName, environment)
var buildConfig = service.buildConfiguration(providerName, runNightly, testConfig.startHour, testConfig.parallelism, testConfig.daysOfWeek, testConfig.daysOfMonth)

buildConfig.params.ConfigureAzureSpecificTestParameters(environment, config, locationsForEnv)
buildConfig.params.ConfigureAzureSpecificTestParameters(environment, config, locationsForEnv, testConfig.useAltSubscription)

list.add(buildConfig)
}
Expand All @@ -46,9 +46,10 @@ fun pullRequestBuildConfiguration(environment: String, configuration: ClientConf
return buildConfiguration
}

class testConfiguration(parallelism: Int = defaultParallelism, startHour: Int = defaultStartHour, daysOfWeek: String = defaultDaysOfWeek, daysOfMonth: String = defaultDaysOfMonth) {
class testConfiguration(parallelism: Int = defaultParallelism, startHour: Int = defaultStartHour, daysOfWeek: String = defaultDaysOfWeek, daysOfMonth: String = defaultDaysOfMonth, useAltSubscription: Boolean = false) {
var parallelism = parallelism
var startHour = startHour
var daysOfWeek = daysOfWeek
var daysOfMonth = daysOfMonth
var useAltSubscription = useAltSubscription
}
2 changes: 1 addition & 1 deletion .teamcity/components/settings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const val defaultDaysOfWeek = "2,3,4,5,6"
const val defaultDaysOfMonth = "*"

var locations = mapOf(
"public" to LocationConfiguration("westeurope", "eastus2", "francecentral", false)
"public" to LocationConfiguration("westeurope", "eastus2", "westus", true)
)

// specifies the list of Azure Environments where tests should be run nightly
Expand Down

0 comments on commit bb3ddf0

Please sign in to comment.