Skip to content

Commit 6712085

Browse files
🩹 [Patch]: Skip integration tests unless all Confluence credentials are present
1 parent 8b717c2 commit 6712085

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

‎tests/Confluence.Tests.ps1‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,17 @@ Describe 'Confluence' {
7070
}
7171
}
7272

73-
# Integration tests run only when live credentials are provided. The calling workflow supplies
74-
# them through Process-PSModule's TestSecrets (CONFLUENCE_API_TOKEN, masked) and TestVariables
75-
# (CONFLUENCE_SITE, CONFLUENCE_USERNAME, CONFLUENCE_SPACE_KEY), which are exposed as environment
76-
# variables. They are skipped locally and wherever the API token is not available.
77-
Context 'Integration' -Skip:([string]::IsNullOrEmpty($env:CONFLUENCE_API_TOKEN)) {
73+
# Integration tests run only when ALL live credentials are provided. The calling workflow supplies
74+
# them through Process-PSModule's TestData - CONFLUENCE_API_TOKEN under "secrets" (masked) and
75+
# CONFLUENCE_SITE, CONFLUENCE_USERNAME and CONFLUENCE_SPACE_KEY under "variables" - exposed as
76+
# environment variables. The context is skipped locally and whenever any of them is missing.
77+
$missingIntegrationVars = @(
78+
$env:CONFLUENCE_API_TOKEN
79+
$env:CONFLUENCE_SITE
80+
$env:CONFLUENCE_USERNAME
81+
$env:CONFLUENCE_SPACE_KEY
82+
) | Where-Object { [string]::IsNullOrEmpty($_) }
83+
Context 'Integration' -Skip:(@($missingIntegrationVars).Count -gt 0) {
7884
BeforeAll {
7985
$secureToken = ConvertTo-SecureString -String $env:CONFLUENCE_API_TOKEN -AsPlainText -Force
8086
$connectParams = @{

0 commit comments

Comments
 (0)