about summary refs log tree commit diff
path: root/pkgs/development/tools/continuous-integration/codeberg-pages/disable_httptest.patch
blob: 90c815712d388a562e8f8b922b9408457b45df12 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
diff --git a/server/handler/handler_test.go b/server/handler/handler_test.go
deleted file mode 100644
index 6521633..0000000
--- a/server/handler/handler_test.go
+++ /dev/null
@@ -1,52 +0,0 @@
-package handler
-
-import (
-	"net/http"
-	"net/http/httptest"
-	"testing"
-	"time"
-
-	"codeberg.org/codeberg/pages/server/cache"
-	"codeberg.org/codeberg/pages/server/gitea"
-	"github.com/rs/zerolog/log"
-)
-
-func TestHandlerPerformance(t *testing.T) {
-	giteaClient, _ := gitea.NewClient("https://codeberg.org", "", cache.NewKeyValueCache(), false, false)
-	testHandler := Handler(
-		"codeberg.page", "raw.codeberg.org",
-		giteaClient,
-		"https://docs.codeberg.org/pages/raw-content/",
-		[]string{"/.well-known/acme-challenge/"},
-		[]string{"raw.codeberg.org", "fonts.codeberg.org", "design.codeberg.org"},
-		[]string{"pages"},
-		cache.NewKeyValueCache(),
-		cache.NewKeyValueCache(),
-		cache.NewKeyValueCache(),
-	)
-
-	testCase := func(uri string, status int) {
-		t.Run(uri, func(t *testing.T) {
-			req := httptest.NewRequest("GET", uri, http.NoBody)
-			w := httptest.NewRecorder()
-
-			log.Printf("Start: %v\n", time.Now())
-			start := time.Now()
-			testHandler(w, req)
-			end := time.Now()
-			log.Printf("Done: %v\n", time.Now())
-
-			resp := w.Result()
-
-			if resp.StatusCode != status {
-				t.Errorf("request failed with status code %d", resp.StatusCode)
-			} else {
-				t.Logf("request took %d milliseconds", end.Sub(start).Milliseconds())
-			}
-		})
-	}
-
-	testCase("https://mondstern.codeberg.page/", 404) // TODO: expect 200
-	testCase("https://codeberg.page/", 404)           // TODO: expect 200
-	testCase("https://example.momar.xyz/", 424)
-}