Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfeistel <6742251-feistel@users.noreply.gitlab.com>2021-08-19 08:48:26 +0300
committerfeistel <6742251-feistel@users.noreply.gitlab.com>2021-08-20 04:39:10 +0300
commit26f3b1e4426d25e43f4f044c49bb53286430c784 (patch)
tree154211e2226f8c9cc9d11db1906b082283999d81 /app_test.go
parent118b921983e1f9309eca42e50375e993dcd4e98c (diff)
test: remove leftover tests requiring source disk
Diffstat (limited to 'app_test.go')
-rw-r--r--app_test.go57
1 files changed, 0 insertions, 57 deletions
diff --git a/app_test.go b/app_test.go
index a141663e..d78d6737 100644
--- a/app_test.go
+++ b/app_test.go
@@ -3,16 +3,12 @@ package main
import (
"crypto/tls"
"fmt"
- "io"
"net/http"
- "net/http/httptest"
"testing"
"github.com/stretchr/testify/require"
- "gitlab.com/gitlab-org/gitlab-pages/internal/config"
"gitlab.com/gitlab-org/gitlab-pages/internal/request"
- "gitlab.com/gitlab-org/gitlab-pages/internal/source"
)
func Test_setRequestScheme(t *testing.T) {
@@ -62,56 +58,3 @@ func newGetRequestWithScheme(t *testing.T, scheme string, withTLS bool) *http.Re
return req
}
-
-func TestHealthCheckMiddleware(t *testing.T) {
- tests := []struct {
- name string
- path string
- status int
- body string
- }{
- {
- name: "Not a healthcheck request",
- path: "/foo/bar",
- status: http.StatusOK,
- body: "Hello from inner handler",
- },
- {
- name: "Healthcheck request",
- path: "/-/healthcheck",
- status: http.StatusServiceUnavailable,
- body: "not yet ready\n",
- },
- }
-
- cfg, err := config.LoadConfig()
- require.NoError(t, err)
- cfg.General.StatusPath = "/-/healthcheck"
-
- domains, err := source.NewDomains(&cfg.GitLab)
- require.NoError(t, err)
-
- app := theApp{
- config: cfg,
- domains: domains,
- }
-
- handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.WriteHeader(http.StatusOK)
- io.WriteString(w, "Hello from inner handler")
- })
-
- for _, tc := range tests {
- t.Run(tc.name, func(t *testing.T) {
- r := httptest.NewRequest("GET", tc.path, nil)
- rr := httptest.NewRecorder()
-
- middleware, err := app.healthCheckMiddleware(handler)
- require.NoError(t, err)
- middleware.ServeHTTP(rr, r)
-
- require.Equal(t, tc.status, rr.Code)
- require.Equal(t, tc.body, rr.Body.String())
- })
- }
-}