tiketit ja featuret vaihe 1
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
# 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.md`
|
||||
- `tests/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-check` käyttää `check-version.sh` (Ticket 0011)
|
||||
- Cross-repo-raportointi: 3 suuntaa (test → test-repo, test → root, test → deploy)
|
||||
|
||||
```bash
|
||||
bats tests/workflows.bats
|
||||
# FAIL
|
||||
```
|
||||
|
||||
### Green
|
||||
Toteuta `gitea/workflows/test.yml`.
|
||||
|
||||
```bash
|
||||
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)
|
||||
|
||||
```bash
|
||||
# 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
|
||||
|
||||
```yaml
|
||||
concurrency:
|
||||
group: test-${{ inputs.environment }}
|
||||
cancel-in-progress: false
|
||||
```
|
||||
|
||||
## Verifiointi
|
||||
|
||||
Dispatchaa mock-inputeilla:
|
||||
1. `version-check` epäonnistuu → exit 1, status = "Version mismatch"
|
||||
2. Testit ajetaan onnistuneesti
|
||||
3. Raportit MinIO:ssa, URL:t oikein
|
||||
4. Statusviestit kaikissa kolmessa commitissa
|
||||
|
||||
## Viitteet
|
||||
|
||||
- `docs/workflows.md` — `test.yml` — Test flow -steppi
|
||||
- `docs/config-model.md` — Test flow -konfiguraatio, version check
|
||||
- `docs/requirements.md` — UC6: Testi-insinööri näkee mitä konttia testattiin
|
||||
Reference in New Issue
Block a user