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
parent118b921983e1f9309eca42e50375e993dcd4e98c (diff)
test: remove leftover tests requiring source disk
-rw-r--r--app_test.go57
-rw-r--r--test/acceptance/config_test.go27
-rw-r--r--test/acceptance/serving_test.go36
3 files changed, 0 insertions, 120 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())
- })
- }
-}
diff --git a/test/acceptance/config_test.go b/test/acceptance/config_test.go
index 82b7fbb1..07697c48 100644
--- a/test/acceptance/config_test.go
+++ b/test/acceptance/config_test.go
@@ -5,7 +5,6 @@ import (
"net"
"net/http"
"testing"
- "time"
"github.com/stretchr/testify/require"
)
@@ -65,29 +64,3 @@ func TestMultipleListenersFromEnvironmentVariables(t *testing.T) {
require.Equal(t, http.StatusOK, rsp.StatusCode)
}
}
-
-// TODO: remove along chroot https://gitlab.com/gitlab-org/gitlab-pages/-/issues/561
-func TestEnableJailFromEnvironment(t *testing.T) {
- out, teardown := runPagesProcess(t,
- true,
- *pagesBinary,
- []ListenSpec{httpListener},
- "",
- []string{
- "DAEMON_ENABLE_JAIL=true",
- },
- "-domain-config-source", "disk",
- )
- t.Cleanup(teardown)
-
- require.Eventually(t, func() bool {
- require.Contains(t, out.String(), "\"daemon-enable-jail\":true")
- return true
- }, time.Second, 10*time.Millisecond)
-
- rsp, err := GetPageFromListener(t, httpListener, "group.gitlab-example.com", "project/")
-
- require.NoError(t, err)
- rsp.Body.Close()
- require.Equal(t, http.StatusOK, rsp.StatusCode)
-}
diff --git a/test/acceptance/serving_test.go b/test/acceptance/serving_test.go
index 238a05dd..b1682f9b 100644
--- a/test/acceptance/serving_test.go
+++ b/test/acceptance/serving_test.go
@@ -375,42 +375,6 @@ func TestDomainsSource(t *testing.T) {
apiCalled: true,
},
},
- {
- name: "disk_source_domain_exists",
- args: args{
- configSource: "disk",
- // test.domain.com sourced from disk configuration
- domain: "test.domain.com",
- urlSuffix: "/",
- },
- want: want{
- statusCode: http.StatusOK,
- content: "main-dir\n",
- apiCalled: false,
- },
- },
- {
- name: "disk_source_domain_does_not_exist",
- args: args{
- configSource: "disk",
- domain: "non-existent-domain.gitlab.io",
- },
- want: want{
- statusCode: http.StatusNotFound,
- apiCalled: false,
- },
- },
- {
- name: "disk_source_domain_should_not_exist_under_hashed_dir",
- args: args{
- configSource: "disk",
- domain: "hashed.com",
- },
- want: want{
- statusCode: http.StatusNotFound,
- apiCalled: false,
- },
- },
}
for _, tt := range tests {