Skip to content

Commit

Permalink
feat: Adding fix to allow multiple telemtry deployments (#1671)
Browse files Browse the repository at this point in the history
## Description
Feat: Adding fix to allow multiple telemetry deployments 

Tested by adding additional telemtry deploy to DigitalTwins module and
runner pester tests locally. Pester test now searches for telemetry with
a name staring with `46d3xbcp*` as the unique ID for AVM.

Fixes #1612 


![image](https://github.com/Azure/bicep-registry-modules/assets/48600046/cf32ae21-cc0c-4455-b5f7-81f3ee5b7f80)

<!--
>Thank you for your contribution !
> Please include a summary of the change and which issue is fixed.
> Please also include the context.
> List any dependencies that are required for this change.

Fixes #123
Fixes #456
Closes #123
Closes #456
-->

## Pipeline Reference

<!-- Insert your Pipeline Status Badge below -->

| Pipeline |
| -------- |
|     N/A     |

## Type of Change

<!-- Use the check-boxes [x] on the options that are relevant. -->

- [x] Update to CI Environment or utlities (Non-module effecting
changes)
- [ ] Azure Verified Module updates:
- [ ] Bugfix containing backwards compatible bug fixes, and I have NOT
bumped the MAJOR or MINOR version in `version.json`:
- [ ] Someone has opened a bug report issue, and I have included "Closes
#{bug_report_issue_number}" in the PR description.
- [ ] The bug was found by the module author, and no one has opened an
issue to report it yet.
- [] Feature update backwards compatible feature updates, and I have
bumped the MINOR version in `version.json`.
- [ ] Breaking changes and I have bumped the MAJOR version in
`version.json`.
  - [ ] Update to documentation

## Checklist

- [x] I'm sure there are no other open Pull Requests for the same
update/change
- [ ] I have run `Set-AVMModule` locally to generate the supporting
module files.
- [x] My corresponding pipelines / checks run clean and green without
any errors or warnings

<!-- Please keep up to day with the contribution guide at
https://aka.ms/avm/contribute/bicep -->
  • Loading branch information
ChrisSidebotham authored Apr 12, 2024
1 parent 9ddcafc commit 07515bd
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ Describe 'Module tests' -Tag 'Module' {
$templateResources = $templateFileContent.resources.Keys | ForEach-Object { $templateFileContent.resources[$_] }
}

$telemetryDeployment = $templateResources | Where-Object { $_.condition -like '*telemetry*' } # The AVM telemetry prefix
$telemetryDeployment = $templateResources | Where-Object { $_.condition -like '*telemetry*' -and $_.name -like '46d3xbcp*' } # The AVM telemetry prefix
$telemetryDeployment | Should -Not -BeNullOrEmpty -Because 'A telemetry resource with name prefix [46d3xbcp] should be present in the template'
}

Expand All @@ -850,7 +850,7 @@ Describe 'Module tests' -Tag 'Module' {
$templateResources = $templateFileContent.resources.Keys | ForEach-Object { $templateFileContent.resources[$_] }
}

$telemetryDeployment = $templateResources | Where-Object { $_.condition -like '*telemetry*' } # The AVM telemetry prefix
$telemetryDeployment = $templateResources | Where-Object { $_.condition -like '*telemetry*' -and $_.name -like '46d3xbcp*' } # The AVM telemetry prefix

if (-not $telemetryDeployment) {
Set-ItResult -Skipped -Because 'Skipping this test as telemetry was not implemented in template'
Expand All @@ -873,7 +873,7 @@ Describe 'Module tests' -Tag 'Module' {
$templateResources = $templateFileContent.resources.Keys | ForEach-Object { $templateFileContent.resources[$_] }
}

$telemetryDeployment = $templateResources | Where-Object { $_.condition -like '*telemetry*' } # The AVM telemetry prefix
$telemetryDeployment = $templateResources | Where-Object { $_.condition -like '*telemetry*' -and $_.name -like '46d3xbcp*' } # The AVM telemetry prefix

if (-not $telemetryDeployment) {
Set-ItResult -Skipped -Because 'Skipping this test as telemetry was not implemented in template'
Expand Down Expand Up @@ -927,7 +927,7 @@ Describe 'Module tests' -Tag 'Module' {
} else {
$templateResources = $templateFileContent.resources.Keys | ForEach-Object { $templateFileContent.resources[$_] }
}
$telemetryDeploymentName = ($templateResources | Where-Object { $_.condition -like '*telemetry*' }).name # The AVM telemetry prefix
$telemetryDeploymentName = ($templateResources | Where-Object { $_.condition -like '*telemetry*' -and $_.name -like '46d3xbcp*' }).name # The AVM telemetry prefix
$telemetryDeploymentName | Should -Match "$expectedTelemetryIdentifier"
}
}
Expand Down

0 comments on commit 07515bd

Please sign in to comment.