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
path: root/test
diff options
context:
space:
mode:
authorfeistel <6742251-feistel@users.noreply.gitlab.com>2021-12-08 03:32:14 +0300
committerfeistel <6742251-feistel@users.noreply.gitlab.com>2021-12-08 03:32:14 +0300
commit22f04dc1ae0869616a6751dc3c9c28740e09d1bb (patch)
treecc928a07e29cfeb513c2cd489c6ca28d88e71a49 /test
parent2828e3b72a0a786736c2d6bcd5f591d5034e2754 (diff)
test: add sha256 to mocked lookups and fix tests
Diffstat (limited to 'test')
-rw-r--r--test/acceptance/testdata/api_responses.go19
1 files changed, 15 insertions, 4 deletions
diff --git a/test/acceptance/testdata/api_responses.go b/test/acceptance/testdata/api_responses.go
index 10121f40..5061dcaf 100644
--- a/test/acceptance/testdata/api_responses.go
+++ b/test/acceptance/testdata/api_responses.go
@@ -1,6 +1,7 @@
package testdata
import (
+ "crypto/sha256"
"fmt"
"os"
"path/filepath"
@@ -162,6 +163,10 @@ func generateVirtualDomainFromDir(dir, rootDomain string, perPrefixConfig map[st
cfg = projectConfig{}
}
+ sourcePath := fmt.Sprintf("file://%s", wd+"/"+dir+project)
+ sum := sha256.Sum256([]byte(sourcePath))
+ sha := string(sum[:])
+
lookupPath := api.LookupPath{
ProjectID: cfg.projectID,
AccessControl: cfg.accessControl,
@@ -169,8 +174,9 @@ func generateVirtualDomainFromDir(dir, rootDomain string, perPrefixConfig map[st
// gitlab.Resolve logic expects prefix to have ending slash
Prefix: ensureEndingSlash(prefix),
Source: api.Source{
- Type: "zip",
- Path: fmt.Sprintf("file://%s", wd+"/"+dir+project),
+ Type: "zip",
+ Path: sourcePath,
+ SHA256: sha,
},
}
@@ -196,6 +202,10 @@ func customDomain(config projectConfig) responseFn {
return func(t *testing.T, wd string) api.VirtualDomain {
t.Helper()
+ sourcePath := fmt.Sprintf("file://%s/%s/public.zip", wd, config.pathOnDisk)
+ sum := sha256.Sum256([]byte(sourcePath))
+ sha := string(sum[:])
+
return api.VirtualDomain{
Certificate: "",
Key: "",
@@ -209,8 +219,9 @@ func customDomain(config projectConfig) responseFn {
// see internal/serving/disk/ for details
Prefix: "/",
Source: api.Source{
- Type: "zip",
- Path: fmt.Sprintf("file://%s/%s/public.zip", wd, config.pathOnDisk),
+ Type: "zip",
+ SHA256: sha,
+ Path: sourcePath,
},
},
},