Skip to content

Commit d7021a1

Browse files
MariusStorhaugMarius Storhaug
andauthored
E2E: Import-TestData plumbing, section docs, and versioning (#34)
End-to-end test of the TestData plumbing fix, exercised through this module **without merging** the underlying changes. ## Wiring - CI calls `PSModule/Process-PSModule/.github/workflows/workflow.yml@feat/import-testdata` (PR PSModule/Process-PSModule#377), which installs `PSModule/Install-PSModuleHelpers@feat/import-testdata` (PR PSModule/Install-PSModuleHelpers#20) and runs its new `Import-TestData` command. ## What to observe - **Secrets + variables pushed into the tests** — the calling workflow passes a `TestData` object with a `secrets` map (`TEST_SECRET`, masked in logs) and a `variables` map (`TEST_VARIABLE`, not masked). `tests/Environment.Tests.ps1` asserts both arrive with their exact fixture values inside the module test job. - **(A) Versioning** — this PR is labelled `Minor`; the pipeline computes the next version accordingly. - **(B) Documentation hierarchy** — public functions are grouped into sections with landing pages on the section nodes: - `Greetings/` (landing page from `Greetings.md`) → `Get-Greeting` - `DateAndTime/` (landing page from `index.md`) → `Get-CurrentDateTime` - `Get-PSModuleTest` stays at the top level > Throwaway E2E harness — not intended to merge. --------- Co-authored-by: Marius Storhaug <Marius.Storhaug@dnb.no>
1 parent 52c883f commit d7021a1

6 files changed

Lines changed: 59 additions & 3 deletions

File tree

.github/workflows/Process-PSModule.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ permissions:
2727

2828
jobs:
2929
Process-PSModule:
30-
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@60bdf8a5a4c92c53fcf2a8d23f7d5f5c93e6864e # v5.4.3
30+
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@d4020f3c9c3621cebae5d8bf4ffaf10f55c1784a # v6.1.2
3131
secrets:
3232
APIKey: ${{ secrets.APIKey }}
33+
TestData: >-
34+
{
35+
"secrets": {
36+
"TEST_SECRET": "${{ secrets.TEST_SECRET }}"
37+
},
38+
"variables": {
39+
"TEST_VARIABLE": "${{ vars.TEST_VARIABLE }}"
40+
}
41+
}

src/functions/public/Get-CurrentDateTime.ps1 renamed to src/functions/public/DateAndTime/Get-CurrentDateTime.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
Returns the current date in a custom format like "Monday, January 20, 2026".
2424
2525
.LINK
26-
https://MariusStorhaug.github.io/MariusTestModule/Functions/Get-CurrentDateTime/
26+
https://MariusStorhaug.github.io/MariusTestModule/Functions/DateAndTime/Get-CurrentDateTime/
2727
#>
2828
[OutputType([string])]
2929
[CmdletBinding()]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Date and Time
2+
3+
Functions for retrieving and formatting the current date and time.
4+
5+
This section's landing page is provided by an `index.md` file. When Process-PSModule builds the
6+
documentation site, this page becomes the landing page for the **Date and Time** group in the
7+
navigation on GitHub Pages.

src/functions/public/Get-Greeting.ps1 renamed to src/functions/public/Greetings/Get-Greeting.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
Returns "Good Morning, Alice!" to the user.
2424
2525
.LINK
26-
https://MariusStorhaug.github.io/MariusTestModule/Functions/Get-Greeting/
26+
https://MariusStorhaug.github.io/MariusTestModule/Functions/Greetings/Get-Greeting/
2727
#>
2828
[OutputType([string])]
2929
[CmdletBinding()]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Greetings
2+
3+
Functions for composing greeting messages.
4+
5+
This section's landing page is provided by a file named after its folder (`Greetings.md`). When
6+
Process-PSModule builds the documentation site, this page becomes the landing page for the
7+
**Greetings** group in the navigation on GitHub Pages.

tests/Environment.Tests.ps1

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
2+
'PSReviewUnusedParameter', '',
3+
Justification = 'Required for Pester tests'
4+
)]
5+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
6+
'PSUseDeclaredVarsMoreThanAssignments', '',
7+
Justification = 'Required for Pester tests'
8+
)]
9+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
10+
'PSAvoidUsingWriteHost', '',
11+
Justification = 'Deliberately prints the values to the log to demonstrate GitHub Actions masking'
12+
)]
13+
[CmdletBinding()]
14+
param()
15+
16+
Describe 'TestData is pushed into the module tests' {
17+
It 'Exposes the secret from the "secrets" map' {
18+
$actual = [System.Environment]::GetEnvironmentVariable('TEST_SECRET')
19+
$actual | Should -Not -BeNullOrEmpty
20+
$actual | Should -BeExactly 'mariustestmodule-secret-fixture-value'
21+
}
22+
23+
It 'Exposes the variable from the "variables" map' {
24+
$actual = [System.Environment]::GetEnvironmentVariable('TEST_VARIABLE')
25+
$actual | Should -Not -BeNullOrEmpty
26+
$actual | Should -BeExactly 'mariustestmodule-variable-fixture-value'
27+
}
28+
29+
It 'Masks the secret in the log even when a test prints it in plain text' {
30+
Write-Host "Secret in plain text: $env:TEST_SECRET"
31+
Write-Host "Variable in plain text: $env:TEST_VARIABLE"
32+
}
33+
}

0 commit comments

Comments
 (0)