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:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2019-12-04 16:04:54 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2019-12-04 16:04:54 +0300
commit6b76b603ec5296666ec48d2e736cc66648f29504 (patch)
tree3c2cb02406644a0b233ec90fe95aaaab4b93847a
parent8296ddf86fcc88f4b114ac8609cd9350e025e263 (diff)
Check presence of GitLab API secret when building a domains source
-rw-r--r--acceptance_test.go3
-rw-r--r--internal/source/domains.go2
-rw-r--r--internal/source/domains_test.go2
3 files changed, 4 insertions, 3 deletions
diff --git a/acceptance_test.go b/acceptance_test.go
index 6f2e5fb4..dfa334b9 100644
--- a/acceptance_test.go
+++ b/acceptance_test.go
@@ -1536,7 +1536,8 @@ func TestGitlabDomainsSource(t *testing.T) {
defer source.Close()
newSourceDomains := "GITLAB_NEW_SOURCE_DOMAINS=new-source-test.gitlab.io,other-test.gitlab.io"
- teardown := RunPagesProcessWithEnvs(t, true, *pagesBinary, listeners, "", []string{newSourceDomains}, "-gitlab-server", source.URL)
+ pagesArgs := []string{"-gitlab-server", source.URL, "-api-secret-key", "README.md"}
+ teardown := RunPagesProcessWithEnvs(t, true, *pagesBinary, listeners, "", []string{newSourceDomains}, pagesArgs...)
defer teardown()
response, err := GetPageFromListener(t, httpListener, "new-source-test.gitlab.io", "/my/pages/project/")
diff --git a/internal/source/domains.go b/internal/source/domains.go
index ed1c3de8..85d06152 100644
--- a/internal/source/domains.go
+++ b/internal/source/domains.go
@@ -37,7 +37,7 @@ type Domains struct {
// not initialize `dm` as we later check the readiness by comparing it with a
// nil value.
func NewDomains(config Config) (*Domains, error) {
- if len(config.GitlabServerURL()) == 0 {
+ if len(config.GitlabServerURL()) == 0 || len(config.GitlabAPISecret()) == 0 {
return &Domains{disk: disk.New()}, nil
}
diff --git a/internal/source/domains_test.go b/internal/source/domains_test.go
index 9d3b0dd5..378f8c89 100644
--- a/internal/source/domains_test.go
+++ b/internal/source/domains_test.go
@@ -24,7 +24,7 @@ func (c sourceConfig) GitlabAPISecret() []byte {
func TestDomainSources(t *testing.T) {
t.Run("when GitLab API URL has been provided", func(t *testing.T) {
- domains, err := NewDomains(sourceConfig{api: "https://gitlab.com"})
+ domains, err := NewDomains(sourceConfig{api: "https://gitlab.com", secret: "abc"})
require.NoError(t, err)
require.NotNil(t, domains.gitlab)