3.2 KiB
3.2 KiB
Ticket 0008: test.yml (reusable workflow)
Vaihe: 8/12
Status: pending
Feature branch: feature/0008-test-yml
TDD required: Yes
Feature file required: Yes
Required context:
docs/test-plan/tdd-guide.mdtests/features/0008-test-flow.feature- Skills:
tdd,implementation,clean-code
TDD — Red-Green-Refactor + Dogfood
Red
Validointitesti (tests/workflows.bats):
- Kaikki
workflow_dispatch-inputit:environment,version,tags,root_commit,root_repo,deploy_commit,deploy_repo version-checkkäyttäächeck-version.sh(Ticket 0011)- Cross-repo-raportointi: 3 suuntaa (test → test-repo, test → root, test → deploy)
bats tests/workflows.bats
# FAIL
Green
Toteuta gitea/workflows/test.yml.
bats tests/workflows.bats
# PASS
Dogfood
Lisää kutsu gitea/workflows/ci.yml:stä.
DoD
- Cucumber:
@ticket-0008 and @mock→ kaikki skenaariot GREEN tests/workflows.bats— workflow-validointi läpi- Version check -steppi kytketty (
check-version.sh) - Cross-repo-statusraportointi 3 suuntaan
- Dogfood: kirjaston CI käyttää tätä test flow'ssa
Toiminto
Test flow -steppi. Dispatchataan deploy-workflow'n jälkeen. Ajaa testit, puskaa raportit MinIO:hon ja raportoi statuksen kolmeen committiin.
Trigger
workflow_dispatch (dispatchataan ci-master.yml:stä)
Inputs (dispatch-parametrit)
| Parametri | Kuvaus |
|---|---|
environment |
Testiympäristö |
version |
Testattava konttiversio |
tags |
Cucumber-tagit |
versionApiUrl |
URL version tarkistukseen |
versionCheckScript |
Polku version check -skriptiin |
root_commit |
Mikropalvelun commit |
root_repo |
Mikropalvelun repo |
deploy_commit |
Helm-repon commit |
deploy_repo |
Helm-repo |
Steppit
start → version-check → run-tests → push-reports → report-cross-repo → end
| Steppi | Toiminto |
|---|---|
version-check |
check-version.sh — varmista oikea versio ympäristössä |
run-tests |
Projektin oma testiajo |
push-reports |
push-reports.sh — raportit MinIO:hon |
report-cross-repo |
report-status.sh — kolmeen committiin |
Cross-repo-raportointi (3 suuntaa)
# 1. Testi-repon oma commit
report-status.sh success "Tests OK" "$REPORT_URL" "test-{name}" "$GITHUB_SHA" "$GITHUB_REPOSITORY"
# 2. Mikropalvelun commit (root)
report-status.sh success "Tests OK ({name})" "$REPORT_URL" "test-{name}" "$ROOT_COMMIT" "$ROOT_REPO"
# 3. Helm-repon commit
report-status.sh success "tested v{version}" "$REPORT_URL" "tested-{name}" "$DEPLOY_COMMIT" "$DEPLOY_REPO"
Concurrency
concurrency:
group: test-${{ inputs.environment }}
cancel-in-progress: false
Verifiointi
Dispatchaa mock-inputeilla:
version-checkepäonnistuu → exit 1, status = "Version mismatch"- Testit ajetaan onnistuneesti
- Raportit MinIO:ssa, URL:t oikein
- Statusviestit kaikissa kolmessa commitissa
Viitteet
docs/workflows.md—test.yml— Test flow -steppidocs/config-model.md— Test flow -konfiguraatio, version checkdocs/requirements.md— UC6: Testi-insinööri näkee mitä konttia testattiin