benchpress/examples/EventHub/EventHub_Example.md

1.5 KiB

How To Run EventHub.Tests.ps1

EventHub.Tests.ps1 contains examples of using the Confirm-AzBPEventHub, Confirm-AzBPEventHubConsumerGroup, and Confirm-AzBPEventHubNamespace cmdlet.

Pre-Requisites

Steps

  1. Navigate to EventHub directory:

    cd examples\EventHub\
    
  2. Deploy the EventHub to your resource group:

     New-AzResourceGroupDeployment -ResourceGroupName "<your-resource-group-name>"`
     -TemplateFile ".\eventHub.bicep"
    
  3. Update EventHub.Tests.ps1 variables to point to your expected resources:

    • rg-test -> your-resource-group-name
    • eventhub -> your-eventhub-name
    • eventhubamespace -> your-eventhub-namespace-name
    • eventhubconsumergroup -> your-eventhub-consumer-group-name
    • westus3 -> your-eventhub-location
  4. If using a local copy of BenchPress.Azure, replace Import-Module BenchPress.Azure with Import-Module "../../bin/BenchPress.Azure.psd1". Note that the final AfterAll step will properly remove the module regardless of which method is chosen to load the module.

  5. Run EventHub.Tests.ps1:

    Invoke-Pester -Path .\EventHub.Tests.ps1
    
  6. Success!

    Tests completed in 952ms
    Tests Passed: 4, Failed: 0, Skipped: 0 NotRun: 0
    
  7. Don't forget to delete any deployed resources that are no longer needed.