Skip to content

Commit

Permalink
Fixing communication test scripts (#39355)
Browse files Browse the repository at this point in the history
* Updated test-resources template to contain necessary properties.

* Added logging for test environment variables for better troubleshooting.
  • Loading branch information
jiriburant authored Oct 18, 2023
1 parent 0091f81 commit 40a2633
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
19 changes: 19 additions & 0 deletions sdk/communication/test-resources/test-resources-post.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,33 @@ 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 '\/$') {
Log "adding trailing slash to $communicationServiceEndpoint"
$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 = @"
Expand Down
12 changes: 12 additions & 0 deletions sdk/communication/test-resources/test-resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
"defaultValue": "communication",
"type": "string"
},
"communicationServicesEndpointSuffix": {
"defaultValue": ".communication.azure.com",
"type": "string"
},
"testApplicationOid": {
"type": "string",
"metadata": {
Expand Down Expand Up @@ -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]"
Expand Down

0 comments on commit 40a2633

Please sign in to comment.