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-09-08 05:03:00 +0300
committerJaime Martinez <jmartinez@gitlab.com>2021-09-08 05:03:00 +0300
commit85c4291724f713a37a047e9baacb9cd2187d9de2 (patch)
tree4b593b0f2cbf7d050fc6a5ce57031a3270addd9c
parent143b35c98e6ab088b6bb1f97978b2fc1dd776eb1 (diff)
parent85d3a3bb65106af50ba41cee919f89d715de2c87 (diff)
Merge branch 'perf/test-artifact' into 'master'
test: improve artifact acceptance test See merge request gitlab-org/gitlab-pages!562
-rw-r--r--test/acceptance/artifacts_test.go109
1 files changed, 50 insertions, 59 deletions
diff --git a/test/acceptance/artifacts_test.go b/test/acceptance/artifacts_test.go
index 2b1976a8..01bb1f5c 100644
--- a/test/acceptance/artifacts_test.go
+++ b/test/acceptance/artifacts_test.go
@@ -59,7 +59,6 @@ func TestArtifactProxyRequest(t *testing.T) {
host string
path string
status int
- binaryOption string
content string
length int64
cacheControl string
@@ -70,7 +69,6 @@ func TestArtifactProxyRequest(t *testing.T) {
host: "group.gitlab-example.com",
path: "/-/project/-/jobs/1/artifacts/200.html",
status: http.StatusOK,
- binaryOption: "",
content: content,
length: contentLength,
cacheControl: "max-age=3600",
@@ -81,7 +79,6 @@ func TestArtifactProxyRequest(t *testing.T) {
host: "group.gitlab-example.com",
path: "/-/subgroup/project/-/jobs/1/artifacts/200.html",
status: http.StatusOK,
- binaryOption: "",
content: content,
length: contentLength,
cacheControl: "max-age=3600",
@@ -92,7 +89,6 @@ func TestArtifactProxyRequest(t *testing.T) {
host: "group.gitlab-example.com",
path: "/-/project/-/jobs/1/artifacts/delayed_200.html",
status: http.StatusBadGateway,
- binaryOption: "-artifacts-server-timeout=1",
content: "",
length: 0,
cacheControl: "",
@@ -103,7 +99,6 @@ func TestArtifactProxyRequest(t *testing.T) {
host: "group.gitlab-example.com",
path: "/-/project/-/jobs/1/artifacts/404.html",
status: http.StatusNotFound,
- binaryOption: "",
content: "",
length: 0,
cacheControl: "",
@@ -114,7 +109,6 @@ func TestArtifactProxyRequest(t *testing.T) {
host: "group.gitlab-example.com",
path: "/-/project/-/jobs/1/artifacts/500.html",
status: http.StatusInternalServerError,
- binaryOption: "",
content: "",
length: 0,
cacheControl: "",
@@ -127,18 +121,18 @@ func TestArtifactProxyRequest(t *testing.T) {
artifactServerURL := testServer.URL + "/api/v4"
t.Log("Artifact server URL", artifactServerURL)
+ args := []string{"-artifacts-server=" + artifactServerURL, "-artifacts-server-timeout=1"}
+
+ RunPagesProcess(t,
+ withListeners([]ListenSpec{httpListener}),
+ withArguments(args),
+ withEnv([]string{"SSL_CERT_FILE=" + certFile}),
+ )
+
for _, tt := range tests {
+ tt := tt
t.Run(tt.name, func(t *testing.T) {
- args := []string{"-artifacts-server=" + artifactServerURL}
- if tt.binaryOption != "" {
- args = append(args, tt.binaryOption)
- }
-
- RunPagesProcess(t,
- withListeners([]ListenSpec{httpListener}),
- withArguments(args),
- withEnv([]string{"SSL_CERT_FILE=" + certFile}),
- )
+ t.Parallel()
resp, err := GetPageFromListener(t, httpListener, tt.host, tt.path)
require.NoError(t, err)
@@ -177,46 +171,40 @@ func TestPrivateArtifactProxyRequest(t *testing.T) {
})
tests := []struct {
- name string
- host string
- path string
- status int
- binaryOption string
+ name string
+ host string
+ path string
+ status int
}{
{
- name: "basic proxied request for private project",
- host: "group.gitlab-example.com",
- path: "/-/private/-/jobs/1/artifacts/200.html",
- status: http.StatusOK,
- binaryOption: "",
+ name: "basic proxied request for private project",
+ host: "group.gitlab-example.com",
+ path: "/-/private/-/jobs/1/artifacts/200.html",
+ status: http.StatusOK,
},
{
- name: "basic proxied request for subgroup",
- host: "group.gitlab-example.com",
- path: "/-/subgroup/private/-/jobs/1/artifacts/200.html",
- status: http.StatusOK,
- binaryOption: "",
+ name: "basic proxied request for subgroup",
+ host: "group.gitlab-example.com",
+ path: "/-/subgroup/private/-/jobs/1/artifacts/200.html",
+ status: http.StatusOK,
},
{
- name: "502 error while attempting to proxy",
- host: "group.gitlab-example.com",
- path: "/-/private/-/jobs/1/artifacts/delayed_200.html",
- status: http.StatusBadGateway,
- binaryOption: "artifacts-server-timeout=1",
+ name: "502 error while attempting to proxy",
+ host: "group.gitlab-example.com",
+ path: "/-/private/-/jobs/1/artifacts/delayed_200.html",
+ status: http.StatusBadGateway,
},
{
- name: "Proxying 404 from server",
- host: "group.gitlab-example.com",
- path: "/-/private/-/jobs/1/artifacts/404.html",
- status: http.StatusNotFound,
- binaryOption: "",
+ name: "Proxying 404 from server",
+ host: "group.gitlab-example.com",
+ path: "/-/private/-/jobs/1/artifacts/404.html",
+ status: http.StatusNotFound,
},
{
- name: "Proxying 500 from server",
- host: "group.gitlab-example.com",
- path: "/-/private/-/jobs/1/artifacts/500.html",
- status: http.StatusInternalServerError,
- binaryOption: "",
+ name: "Proxying 500 from server",
+ host: "group.gitlab-example.com",
+ path: "/-/private/-/jobs/1/artifacts/500.html",
+ status: http.StatusInternalServerError,
},
}
@@ -225,21 +213,24 @@ func TestPrivateArtifactProxyRequest(t *testing.T) {
artifactServerURL := testServer.URL + "/api/v4"
t.Log("Artifact server URL", artifactServerURL)
+ configFile := defaultConfigFileWith(t,
+ "gitlab-server="+testServer.URL,
+ "artifacts-server="+artifactServerURL,
+ "auth-redirect-uri=https://projects.gitlab-example.com/auth",
+ "artifacts-server-timeout=1")
+
+ RunPagesProcess(t,
+ withListeners([]ListenSpec{httpsListener}),
+ withArguments([]string{
+ "-config=" + configFile,
+ }),
+ withEnv([]string{"SSL_CERT_FILE=" + certFile}),
+ )
+
for _, tt := range tests {
+ tt := tt
t.Run(tt.name, func(t *testing.T) {
- configFile := defaultConfigFileWith(t,
- "gitlab-server="+testServer.URL,
- "artifacts-server="+artifactServerURL,
- "auth-redirect-uri=https://projects.gitlab-example.com/auth",
- tt.binaryOption)
-
- RunPagesProcess(t,
- withListeners([]ListenSpec{httpsListener}),
- withArguments([]string{
- "-config=" + configFile,
- }),
- withEnv([]string{"SSL_CERT_FILE=" + certFile}),
- )
+ t.Parallel()
resp, err := GetRedirectPage(t, httpsListener, tt.host, tt.path)
require.NoError(t, err)