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>2021-08-17 06:58:49 +0300
committerJaime Martinez <jmartinez@gitlab.com>2021-08-17 07:01:14 +0300
commit685af284110f55590c0288815bae80cc77cad247 (patch)
tree4e3997fc8002c9dc40b7a17dea17989276b72986 /test/acceptance/zip_test.go
parent84d1dde7f22aad875f75c2df768f6f2984a3ef4b (diff)
test: rename and cleanup some functions571-refactor-missing-serving-tests
Diffstat (limited to 'test/acceptance/zip_test.go')
-rw-r--r--test/acceptance/zip_test.go54
1 files changed, 10 insertions, 44 deletions
diff --git a/test/acceptance/zip_test.go b/test/acceptance/zip_test.go
index 09e69051..3bdd1c49 100644
--- a/test/acceptance/zip_test.go
+++ b/test/acceptance/zip_test.go
@@ -5,26 +5,18 @@ import (
"net"
"net/http"
"net/http/httptest"
- "os"
"testing"
"github.com/stretchr/testify/require"
-
- "gitlab.com/gitlab-org/gitlab-pages/internal/testhelpers"
)
func TestZipServing(t *testing.T) {
_, cleanup := newZipFileServerURL(t, "../../shared/pages/group/zip.gitlab.io/public.zip")
defer cleanup()
- source := NewGitlabDomainsSourceStub(t, &stubOpts{})
- defer source.Close()
-
- gitLabAPISecretKey := CreateGitLabAPISecretKeyFixtureFile(t)
-
- pagesArgs := []string{"-gitlab-server", source.URL, "-api-secret-key", gitLabAPISecretKey, "-domain-config-source", "gitlab"}
- teardown := RunPagesProcessWithEnvs(t, true, *pagesBinary, supportedListeners(), "", []string{}, pagesArgs...)
- defer teardown()
+ RunPagesProcess(t,
+ withListeners([]ListenSpec{httpListener}),
+ )
tests := map[string]struct {
host string
@@ -105,26 +97,9 @@ func TestZipServing(t *testing.T) {
}
func TestZipServingFromDisk(t *testing.T) {
- chdir := false
- defer testhelpers.ChdirInPath(t, "../../shared/pages", &chdir)()
-
- _, cleanup := newZipFileServerURL(t, "shared/pages/group/zip.gitlab.io/public.zip")
- defer cleanup()
-
- wd, err := os.Getwd()
- require.NoError(t, err)
-
- source := NewGitlabDomainsSourceStub(t, &stubOpts{
- pagesRoot: wd,
- })
-
- defer source.Close()
-
- gitLabAPISecretKey := CreateGitLabAPISecretKeyFixtureFile(t)
-
- pagesArgs := []string{"-gitlab-server", source.URL, "-api-secret-key", gitLabAPISecretKey, "-domain-config-source", "gitlab", "-pages-root", wd}
- teardown := RunPagesProcessWithEnvs(t, true, *pagesBinary, supportedListeners(), "", []string{}, pagesArgs...)
- defer teardown()
+ RunPagesProcess(t,
+ withListeners([]ListenSpec{httpListener}),
+ )
tests := map[string]struct {
host string
@@ -205,19 +180,10 @@ func TestZipServingFromDisk(t *testing.T) {
}
func TestZipServingConfigShortTimeout(t *testing.T) {
- source := NewGitlabDomainsSourceStub(t, &stubOpts{})
- defer source.Close()
-
- gitLabAPISecretKey := CreateGitLabAPISecretKeyFixtureFile(t)
-
- pagesArgs := []string{"-gitlab-server", source.URL, "-api-secret-key", gitLabAPISecretKey, "-domain-config-source", "gitlab",
- "-zip-open-timeout=1ns"} // <- test purpose
-
- teardown := RunPagesProcessWithEnvs(t, true, *pagesBinary, supportedListeners(), "", []string{}, pagesArgs...)
- defer teardown()
-
- _, cleanup := newZipFileServerURL(t, "../../shared/pages/group/zip.gitlab.io/public.zip")
- defer cleanup()
+ RunPagesProcess(t,
+ withListeners([]ListenSpec{httpListener}),
+ withExtraArgument("zip-open-timeout", "1ns"),
+ )
response, err := GetPageFromListener(t, httpListener, "zip.gitlab.io", "/")
require.NoError(t, err)