From 7968bffd90f16997dbbe16bed5ce0e9014790e9f Mon Sep 17 00:00:00 2001 From: Jiri Burant <83883278+jiriburant@users.noreply.github.com> Date: Wed, 18 Oct 2023 17:07:56 +0200 Subject: [PATCH] Fixing communication test scripts (#39355) * Updated test-resources template to contain necessary properties. * Added logging for test environment variables for better troubleshooting. --- .../test-resources/test-resources-post.ps1 | 19 +++++++++++++++++++ .../test-resources/test-resources.json | 12 ++++++++++++ 2 files changed, 31 insertions(+) diff --git a/sdk/communication/test-resources/test-resources-post.ps1 b/sdk/communication/test-resources/test-resources-post.ps1 index 0d88ef2cfb331..faf954a0c94a9 100644 --- a/sdk/communication/test-resources/test-resources-post.ps1 +++ b/sdk/communication/test-resources/test-resources-post.ps1 @@ -25,6 +25,12 @@ function Log($Message) { Log 'Starting sdk\communication\test-resources\test-resources-post.ps1' +if($DeploymentOutputs.ContainsKey('COMMUNICATION_SERVICE_ENDPOINT')){ + Write-Host "COMMUNICATION_SERVICE_ENDPOINT exists, proceeding." +}else{ + Write-Host "COMMUNICATION_SERVICE_ENDPOINT does not exist, ending." +exit +} $communicationServiceEndpoint = $DeploymentOutputs["COMMUNICATION_SERVICE_ENDPOINT"] if ($communicationServiceEndpoint -notmatch '\/$') { @@ -32,7 +38,20 @@ if ($communicationServiceEndpoint -notmatch '\/$') { $communicationServiceEndpoint = $communicationServiceEndpoint + "/" } +if($DeploymentOutputs.ContainsKey('COMMUNICATION_SERVICE_ACCESS_KEY')){ + Write-Host "COMMUNICATION_SERVICE_ACCESS_KEY exists, proceeding." +}else{ + Write-Host "COMMUNICATION_SERVICE_ACCESS_KEY does not exist, ending." +exit +} $communicationServiceApiKey = $DeploymentOutputs["COMMUNICATION_SERVICE_ACCESS_KEY"] + +if($DeploymentOutputs.ContainsKey('AZURE_TEST_DOMAIN')){ + Write-Host "AZURE_TEST_DOMAIN exists, proceeding." +}else{ + Write-Host "AZURE_TEST_DOMAIN does not exist, ending." +exit +} $testDomain = $DeploymentOutputs["AZURE_TEST_DOMAIN"] $payload = @" diff --git a/sdk/communication/test-resources/test-resources.json b/sdk/communication/test-resources/test-resources.json index 3321f762d040d..0e1d5f885b259 100644 --- a/sdk/communication/test-resources/test-resources.json +++ b/sdk/communication/test-resources/test-resources.json @@ -13,6 +13,10 @@ "defaultValue": "communication", "type": "string" }, + "communicationServicesEndpointSuffix": { + "defaultValue": ".communication.azure.com", + "type": "string" + }, "testApplicationOid": { "type": "string", "metadata": { @@ -80,6 +84,14 @@ "type": "string", "value": "[listKeys(resourceId('Microsoft.Communication/CommunicationServices',variables('uniqueSubDomainName')), '2023-03-31').primaryConnectionString]" }, + "COMMUNICATION_SERVICE_ENDPOINT": { + "type": "string", + "value": "[concat('https://', parameters('baseName'), '-', parameters('endpointPrefix'), parameters('communicationServicesEndpointSuffix'))]" + }, + "COMMUNICATION_SERVICE_ACCESS_KEY": { + "type": "string", + "value": "[listKeys(resourceId('Microsoft.Communication/CommunicationServices',variables('uniqueSubDomainName')), '2023-03-31').primaryKey]" + }, "RESOURCE_GROUP_NAME": { "type": "string", "value": "[resourceGroup().Name]"