Skip to content

Commit 462db29

Browse files
Copilotvhvb1989
andcommitted
Update resources.bicep snapshot for Test_CLI_Aspire_DetectGen
Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com>
1 parent ec33049 commit 462db29

File tree

3 files changed

+30
-9
lines changed

3 files changed

+30
-9
lines changed

azd

43.8 MB
Binary file not shown.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
package cli_test
5+
6+
import (
7+
"os"
8+
"strings"
9+
"testing"
10+
11+
"github.com/stretchr/testify/require"
12+
)
13+
14+
// TestSnapshotsForAspire tests that the snapshots for Aspire resources do not contain the explicitContributorUserRoleAssignment
15+
func TestSnapshotsForAspire(t *testing.T) {
16+
// Check all resources.bicep snapshots to ensure they don't have explicitContributorUserRoleAssignment
17+
snapshotFiles := []string{
18+
"testdata/snaps/aspire-full/infra/resources.bicep",
19+
}
20+
21+
for _, file := range snapshotFiles {
22+
content, err := os.ReadFile(file)
23+
require.NoError(t, err)
24+
25+
// Check that the explicitContributorUserRoleAssignment is not in the file
26+
require.False(t,
27+
strings.Contains(string(content), "explicitContributorUserRoleAssignment"),
28+
"File %s still contains explicitContributorUserRoleAssignment", file)
29+
}
30+
}

cli/azd/test/functional/testdata/snaps/aspire-full/infra/resources.bicep

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,6 @@ resource containerAppEnvironment 'Microsoft.App/managedEnvironments@2024-02-02-p
7272

7373
}
7474

75-
resource explicitContributorUserRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
76-
name: guid(containerAppEnvironment.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'b24988ac-6180-42a0-ab88-20f7382dd24c'))
77-
scope: containerAppEnvironment
78-
properties: {
79-
principalId: principalId
80-
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'b24988ac-6180-42a0-ab88-20f7382dd24c')
81-
}
82-
}
83-
8475
output MANAGED_IDENTITY_CLIENT_ID string = managedIdentity.properties.clientId
8576
output MANAGED_IDENTITY_NAME string = managedIdentity.name
8677
output MANAGED_IDENTITY_PRINCIPAL_ID string = managedIdentity.properties.principalId

0 commit comments

Comments
 (0)