Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
# Syntaxe : <pattern de fichier> <@utilisateur ou @org/équipe>

# Par défaut : tout changement requiert une review de ces personnes
* @<benslimane-byte>
* @benslimane-byte

# Les workflows CI/CD ne peuvent être modifiés que par le lead DevOps
.github/workflows/ @<benslimane-byte>
.github/workflows/ @benslimane-byte

# Le fichier de dépendances requiert une validation technique
ressources/requirements.txt @<benslimane-byte>
ressources/requirements.txt @benslimane-byte

# Les fichiers de sécurité requièrent une double validation
.github/dependabot.yml @<benslimane-byte>
.github/CODEOWNERS @<benslimane-byte>
.github/dependabot.yml @benslimane-byte
.github/CODEOWNERS @benslimane-byte
# Tout changement requiert une approbation de votre binôme
* @benslimane-byte @bambstk

# Les workflows ne peuvent être modifiés qu'avec validation des deux
.github/workflows/ @benslimane-byte @bambstk

# Le code applicatif
ressources/ @benslimane-byte @bambstk
2 changes: 1 addition & 1 deletion notes.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# Mon TP GitHub Actions
# Mon TP GitHub Actions !
Binary file modified ressources/__pycache__/app.cpython-314.pyc
Binary file not shown.
Binary file modified ressources/__pycache__/test_app.cpython-314-pytest-8.2.0.pyc
Binary file not shown.
9 changes: 9 additions & 0 deletions ressources/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,14 @@ def logs_critical():
return jsonify({"critical_count": seuil, "alerte": alerte})


@app.route("/logs/stats")
def logs_stats():
total = sum(LOG_SUMMARY.values())
return jsonify({
"total": total,
"breakdown": LOG_SUMMARY
})


if __name__ == "__main__":
app.run(debug=True, port=5001)
10 changes: 10 additions & 0 deletions ressources/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,13 @@ def test_logs_critical_alerte(client):
assert "critical_count" in data
assert "alerte" in data
assert data["alerte"] is True


def test_logs_stats(client):
"""La route /logs/stats retourne le total et le détail."""
response = client.get("/logs/stats")
assert response.status_code == 200
data = response.get_json()
assert "total" in data
assert "breakdown" in data
assert data["total"] == 185 # 142 + 28 + 12 + 3
Loading