Commit c486b4e7 authored by Tomasz Maczukin's avatar Tomasz Maczukin

Fail cache operations on errors

parent a3e05df8
Pipeline #7711924 passed with stages
in 22 minutes and 55 seconds
...@@ -3,6 +3,7 @@ config.toml ...@@ -3,6 +3,7 @@ config.toml
.project .project
out out
builds/ builds/
commands/helpers/archive.zip
executors/docker/bindata.go executors/docker/bindata.go
dockerfiles/alpine/gitlab-ci-multi-runner-linux-amd64 dockerfiles/alpine/gitlab-ci-multi-runner-linux-amd64
dockerfiles/build/gitlab-runner-helper dockerfiles/build/gitlab-runner-helper
......
...@@ -86,7 +86,7 @@ func (c *CacheArchiverCommand) Execute(*cli.Context) { ...@@ -86,7 +86,7 @@ func (c *CacheArchiverCommand) Execute(*cli.Context) {
if c.URL != "" { if c.URL != "" {
err := c.doRetry(c.upload) err := c.doRetry(c.upload)
if err != nil { if err != nil {
logrus.Warningln(err) logrus.Fatalln(err)
} }
} }
} }
......
...@@ -72,7 +72,7 @@ func TestCacheArchiverRemoteServerNotFound(t *testing.T) { ...@@ -72,7 +72,7 @@ func TestCacheArchiverRemoteServerNotFound(t *testing.T) {
File: cacheExtractorArchive, File: cacheExtractorArchive,
URL: ts.URL + "/invalid-file.zip", URL: ts.URL + "/invalid-file.zip",
} }
assert.NotPanics(t, func() { assert.Panics(t, func() {
cmd.Execute(nil) cmd.Execute(nil)
}) })
} }
...@@ -92,14 +92,14 @@ func TestCacheArchiverRemoteServe(t *testing.T) { ...@@ -92,14 +92,14 @@ func TestCacheArchiverRemoteServe(t *testing.T) {
}) })
} }
func TestCacheArchiverRemoteServerDoesntFailOnInvalidServer(t *testing.T) { func TestCacheArchiverRemoteServerFailOnInvalidServer(t *testing.T) {
helpers.MakeFatalToPanic() helpers.MakeFatalToPanic()
os.Remove(cacheExtractorArchive) os.Remove(cacheExtractorArchive)
cmd := CacheArchiverCommand{ cmd := CacheArchiverCommand{
File: cacheExtractorArchive, File: cacheExtractorArchive,
URL: "http://localhost:65333/cache.zip", URL: "http://localhost:65333/cache.zip",
} }
assert.NotPanics(t, func() { assert.Panics(t, func() {
cmd.Execute(nil) cmd.Execute(nil)
}) })
......
...@@ -79,11 +79,7 @@ func (c *CacheExtractorCommand) Execute(context *cli.Context) { ...@@ -79,11 +79,7 @@ func (c *CacheExtractorCommand) Execute(context *cli.Context) {
if c.URL != "" { if c.URL != "" {
err := c.doRetry(c.download) err := c.doRetry(c.download)
if err != nil { if err != nil {
if os.IsNotExist(err) { logrus.Fatalln(err)
logrus.Fatalln(err)
} else {
logrus.Warningln(err)
}
} }
} }
......
...@@ -133,14 +133,14 @@ func TestCacheExtractorRemoteServer(t *testing.T) { ...@@ -133,14 +133,14 @@ func TestCacheExtractorRemoteServer(t *testing.T) {
}, "archive is up to date") }, "archive is up to date")
} }
func TestCacheExtractorRemoteServerDoesntFailOnInvalidServer(t *testing.T) { func TestCacheExtractorRemoteServerFailOnInvalidServer(t *testing.T) {
helpers.MakeFatalToPanic() helpers.MakeFatalToPanic()
os.Remove(cacheExtractorArchive) os.Remove(cacheExtractorArchive)
cmd := CacheExtractorCommand{ cmd := CacheExtractorCommand{
File: cacheExtractorArchive, File: cacheExtractorArchive,
URL: "http://localhost:65333/cache.zip", URL: "http://localhost:65333/cache.zip",
} }
assert.NotPanics(t, func() { assert.Panics(t, func() {
cmd.Execute(nil) cmd.Execute(nil)
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment