Feature/git pages -> oma nginx perusteinen raporointipalvelu #48

Merged
niko merged 11 commits from feature/git-pages-sisäinen-toiminta-default-moodiin into main 2026-06-28 09:10:10 +03:00
3 changed files with 21 additions and 12 deletions
Showing only changes of commit c635044a03 - Show all commits
+8
View File
@@ -67,6 +67,14 @@ class H(http.server.BaseHTTPRequestHandler):
self.end_headers()
self.wfile.write(body.encode())
def do_PUT(self):
self._log_request('PUT')
code, body = self._get_response()
self.send_response(code)
self.send_header('Content-Type', 'application/json')
self.end_headers()
self.wfile.write(body.encode())
def do_PATCH(self):
self._log_request('PATCH')
code, body = self._get_response()
+11 -11
View File
@@ -7,15 +7,15 @@ setup() {
export GIT_PAGES_PUBLISH_TOKEN="publish-token-abc"
export GITHUB_REPOSITORY="test-owner/test-repo"
export GITHUB_SHA="abc123def456789012345678901234567890abcd"
export GITHUB_REF_NAME="main"
REPORT_DIR="reports/abc123de/unit-tests"
mkdir -p "$REPORT_DIR"
echo "<html>test</html>" > "$REPORT_DIR/index.html"
mkdir -p "unit-tests"
echo "<html>test</html>" > "unit-tests/index.html"
}
teardown() {
mock_stop
rm -rf "reports/abc123de"
rm -rf "unit-tests" "sub"
}
@test "missing suite_path argument → exit 1" {
@@ -24,11 +24,11 @@ teardown() {
[[ "$output" == *"ERROR"* ]]
}
@test "missing GITEA_API_URL → exit 1" {
unset GITEA_API_URL
@test "missing GITHUB_REF_NAME → exit 1" {
unset GITHUB_REF_NAME
run bash scripts/publish-git-pages.sh "unit-tests"
[ "$status" -eq 1 ]
[[ "$output" == *"GITEA_API_URL"* ]]
[[ "$output" == *"GITHUB_REF_NAME"* ]]
}
@test "missing GIT_PAGES_URL → exit 1" {
@@ -65,19 +65,19 @@ teardown() {
mock_start
run bash scripts/publish-git-pages.sh "unit-tests"
[ "$status" -eq 0 ]
[[ "$output" == "http://localhost:18080/test-owner/test-repo/reports/abc123de" ]]
[[ "$output" == "http://localhost:18080/test-owner/test-repo/main/abc123de/unit-tests/" ]]
}
@test "publish with suite subpath" {
mkdir -p "reports/abc123de/sub/suite"
echo "sub" > "reports/abc123de/sub/suite/result.html"
mkdir -p "sub/suite"
echo "sub" > "sub/suite/result.html"
mock_set_sequence '[
{"code":200,"body":"published"}
]'
mock_start
run bash scripts/publish-git-pages.sh "sub/suite"
[ "$status" -eq 0 ]
[[ "$output" == "http://localhost:18080/test-owner/test-repo/reports/abc123de" ]]
[[ "$output" == "http://localhost:18080/test-owner/test-repo/main/abc123de/sub/suite/" ]]
}
@test "git-pages returns HTTP 500 → exit 1" {
+2 -1
View File
@@ -8,6 +8,7 @@ setup() {
export GITHUB_REPOSITORY="test-owner/test-repo"
export GITHUB_SHA="abc123def456789012345678901234567890abcd"
export GITHUB_RUN_ID="42"
export GITHUB_REF_NAME="main"
}
teardown() {
@@ -35,7 +36,7 @@ teardown() {
body=$(mock_get_request_body)
[[ "$body" == *'"state":"success"'* ]]
[[ "$body" == *'"context":"unit-test"'* ]]
[[ "$body" == *'"target_url":"https://reports.example.com/test-owner/test-repo/reports/abc123de/cucumber/"'* ]]
[[ "$body" == *'"target_url":"https://reports.example.com/test-owner/test-repo/main/abc123de/cucumber/"'* ]]
}
@test "failure status constructs run URL when no suite" {