From d0d9c90d9dec1af24135bb045579cb4e7211d081 Mon Sep 17 00:00:00 2001 From: Michael McCormick Date: Thu, 2 Apr 2026 12:35:28 -0500 Subject: [PATCH 1/3] Fix network connectivity check in integration tests to use Test-Connection for improved reliability --- .github/actions/ps-integration-tests/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/ps-integration-tests/action.yml b/.github/actions/ps-integration-tests/action.yml index a92780b..f68324d 100644 --- a/.github/actions/ps-integration-tests/action.yml +++ b/.github/actions/ps-integration-tests/action.yml @@ -11,7 +11,7 @@ runs: shell: pwsh run: | Set-StrictMode -Version Latest - if (Test-Netconnection -ComputerName 'rdap.org' -Port 443 -InformationLevel Quiet -ErrorAction Stop) { + if (Test-Connection -TargetName 'rdap.org' -TcpPort 443 -Count 1 -Quiet -ErrorAction SilentlyContinue) { Write-Host "Network connectivity to rdap.org verified." $env:RUN_LIVE_RDAP_TESTS=TRUE } else { From ec03750adeca2e74c2ac2b72138af1e2ca314317 Mon Sep 17 00:00:00 2001 From: Michael McCormick Date: Thu, 2 Apr 2026 12:43:11 -0500 Subject: [PATCH 2/3] Change RUN_LIVE_RDAP_TESTS value to string format --- .github/actions/ps-integration-tests/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/ps-integration-tests/action.yml b/.github/actions/ps-integration-tests/action.yml index f68324d..779c8f4 100644 --- a/.github/actions/ps-integration-tests/action.yml +++ b/.github/actions/ps-integration-tests/action.yml @@ -13,10 +13,10 @@ runs: Set-StrictMode -Version Latest if (Test-Connection -TargetName 'rdap.org' -TcpPort 443 -Count 1 -Quiet -ErrorAction SilentlyContinue) { Write-Host "Network connectivity to rdap.org verified." - $env:RUN_LIVE_RDAP_TESTS=TRUE + $env:RUN_LIVE_RDAP_TESTS='TRUE' } else { Write-Host "Unable to connect to rdap.org on port 443. Check network connectivity and firewall settings." - $env:RUN_LIVE_RDAP_TESTS=FALSE + $env:RUN_LIVE_RDAP_TESTS='FALSE' } Invoke-Build -Task IntegrationTests From 329d346e31b6b8edcff9f8c89fc14be40d13ce4b Mon Sep 17 00:00:00 2001 From: Michael McCormick Date: Thu, 2 Apr 2026 13:03:49 -0500 Subject: [PATCH 3/3] Always run live RDAP integration smoke tests +semver: patch --- .../actions/ps-integration-tests/action.yml | 7 ----- API.RDAP.build.ps1 | 6 +--- docs/development.md | 28 +++++-------------- .../Integration/Module.Integration.Tests.ps1 | 12 ++++---- 4 files changed, 13 insertions(+), 40 deletions(-) diff --git a/.github/actions/ps-integration-tests/action.yml b/.github/actions/ps-integration-tests/action.yml index 779c8f4..dd95687 100644 --- a/.github/actions/ps-integration-tests/action.yml +++ b/.github/actions/ps-integration-tests/action.yml @@ -11,13 +11,6 @@ runs: shell: pwsh run: | Set-StrictMode -Version Latest - if (Test-Connection -TargetName 'rdap.org' -TcpPort 443 -Count 1 -Quiet -ErrorAction SilentlyContinue) { - Write-Host "Network connectivity to rdap.org verified." - $env:RUN_LIVE_RDAP_TESTS='TRUE' - } else { - Write-Host "Unable to connect to rdap.org on port 443. Check network connectivity and firewall settings." - $env:RUN_LIVE_RDAP_TESTS='FALSE' - } Invoke-Build -Task IntegrationTests - name: Publish Integration Test Results diff --git a/API.RDAP.build.ps1 b/API.RDAP.build.ps1 index 7710bf8..635ccdd 100644 --- a/API.RDAP.build.ps1 +++ b/API.RDAP.build.ps1 @@ -102,11 +102,7 @@ Task UnitTests { } # Synopsis: Run integration tests on built module -Task IntegrationTests { - if (-not (Test-Path variable:env:RUN_LIVE_RDAP_TESTS) -or $null -eq $env:RUN_LIVE_RDAP_TESTS) { - $env:RUN_LIVE_RDAP_TESTS = 'false' - } - +Task IntegrationTests Build, { if (-not (Test-Path $testOutputPath)) { [void] (New-Item -Path $testOutputPath -ItemType Directory) } diff --git a/docs/development.md b/docs/development.md index dcbbfe0..39d5b93 100644 --- a/docs/development.md +++ b/docs/development.md @@ -277,7 +277,7 @@ Invoke-Build Test Invoke-Build UnitTests # Unit tests only Invoke-Build PSScriptAnalyzer # Code analysis only Invoke-Build InjectionHunter # Security scans only -Invoke-Build IntegrationTests # Integration tests (live smoke tests are opt-in) +Invoke-Build IntegrationTests # Integration tests (includes live RDAP smoke tests) # Run specific test file Invoke-Pester -Path ./src/Public/Get-Something.Tests.ps1 @@ -299,29 +299,15 @@ Invoke-Pester -Configuration @{ } ``` -### Live RDAP Smoke Test Toggle +### Live RDAP Smoke Tests -The integration suite includes a Live RDAP Smoke Tests context. These tests call real RDAP endpoints and are disabled by default to avoid network-dependent failures. +The integration suite includes a Live RDAP Smoke Tests context, and these tests always run as part of `Invoke-Build IntegrationTests`. -When Invoke-Build IntegrationTests runs: +Behavior: -- If RUN_LIVE_RDAP_TESTS is missing, it is set to false automatically. -- If RUN_LIVE_RDAP_TESTS is false, live smoke tests are skipped. -- If RUN_LIVE_RDAP_TESTS is true, live smoke tests execute. - -Enable live smoke tests for the current session: - -```powershell -$env:RUN_LIVE_RDAP_TESTS = 'true' -Invoke-Build IntegrationTests -``` - -Disable live smoke tests explicitly: - -```powershell -$env:RUN_LIVE_RDAP_TESTS = 'false' -Invoke-Build IntegrationTests -``` +- Live smoke tests call real RDAP endpoints (for example, `https://rdap.org`). +- If outbound network access is unavailable, the smoke tests fail and the integration task fails. +- `RUN_LIVE_RDAP_TESTS` is no longer used to enable, disable, or skip live smoke tests. ### Test Output Locations diff --git a/tests/Integration/Module.Integration.Tests.ps1 b/tests/Integration/Module.Integration.Tests.ps1 index 5c037be..5e8be49 100644 --- a/tests/Integration/Module.Integration.Tests.ps1 +++ b/tests/Integration/Module.Integration.Tests.ps1 @@ -13,9 +13,7 @@ BeforeAll { } else { throw "Built module not found at: $manifestPath. Run 'Invoke-Build' first." } - - # Live RDAP tests are opt-in to avoid network-dependent CI failures. - $script:runLiveRdapTests = [System.Convert]::ToBoolean($env:RUN_LIVE_RDAP_TESTS -eq 'true') } +} AfterAll { # Clean up @@ -159,15 +157,15 @@ Describe 'API.RDAP Integration Tests' -Tag 'Integration' { } Context 'Live RDAP Smoke Tests' { - It 'Should retrieve a known domain from the default RDAP server' -Skip:(-not $script:runLiveRdapTests) { + It 'Should retrieve a known domain from the default RDAP server' { $result = Get-RDAPDomain -Name 'example.com' $result | Should -Not -BeNullOrEmpty $result.GetType().Name | Should -Be 'RdapDomain' - $result.Name | Should -Not -BeNullOrEmpty + $result.LdhName | Should -Be 'example.com' } - It 'Should retrieve RDAP help data' -Skip:(-not $script:runLiveRdapTests) { + It 'Should retrieve RDAP help data' { $result = Get-RDAPHelp $result | Should -Not -BeNullOrEmpty @@ -175,7 +173,7 @@ Describe 'API.RDAP Integration Tests' -Tag 'Integration' { $result.RdapConformance.Count | Should -BeGreaterThan 0 } - It 'Should return a boolean from Test-RDAPObject' -Skip:(-not $script:runLiveRdapTests) { + It 'Should return a boolean from Test-RDAPObject' { $exists = Test-RDAPObject -Type Domain -Handle 'example.com' $exists.GetType().Name | Should -Be 'Boolean'