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:
authorJaime Martinez <jmartinez@gitlab.com>2020-07-28 07:40:19 +0300
committerVladimir Shushlin <v.shushlin@gmail.com>2020-08-04 11:23:51 +0300
commitee43b1ab04e8aa2e17546035ea2901096dc0b823 (patch)
treeb2a02fb2f008d52cf8817b5d4c833838985ca47b /helpers_test.go
parent7c9cc5a4f19f1f160f49f0a8f227cfa7af8be181 (diff)
Update acceptance tests without gitlabsourceconfig
Diffstat (limited to 'helpers_test.go')
-rw-r--r--helpers_test.go34
1 files changed, 9 insertions, 25 deletions
diff --git a/helpers_test.go b/helpers_test.go
index 32bea87c..a55399f4 100644
--- a/helpers_test.go
+++ b/helpers_test.go
@@ -13,7 +13,6 @@ import (
"os"
"os/exec"
"path"
- "path/filepath"
"strings"
"testing"
"time"
@@ -88,27 +87,6 @@ func CreateGitLabAPISecretKeyFixtureFile(t *testing.T) (filepath string) {
return secretfile.Name()
}
-func CreateGitlabSourceConfigFixtureFile(t *testing.T, domains string) (filename string, cleanup func()) {
- configfile, err := ioutil.TempFile("shared/pages", "gitlab-source-config-*")
- require.NoError(t, err)
- configfile.Close()
-
- cleanup = func() {
- os.RemoveAll(configfile.Name())
- }
-
- require.NoError(t, ioutil.WriteFile(configfile.Name(), []byte(domains), 0644))
-
- filename, err = filepath.Abs(configfile.Name())
- require.NoError(t, err)
-
- if os.Getenv("TEST_DAEMONIZE") != "" {
- filename = filepath.Base(filename)
- }
-
- return filename, cleanup
-}
-
// ListenSpec is used to point at a gitlab-pages http server, preserving the
// type of port it is (http, https, proxy)
type ListenSpec struct {
@@ -443,7 +421,12 @@ func waitForRoundtrips(t *testing.T, listeners []ListenSpec, timeout time.Durati
}
func NewGitlabDomainsSourceStub(t *testing.T) *httptest.Server {
- handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ mux := http.NewServeMux()
+ mux.HandleFunc("/api/v4/internal/pages/status", func(w http.ResponseWriter, r *http.Request) {
+ w.WriteHeader(http.StatusNoContent)
+ })
+
+ handler := func(w http.ResponseWriter, r *http.Request) {
domain := r.URL.Query().Get("host")
path := "shared/lookups/" + domain + ".json"
@@ -462,9 +445,10 @@ func NewGitlabDomainsSourceStub(t *testing.T) *httptest.Server {
require.NoError(t, err)
t.Logf("GitLab domain %s source stub served lookup", domain)
- })
+ }
+ mux.HandleFunc("/api/v4/internal/pages", handler)
- return httptest.NewServer(handler)
+ return httptest.NewServer(mux)
}
func newConfigFile(configs ...string) (string, error) {