Skip to content

Connect-DbaInstance - Skip the Windows SSPI test when the instance is not local - #10733

Merged
potatoqualitee merged 1 commit into
developmentfrom
tests-connect-dbainstance-windowssspi-skip-remote
Sep 22, 2026
Merged

potatoqualitee merged 1 commit into
developmentfrom
tests-connect-dbainstance-windowssspi-skip-remote

Conversation

@andreasjordan

Copy link
Copy Markdown
Collaborator

Summary

Connect-DbaInstance.WindowsSspi.Tests.ps1 creates a local Windows user on the machine running the tests and a login for it on $TestConfig.InstanceSingle. That only works when the instance runs on the same machine: a remote instance cannot resolve a local account of another computer, and CREATE LOGIN [ADMIN01\dbasspi...] FROM WINDOWS fails with error 15401, which fails both tests of the file in the BeforeAll. On the lab this was deterministic in every PowerShell 7 run (2026-09-01, 2026-09-19/20).

The Context now skips when the instance is not local, next to the existing platform skip. Connect-DbaInstance.Tests.ps1 and five other files already use the same IsLocalHost skip for behaviour that only a local instance can show. The CI runners host their instances locally, so nothing changes there.

Worth knowing: CI runs Pester on Windows PowerShell 5.1 only, and the Context already skips outside PowerShell 7, so this test currently only runs on a lab with PowerShell 7 and a local instance. The skip added here does not change that.

Test plan

  • Red on old: the file fails 0 of 2 on the lab (PowerShell 7, remote Single) with the 15401 error in the BeforeAll.
  • With the skip: 2 skipped on PowerShell 7 and on Windows PowerShell 5.1, no local user left behind.

created by Claude and reviewed by Andreas Jordan

🤖 Generated with Claude Code

… not local

(do Connect-DbaInstance)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@andreasjordan
andreasjordan marked this pull request as ready for review September 20, 2026 19:52

@potatoqualitee potatoqualitee left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed the complete patch at this exact head, including SSPI test setup/cleanup, locality behavior, surrounding implementation, discussions, and the dedicated passing CI execution. No material defects found.

@potatoqualitee

Copy link
Copy Markdown
Member

nice looks good thanks

@potatoqualitee
potatoqualitee merged commit d66096e into development Sep 22, 2026
22 checks passed
@potatoqualitee
potatoqualitee deleted the tests-connect-dbainstance-windowssspi-skip-remote branch September 22, 2026 12:56
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.

2 participants