Skip to content

experiment: pass ALL secrets/variables into module tests#35

Closed
MariusStorhaug wants to merge 8 commits into
mainfrom
experiment/testdata-pass-all
Closed

experiment: pass ALL secrets/variables into module tests#35
MariusStorhaug wants to merge 8 commits into
mainfrom
experiment/testdata-pass-all

Conversation

@MariusStorhaug

Copy link
Copy Markdown
Owner

Experiment (not for merge).

Changes the caller TestData input to a full dump:

TestData: >-
  { "secrets": ${{ toJSON(secrets) }}, "variables": ${{ toJSON(vars) }} }

and rewrites tests/Environment.Tests.ps1 to iterate and print every environment variable the job can see.

Goal: observe whether Import-TestData can enumerate a full dump, and how Actions masks secrets.

Expectation: Import-TestData likely rejects the auto-injected github_token (reserved GITHUB_ prefix), failing the "Expose caller-provided test data" step before tests run.

Marius Storhaug and others added 6 commits July 10, 2026 22:17
Point CI at PSModule/Process-PSModule@feat/import-testdata. Push a masked secret (TEST_SECRET) and a non-masked variable (TEST_VARIABLE) into the module test jobs via TestData, asserted in tests/Environment.Tests.ps1. Reorganize public functions into sections (Greetings/ with a named landing page, DateAndTime/ with an index.md landing page) to show documentation on the section nodes, leaving Get-PSModuleTest at the top level.
Adds an It block that Write-Hosts both values. GitHub Actions masks TEST_SECRET (registered via ::add-mask:: by Import-TestData) to *** in the log, while TEST_VARIABLE is printed verbatim - demonstrating that only the secrets map is masked.
The Import-TestData plumbing and always-evaluate-version-labels fix are now released in Process-PSModule v6.1.2 (via PSModule/Process-PSModule#377, IPH v1.0.9 + Resolve-PSModuleVersion v1.1.4), so the temporary feat/import-testdata branch ref is replaced with the released tag.
Per the GitHub Actions coding standard, uses: references are pinned to a full 40-character commit SHA with the human-readable version as a trailing comment. Replaces the v6.1.2 tag pin with its commit SHA (d4020f3).
Replaces the two hardcoded TestData fixtures with toJSON(secrets)/toJSON(vars) to dump every secret and variable, and rewrites the environment test to iterate and print every environment variable the job can see. Purpose: observe whether Import-TestData can enumerate a full dump (and how Actions masks secrets).
@github-actions

github-actions Bot commented Jul 11, 2026

Copy link
Copy Markdown

Super-linter summary

Language Validation result
CHECKOV Pass ✅
GITHUB_ACTIONS Pass ✅
GITLEAKS Pass ✅
GIT_MERGE_CONFLICT_MARKERS Pass ✅
MARKDOWN Pass ✅
NATURAL_LANGUAGE Pass ✅
POWERSHELL Pass ✅
PRE_COMMIT Pass ✅
SPELL_CODESPELL Pass ✅
TRIVY Pass ✅
YAML Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

The raw toJSON(secrets) dump failed because Import-TestData rejects the auto-injected github_token (reserved GITHUB_ prefix). Add a Prep-TestData job that serializes all secrets/variables, removes github_token, and forwards the sanitized JSON as the TestData secret so the full enumeration can actually run.
…plicitly

Proves the positive half: variables enumerate fine via toJSON(vars) (no github_token, not secret-blocked, passed inline), while secrets must be named explicitly.
@MariusStorhaug

Copy link
Copy Markdown
Owner Author

Experiment complete — findings recorded. Closing and deleting this throwaway branch.

@MariusStorhaug MariusStorhaug deleted the experiment/testdata-pass-all branch July 11, 2026 09:50
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.

1 participant