diff options
| author | ertopogo <erwin.t.pombett@gmail.com> | 2026-03-14 16:20:58 +0100 |
|---|---|---|
| committer | ertopogo <erwin.t.pombett@gmail.com> | 2026-03-14 16:20:58 +0100 |
| commit | 338aff0cb5a07237e5147daecf9872f1edc5922b (patch) | |
| tree | b1c277aa3d1cabe41b9bb45825f75488b4b4e80e | |
| parent | ca7cda86882d069fb72a557159dec6a2c6430922 (diff) | |
Fix WSL bash scripts line endings (LF) and document CRLF troubleshootingdevelop
| -rw-r--r-- | .gitattributes | 2 | ||||
| -rw-r--r-- | docs/CHANGELOG_OPERATIONS.md | 2 | ||||
| -rw-r--r-- | docs/TROUBLESHOOTING.md | 1 | ||||
| -rw-r--r-- | tests/README.md | 44 |
4 files changed, 49 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..f2338ae --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +*.sh text eol=lf
+tests/*.sh text eol=lf
diff --git a/docs/CHANGELOG_OPERATIONS.md b/docs/CHANGELOG_OPERATIONS.md index 6d4f43d..c7bbe19 100644 --- a/docs/CHANGELOG_OPERATIONS.md +++ b/docs/CHANGELOG_OPERATIONS.md @@ -35,3 +35,5 @@ Chaque action d'installation, configuration ou troubleshooting doit ajouter une | 2026-03-08 | install | deploiement konenpan | Ajout runbook de transfert/release/rollback pour poser les fichiers sur la VM | docs/DEPLOIEMENT_KONENPAN.md, INSTALLATION.md | OK | equipe-plateforme | | 2026-03-08 | install | git relay chillka | Standardisation du flux Antel -> chillka bare repo -> konenpan avec branches `main` + `develop` | docs/DEPLOIEMENT_KONENPAN.md, INSTALLATION.md | OK | equipe-plateforme | | 2026-03-08 | install | media-access-api local | Ajout du service `media-access-api` (code + Dockerfile) et bascule du compose en build local sans dependance GHCR | media-access-api/, compose.photoprism-secure.dev.yml, .env.photoprism-secure.example, MEDIA_ACCESS_API.md, INSTALLATION.md, TROUBLESHOOTING.md, DEPLOIEMENT_KONENPAN.md | OK | equipe-plateforme | +| 2026-03-08 | config | tests e2e api medias | Ajout scripts de test token/permissions/presign pour valider ACL de bout en bout | tests/README.md, tests/get_token.sh, tests/e2e_permissions_and_presign.sh, INSTALLATION.md | OK | equipe-plateforme | +| 2026-03-08 | troubleshoot | scripts tests wsl | Correction guidance CRLF->LF pour scripts Bash sous WSL + regle `.gitattributes` | .gitattributes, tests/README.md, TROUBLESHOOTING.md | OK | equipe-plateforme | diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.md index e05cc03..7d9a273 100644 --- a/docs/TROUBLESHOOTING.md +++ b/docs/TROUBLESHOOTING.md @@ -51,6 +51,7 @@ Interpretation rapide: | Token invalide | Mauvaise config OIDC | Verifier issuer/audience | Corriger configuration client | | 401 sur viewer-bff | Token absent/non transfere | Verifier header Authorization | Rejouer avec Bearer token valide | | `denied` pull image `media-access-api` | Image distante invalide/inaccessible | Verifier `MEDIA_ACCESS_API_IMAGE` et dossier `media-access-api/` | Utiliser build local compose et relancer avec `--build` | +| Scripts tests KO sous WSL (`bash\r`) | Fins de ligne CRLF | `file tests/*.sh`, message `/usr/bin/env: bash\r` | Convertir en LF (`sed -i 's/\r$//' tests/*.sh`) et rejouer | | Heure incoherente | NTP non synchronise | `timedatectl`, `chronyc tracking` | Configurer chrony vers `araucaria` | | Nom DNS local non resolu | Record dnsmasq absent/invalide | `dig +short <host>.arauco.online` | Corriger fichier dnsmasq puis restart service | | HTTPS KO via domaine | Caddy non charge / vhost invalide | `caddy validate`, `journalctl -u caddy` | Corriger Caddyfile puis reload Caddy | diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 0000000..170e1af --- /dev/null +++ b/tests/README.md @@ -0,0 +1,44 @@ +# Tests E2E ACL medias
+
+## Prerequis
+- `curl`
+- `jq`
+- Acces a `kc.arauco.online` et `media-api.arauco.online`
+
+## 1) Recuperer un token OIDC
+```bash
+bash tests/get_token.sh
+```
+
+Le script genere:
+- `tests/.token`
+- `tests/.env.test` (si absent)
+
+### Si erreur `bash\r` ou `pipefail`
+Les scripts ont ete modifies pour forcer des fins de ligne Linux (`LF`) via `.gitattributes`.
+Sur un clone existant sous WSL, normaliser une fois:
+```bash
+sed -i 's/\r$//' tests/*.sh
+chmod +x tests/*.sh
+```
+
+## 2) Lancer les tests permissions + presign
+```bash
+bash tests/e2e_permissions_and_presign.sh
+```
+
+## Variables a renseigner
+Fichier `tests/.env.test`:
+- `KC_REALM`
+- `KC_CLIENT_ID`
+- `KC_CLIENT_SECRET`
+- `KC_USER`
+- `KC_PASS`
+- `MEDIA_API_BASE_URL`
+- `TEST_ALLOWED_OBJECT_KEY`
+- `TEST_FORBIDDEN_OBJECT_KEY`
+
+## Resultat attendu
+- `GET /v1/permissions` retourne `200`
+- `POST /v1/presign` objet autorise retourne `200`
+- `POST /v1/presign` objet interdit retourne `403` (ou `404` si la ressource n'existe pas et l'API choisit de masquer)
|
