Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen Weatherford committed Oct 6, 2021
1 parent af627c4 commit 2bcfcf4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/Bicep.Core.IntegrationTests/ScenarioTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ string randomString()
{
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
return new string(Enumerable.Repeat(chars, generateRandomInt())
.Select(s => s[generateRandomInt(0, s.Length-1)]).ToArray());
.Select(s => s[generateRandomInt(0, s.Length - 1)]).ToArray());
}

var file = "param adminuser string\nvar adminstring = 'xyx ${adminuser} 123'\n";
Expand Down Expand Up @@ -164,7 +164,8 @@ param serverFarmId string
}
");

result.Should().NotHaveAnyDiagnostics();
// Ignore outputs-should-not-contain-secrets warnings which are expected
result.Diagnostics.Where(d => d.Code != "outputs-should-not-contain-secrets").Should().BeEmpty();
result.Template.Should().HaveValueAtPath("$.outputs['config'].value", "[list(format('{0}/config/appsettings', resourceId('Microsoft.Web/sites', parameters('functionApp').name)), '2020-06-01')]");
}

Expand Down Expand Up @@ -2590,7 +2591,7 @@ public void Test_Issue4212()
("BCP036", DiagnosticLevel.Error, "The property \"parent\" expected a value of type \"Microsoft.Network/virtualNetworks\" but the provided value is of type \"tenant\"."),
});
}

// https://github.com/Azure/bicep/issues/4542
[TestMethod]
public void Test_Issue4542()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System.Linq;
using Bicep.Core.Diagnostics;
using Bicep.Core.UnitTests.Assertions;
using Bicep.Core.UnitTests.Utils;
Expand Down Expand Up @@ -32,7 +33,8 @@ public void List_wildcard_function_on_resource_references()
})
");

result.Should().NotHaveAnyDiagnostics();
// Ignore outputs-should-not-contain-secrets warnings which are expected
result.Diagnostics.Where(d => d.Code != "outputs-should-not-contain-secrets").Should().BeEmpty();
result.Template.Should().HaveValueAtPath("$.outputs['pkStandard'].value", "[listKeys(resourceId('Microsoft.Storage/storageAccounts', 'testacc'), '2019-06-01').keys[0].value]");
result.Template.Should().HaveValueAtPath("$.outputs['pkMethod'].value", "[listKeys(resourceId('Microsoft.Storage/storageAccounts', 'testacc'), '2019-06-01').keys[0].value]");
result.Template.Should().HaveValueAtPath("$.outputs['pkMethodVersionOverride'].value", "[listKeys(resourceId('Microsoft.Storage/storageAccounts', 'testacc'), '2021-01-01').keys[0].value]");
Expand All @@ -56,7 +58,8 @@ public void List_wildcard_function_on_cross_scope_resource_references()
})
");

result.Should().NotHaveAnyDiagnostics();
// Ignore outputs-should-not-contain-secrets warnings which are expected
result.Diagnostics.Where(d => d.Code != "outputs-should-not-contain-secrets").Should().BeEmpty();
result.Template.Should().HaveValueAtPath("$.outputs['pkStandard'].value", "[listKeys(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, 'other'), 'Microsoft.Storage/storageAccounts', 'testacc'), '2019-06-01').keys[0].value]");
result.Template.Should().HaveValueAtPath("$.outputs['pkMethod'].value", "[listKeys(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, 'other'), 'Microsoft.Storage/storageAccounts', 'testacc'), '2019-06-01').keys[0].value]");
result.Template.Should().HaveValueAtPath("$.outputs['pkMethodVersionOverride'].value", "[listKeys(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, 'other'), 'Microsoft.Storage/storageAccounts', 'testacc'), '2021-01-01').keys[0].value]");
Expand Down

0 comments on commit 2bcfcf4

Please sign in to comment.