Skip to content

Commit

Permalink
acctests: hooking up ARM_CLIENT_ID_ALT and ARM_CLIENT_SECRET_ALT
Browse files Browse the repository at this point in the history
  • Loading branch information
tombuildsstuff committed May 1, 2020
1 parent 35d2c8e commit 49758c0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
9 changes: 8 additions & 1 deletion .teamcity/components/build_azure.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import jetbrains.buildServer.configs.kotlin.v2019_2.ParametrizedWithType

class ClientConfiguration(var clientId: String, var clientSecret: String, val subscriptionId : String, val tenantId : String) {
class ClientConfiguration(var clientId: String,
var clientSecret: String,
val subscriptionId : String,
val tenantId : String,
val altClientId: String,
val altClientSecret: String) {
}

class LocationConfiguration(var primary : String, var secondary : String, var ternary : String, var rotate : Boolean) {
}

fun ParametrizedWithType.ConfigureAzureSpecificTestParameters(environment: String, config: ClientConfiguration, locationsForEnv: LocationConfiguration) {
hiddenPasswordVariable("env.ARM_CLIENT_ID", config.clientId, "The ID of the Service Principal used for Testing")
hiddenPasswordVariable("env.ARM_CLIENT_ID_ALT", config.altClientId, "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.altClientSecret, "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")
Expand Down
1 change: 1 addition & 0 deletions .teamcity/components/project.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ fun buildConfigurationsForServices(services: Map<String, String>, providerName :
var locationsForEnv = locations.get(environment)!!

services.forEach { (serviceName, displayName) ->
// TODO: overriding locations
var defaultTestConfig = testConfiguration(defaultParallelism, defaultStartHour)
var testConfig = serviceTestConfigurationOverrides.getOrDefault(serviceName, defaultTestConfig)
var runNightly = runNightly.getOrDefault(environment, false)
Expand Down
4 changes: 3 additions & 1 deletion .teamcity/settings.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ var clientSecret = DslContext.getParameter("clientSecret", "")
var subscriptionId = DslContext.getParameter("subscriptionId", "")
var tenantId = DslContext.getParameter("tenantId", "")
var environment = DslContext.getParameter("environment", "public")
var clientIdAlt = DslContext.getParameter("clientIdAlt", "")
var clientSecretAlt = DslContext.getParameter("clientSecretAlt", "")

var clientConfig = ClientConfiguration(clientId, clientSecret, subscriptionId, tenantId)
var clientConfig = ClientConfiguration(clientId, clientSecret, subscriptionId, tenantId, clientIdAlt, clientSecretAlt)

project(AzureRM(environment, clientConfig))
2 changes: 1 addition & 1 deletion .teamcity/tests/helpers.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ package tests
import ClientConfiguration

fun TestConfiguration() : ClientConfiguration {
return ClientConfiguration("clientId", "clientSecret", "subscriptionId", "tenantId")
return ClientConfiguration("clientId", "clientSecret", "subscriptionId", "tenantId", "altClientId", "altClientSecret")
}

0 comments on commit 49758c0

Please sign in to comment.