airvzxf / airvzxf/ftp-deployment-action

test(integration): no end-to-end scenario covers INPUT_UPLOAD_LOG_ON_FAILURE=true against the broken upload path

Ouverte
#325 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
area:tests audit pending-design test
Langage dominant
Shell
Étoiles
37
Forks
9
Merge moyen
44 min
PR mergées (30 j)
47

Description

## Problem

There is no integration scenario that exercises `INPUT_UPLOAD_LOG_ON_FAILURE=true` against a real vsftpd failure path, to verify:

1. The captured lftp log is actually written to `/home/lftp/.lftp-logs/run-.log` inside the action container.
2. The follow-up upload attempt (against the broken GitHub REST endpoint) fails gracefully and emits "WARNING: failed to upload log artifact... continuing to the failure banner" without aborting.
3. The action still exits 1 (the upload is fail-soft; the upload failure must not mask the mirror failure).
4. The `log_file` action output is set to the captured path.

The smoke tests cover the GITHUB_TOKEN-missing branch (smoke.sh:663-678 Test 30) but cannot verify the actual upload attempt (it requires a real GITHUB_API_URL reachable from the action container, plus GITHUB_TOKEN env, which the smoke harness does not provide).

## Why this matters

Per the action.yml upload_log_on_failure description ("**BROKEN** (do not rely on)"), the upload path always fails. Issue #290 documented the non-existent endpoint. The README "Workflow artifacts" section also documents this. A regression that "accidentally fixed" the broken path (or — more likely — a regression that caused the upload path to abort the action on failure) would not be caught today.

## Proposed fix

Add a scenario `14-upload-log-on-failure-e2e.sh` that:

1. Boots vsftpd with a credential the action will fail against (e.g., wrong password).
2. Sets `INPUT_UPLOAD_LOG_ON_FAILURE=true` + a fake `GITHUB_API_URL=http://127.0.0.1:1` (unreachable, so curl fails fast) + the rest of the required GITHUB_* env vars (GITHUB_TOKEN, GITHUB_REPOSITORY, GITHUB_RUN_ID, GITHUB_RUN_ATTEMPT).
3. Invokes the action image.
4. Asserts:
- Action exits 1.
- Captured log contains "WARNING: failed to upload log artifact" (the documented broken-path message).
- Captured log contains "Full lftp output: /home/lftp/.lftp-logs/run-*.log" (the log file path is exposed).
- Captured log does NOT contain "uploading log to ..." before the WARNING (would mean a different code path took over).

This is the only path that exercises the curl-based upload logic end-to-end.

## Severity

LOW — smoke tests the skip-paths; missing only the upload-attempt path.

## Related

- #290 (closed): upload_log_artifact uses non-existent endpoint (the reason this feature is broken; the proposed test exercises the documented broken behaviour, not a fix)

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Start with smoke.sh:663-678 (Test 30), then review action.yml's upload_log_on_failure description and the README's Workflow artifacts section. Add 14-upload-log-on-failure-e2e.sh and run the integration suite; done means it verifies exit 1, the documented warning and captured log path, and no pre-warning upload message.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
github-actions, shell
Domaine
ci-cd, testing
Type d'issue
Fonctionnalité
Difficulté
3/5
Temps estimé
1-2 jours
Activité
Active
Clarté
Clairement spécifiée
Accessibilité débutants
76/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.