Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .github/actions/ps-integration-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@ runs:
shell: pwsh
run: |
Set-StrictMode -Version Latest
if (Test-Netconnection -ComputerName 'rdap.org' -Port 443 -InformationLevel Quiet -ErrorAction Stop) {
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
Expand Down
6 changes: 1 addition & 5 deletions API.RDAP.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
28 changes: 7 additions & 21 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
12 changes: 5 additions & 7 deletions tests/Integration/Module.Integration.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -159,23 +157,23 @@ 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
$result.GetType().Name | Should -Be 'RdapHelp'
$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'
Expand Down
Loading