diff options
author | Jaime Martinez <jmartinez@gitlab.com> | 2021-12-14 06:49:17 +0300 |
---|---|---|
committer | Jaime Martinez <jmartinez@gitlab.com> | 2021-12-14 06:49:17 +0300 |
commit | 0c6aa86b4e87146ee122ff9e02c1e010b769ce30 (patch) | |
tree | d59be4c096ef833e1875543732642101e0c4a904 /test/acceptance | |
parent | 753ed6a16616776b9956ba253959d8fdd604340e (diff) | |
parent | e3f274f1b8eb69fcc57a89b89197560903fe1144 (diff) |
Merge branch 'fix/sha-lookups' into 'master'
test: add sha256 to mocked lookups and fix tests
See merge request gitlab-org/gitlab-pages!634
Diffstat (limited to 'test/acceptance')
-rw-r--r-- | test/acceptance/testdata/api_responses.go | 19 |
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, }, }, }, |