diff options
author | Peder Bergebakken Sundt <pbsds@hotmail.com> | 2024-05-01 01:45:06 +0200 |
---|---|---|
committer | Yaya <github@uwu.is> | 2024-05-03 15:54:56 +0200 |
commit | b3741ce0ae8f1703bce69a6622d96f1416c31b4e (patch) | |
tree | 9977d7964e5d525f82fcd76347b444fc49cd3820 | |
parent | 5f7b03e13f05f858a9383577e7a6e2a17864dcae (diff) |
codeberg-pages: delete test in postPatch rather than with patch file
-rw-r--r-- | pkgs/development/tools/continuous-integration/codeberg-pages/default.nix | 5 | ||||
-rw-r--r-- | pkgs/development/tools/continuous-integration/codeberg-pages/disable_httptest.patch | 58 |
2 files changed, 4 insertions, 59 deletions
diff --git a/pkgs/development/tools/continuous-integration/codeberg-pages/default.nix b/pkgs/development/tools/continuous-integration/codeberg-pages/default.nix index c9ec0cc84ad4d..63324531f8e2f 100644 --- a/pkgs/development/tools/continuous-integration/codeberg-pages/default.nix +++ b/pkgs/development/tools/continuous-integration/codeberg-pages/default.nix @@ -14,7 +14,10 @@ buildGoModule rec { vendorHash = "sha256-vTYB3ka34VooN2Wh/Rcj+2S1qAsA2a/VtXlILn1W7oU="; - patches = [ ./disable_httptest.patch ]; + postPatch = '' + # disable httptest + rm server/handler/handler_test.go + ''; ldflags = [ "-s" "-w" ]; diff --git a/pkgs/development/tools/continuous-integration/codeberg-pages/disable_httptest.patch b/pkgs/development/tools/continuous-integration/codeberg-pages/disable_httptest.patch deleted file mode 100644 index 90c815712d388..0000000000000 --- a/pkgs/development/tools/continuous-integration/codeberg-pages/disable_httptest.patch +++ /dev/null @@ -1,58 +0,0 @@ -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) --} |