Skip to content

Test-DbaReplLatency - Fix property assignments#10372

Open
haxr wants to merge 3 commits into
dataplat:developmentfrom
haxr:patch-1
Open

Test-DbaReplLatency - Fix property assignments#10372
haxr wants to merge 3 commits into
dataplat:developmentfrom
haxr:patch-1

Conversation

@haxr
Copy link
Copy Markdown

@haxr haxr commented May 18, 2026

Type of Change

  • Bug fix (non-breaking change, fixes Test-DbaReplLatency - Needs some love #9028)
  • New feature (non-breaking change, adds functionality, fixes # )
  • Breaking change (affects multiple commands or functionality, fixes # )
  • Ran manual Pester test and has passed (Invoke-ManualPester)
  • Adding code coverage to existing functionality
  • Pester test is included
  • If new file reference added for test, has is been added to github.com/dataplat/appveyor-lab ?
  • Unit test is included
  • Documentation
  • Build system

Purpose

To get Test-DbaReplLatency cmdlet to function, it is currently broken

Approach

Fixes the property names to allow the cmdlet to work

Commands to test

The examples should suffice, the cmdlet breaks very early on currently

Screenshots

Learning

First PR, please feel free to edit as needed

@potatoqualitee
Copy link
Copy Markdown
Member

potatoqualitee commented May 24, 2026

thank you very much for the patch! being the first PR after 14 years is an honor 😊 will merge after tests pass.

@claude what happened prior to break this? did the property names change in Smo? this must have worked at some point eh? `you have proper permissions now and should work try again.

@potatoqualitee potatoqualitee changed the title Fix property assignments in Test-DbaReplLatency.ps1 Test-DbaReplLatency - Fix property assignments May 24, 2026
@potatoqualitee potatoqualitee requested a review from Copilot May 24, 2026 06:57
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Test-DbaReplLatency failing early by aligning replication publication property access with Get-DbaReplPublication output.

Changes:

  • Use Name and DatabaseName from publication objects when configuring TransPublication and PublicationMonitor
  • Update output fields to use publication Name/DatabaseName and publisher instance identity from the connected server object

Comment on lines +139 to +140
$transPub.Name = $publication.Name
$transPub.DatabaseName = $publication.DatabaseName
Copy link
Copy Markdown
Member

@potatoqualitee potatoqualitee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix @haxr — nice catch for a first PR!

To answer @potatoqualitee's question: SMO didn't change. This has been broken since the initial replication commit (#8958, Sep 2023). Get-DbaReplPublication returns SMO TransPublication/MergePublication objects whose native properties are .Name, .DatabaseName, etc. But Test-DbaReplLatency was written using .PublicationName, .Database, and .Server — properties that never existed on these objects. Looks like it was drafted against a different object shape and never validated end-to-end. So this command has never worked correctly.

One missed fix: Line 130 still has the same stale property name:

$publicationNames = $publicationNames | Where-Object PublicationName -in $PublicationName

This needs to be Where-Object Name to match the actual SMO property — otherwise the -PublicationName parameter filter silently returns nothing.

(do Test-DbaReplLatency)

@potatoqualitee
Copy link
Copy Markdown
Member

Very nice, it's been a while since I used the copilot review and it is better now and matches with Claude.

I have made the small change that's needed. Thanks again for the fix, it'll be merged soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test-DbaReplLatency - Needs some love

3 participants