Skip to content

Commit 4a7653f

Browse files
committed
Remove summy secrets from test
1 parent 7fc96a1 commit 4a7653f

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

src/ServiceManagement/Common/Commands.ScenarioTest/Commands.ScenarioTest.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,6 @@
231231
<None Include="Resources\ServiceManagement\Files\dSMSTest.cspkg">
232232
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
233233
</None>
234-
<None Include="Resources\ServiceManagement\Files\example.pfx">
235-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
236-
</None>
237234
<None Include="Resources\SqlIaaSExtension\SqlIaaSExtensionTests.ps1">
238235
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
239236
</None>

src/ServiceManagement/Common/Commands.ScenarioTest/Resources/ServiceManagement/Files/dSMSTest.cscfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<Setting name="DummySetting" value="Foo" />
1717
</ConfigurationSettings>
1818
<Certificates>
19-
<Certificate name="ThumbprintCert" thumbprint="6CAE49B8166D5ADA04EDA09616CEDC88A091289E" thumbprintAlgorithm="sha1" />
19+
<Certificate name="ThumbprintCert" thumbprint="{{PLACEHOLDER}}" thumbprintAlgorithm="sha1" />
2020
<Certificate name="dSMSCert" sourceLocation="/genevacustomers/monitoring/prod/warmpath/test/auxweb/certificates/chained/portaldogfoodmdscert.pfx" />
2121
</Certificates>
2222
</Role>

src/ServiceManagement/Common/Commands.ScenarioTest/Resources/ServiceManagement/ServiceManagementTests.ps1

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,18 +320,23 @@ function Run-DSMSHostedServiceTest
320320
}
321321
$cscfg = "$TestOutputRoot\Resources\ServiceManagement\Files\dSMSTest.cscfg";
322322
$cscfgChanged = "$TestOutputRoot\Resources\ServiceManagement\Files\dSMSTest-changed.cscfg";
323-
$certFile = "$TestOutputRoot\Resources\ServiceManagement\Files\example.pfx";
323+
324+
# Create a temporary self-signed cert
325+
$cert = New-SelfSignedCertificate -DnsName "example.local" -CertStoreLocation "Cert:\CurrentUser\My";
326+
$certPath = "Cert:\CurrentUser\My\$($cert.Thumbprint)"
327+
# Update the cscfg to use the new cert
328+
(Get-Content $cscfg) | ForEach-Object {$_ -replace "\{\{PLACEHOLDER\}\}", $cert.Thumbprint} | Set-Content $cscfgChanged;
324329

325330
try
326331
{
327332
# Create Hosted Service
328333
$result = New-AzureService -ServiceName $svcName -Location $location -Label $svcName -Description $svcName;
329334

330335
# Upload the certificate
331-
Add-AzureCertificate -ServiceName $svcName -CertToDeploy $certFile -Password "pass@word1*";
336+
Add-AzureCertificate -ServiceName $svcName -CertToDeploy $cert;
332337

333338
# Deploy to staging
334-
$result = New-AzureDeployment -ServiceName $svcName -Package $cspkg -Configuration $cscfg -Label $svcName -Slot Staging;
339+
$result = New-AzureDeployment -ServiceName $svcName -Package $cspkg -Configuration $cscfgChanged -Label $svcName -Slot Staging;
335340

336341
# Get Deployment
337342
$deploy = Get-AzureDeployment -ServiceName $svcName -Slot Staging;
@@ -352,6 +357,10 @@ function Run-DSMSHostedServiceTest
352357
{
353358
Remove-Item $cscfgChanged;
354359
}
360+
if (Test-Path $certPath)
361+
{
362+
Remove-Item $certPath
363+
}
355364
}
356365
}
357366

0 commit comments

Comments
 (0)