Skip to content
Closed
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
6 changes: 3 additions & 3 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Installer les dépendances
run: pip install -r ressources/requirements.txt

- name: Déployer sur Azure App Service (staging)
uses: azure/webapps-deploy@v3
with:
app-name: "ten-nexacloud-api-staging-27050"
app-name: "ten-nexacloud-api-staging-28547"
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE_STAGING }}
package: ressources/

Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:
- name: Déployer sur Azure App Service (production)
uses: azure/webapps-deploy@v3
with:
app-name: "ten-nexacloud-api-production-29408"
app-name: "ten-nexacloud-api-production-7220"
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE_PRODUCTION }}
package: ressources/

Expand Down
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: 9 additions & 1 deletion ressources/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,12 @@ def test_logs_critical_alerte(client):
assert "alerte" in data
assert data["alerte"] is True

# no change

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