-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
Description
Problem
The current artifact tests in Artifacts.Tests.ps1 rely on environment variables and actual artifacts from the PSModule/GitHub repository:
$Owner = $env:GITHUB_REPOSITORY_OWNER
$Repository = $env:GITHUB_REPOSITORY_NAME
$WorkflowRunId = $env:GITHUB_RUN_ID
$ArtifactName = 'module'This approach has several limitations:
- Dependency on real data: Tests depend on artifacts actually existing in the repository
- Brittle tests: If artifacts are deleted or workflow runs change, tests may fail
- Limited test scenarios: Can only test against whatever artifacts happen to exist
- CI/CD coupling: Tests are tightly coupled to the CI/CD pipeline state
Proposed Solution
Create a dedicated test environment for artifact tests that:
- Mock artifact data: Use test fixtures or mock data instead of relying on real artifacts
- Predictable test data: Create a controlled set of test artifacts with known properties
- Isolated test workflows: Consider a separate workflow that generates test artifacts specifically for testing purposes
- Better coverage: Enable testing edge cases and error scenarios that may not exist in production
Implementation Ideas
- Create a dedicated test workflow that generates artifacts with predictable names and properties
- Use mock/stub data for unit tests
- Consider integration tests that use a sandbox repository
- Document the test data setup in the test README
Related Files
tests/Artifacts.Tests.ps1(lines 37-40)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Todo