diff options
-rw-r--r-- | internal/serving/objectstorage/cache.go | 2 | ||||
-rw-r--r-- | internal/serving/objectstorage/objectstorage.go | 6 | ||||
-rw-r--r-- | internal/source/domains_test.go | 4 | ||||
-rw-r--r-- | internal/source/gitlab/client/client.go | 4 | ||||
-rw-r--r-- | internal/zip/open_archive_test.go | 4 | ||||
-rw-r--r-- | internal/zip/reader/reader_test.go | 1 |
6 files changed, 7 insertions, 14 deletions
diff --git a/internal/serving/objectstorage/cache.go b/internal/serving/objectstorage/cache.go index bb86795c..16b807ed 100644 --- a/internal/serving/objectstorage/cache.go +++ b/internal/serving/objectstorage/cache.go @@ -14,8 +14,6 @@ var ( errNotExists = errors.New("domain does not exist") ) -type archive struct { -} type inMemory struct { mu *sync.Mutex reader *reader.Reader diff --git a/internal/serving/objectstorage/objectstorage.go b/internal/serving/objectstorage/objectstorage.go index 980d96ab..801fd997 100644 --- a/internal/serving/objectstorage/objectstorage.go +++ b/internal/serving/objectstorage/objectstorage.go @@ -45,7 +45,6 @@ func (os *ObjectStorage) ServeFileHTTP(handler serving.Handler) bool { zipReader, err := os.getOrSetReader(handler) if err != nil { logrus.WithError(err).Error("failed so serve from zip file") - // os.ServeNotFoundHTTP(handler) return false } @@ -93,8 +92,9 @@ func (os *ObjectStorage) getOrSetReader(handler serving.Handler) (*reader.Reader if err != nil { // let the context be canceled on the timeout so that the zipReader stays open for a while // this context is used by the os.cache and zipartifacts.OpenArchive - // TODO configure this timeout - ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) + // Setting to the same value as the internal/source/gitlab/cache entryRefreshTimeout: 60 * time.Second, + // TODO make it configurable + ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) zipReader, err = zip.OpenArchive(ctx, handler.LookupPath.Path) if err != nil { diff --git a/internal/source/domains_test.go b/internal/source/domains_test.go index 8a510f13..24008b08 100644 --- a/internal/source/domains_test.go +++ b/internal/source/domains_test.go @@ -54,7 +54,7 @@ func TestDomainSources(t *testing.T) { }) } -func XTestGetDomain(t *testing.T) { +func TestGetDomain(t *testing.T) { gitlabSourceConfig.Domains.Enabled = []string{"new-source-test.gitlab.io"} gitlabSourceConfig.Domains.Broken = "pages-broken-poc.gitlab.io" @@ -147,7 +147,7 @@ func TestIsServerlessDomain(t *testing.T) { }) } -func XTestGetDomainWithIncrementalrolloutOfGitLabSource(t *testing.T) { +func TestGetDomainWithIncrementalrolloutOfGitLabSource(t *testing.T) { // This will produce the following pseudo-random sequence: 5, 87, 68 rand.Seed(42) diff --git a/internal/source/gitlab/client/client.go b/internal/source/gitlab/client/client.go index fa5f5b2f..a88c742a 100644 --- a/internal/source/gitlab/client/client.go +++ b/internal/source/gitlab/client/client.go @@ -70,13 +70,9 @@ func (gc *Client) Resolve(ctx context.Context, host string) *api.Lookup { return &lookup } -var an = map[string]int{} - // GetLookup returns a VirtualDomain configuration wrapped into a Lookup for a // given host func (gc *Client) GetLookup(ctx context.Context, host string) api.Lookup { - an[host]++ - fmt.Printf("request to the API for %q - %d\n", host, an[host]) if host == "objectstorage.pages.test" { return api.Lookup{ Name: host, diff --git a/internal/zip/open_archive_test.go b/internal/zip/open_archive_test.go index c49da3cd..26cc40f6 100644 --- a/internal/zip/open_archive_test.go +++ b/internal/zip/open_archive_test.go @@ -23,7 +23,7 @@ func TestOpenHTTPArchive(t *testing.T) { zr, err := OpenArchive(context.Background(), srv.URL+"/"+zipFile) require.NoError(t, err, "call OpenArchive") - require.Len(t, zr.Archive().File, 2) + require.Len(t, zr.Archive().File, 3) zf := zr.Archive().File[1] require.Equal(t, entryName, zf.Name, "zip entry name") @@ -45,7 +45,7 @@ func TestOpenFileArchive(t *testing.T) { ) zr, err := OpenArchive(context.Background(), testRoot) require.NoError(t, err, "call OpenArchive") - require.Len(t, zr.Archive().File, 2) + require.Len(t, zr.Archive().File, 3) zf := zr.Archive().File[1] require.Equal(t, entryName, zf.Name, "zip entry name") diff --git a/internal/zip/reader/reader_test.go b/internal/zip/reader/reader_test.go index 0910c7d4..7d49cd71 100644 --- a/internal/zip/reader/reader_test.go +++ b/internal/zip/reader/reader_test.go @@ -28,5 +28,4 @@ func TestNewReader(t *testing.T) { _, _, err = reader.Open("unknown.html") require.EqualError(t, err, "\"public/unknown.html\": not found") - } |