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
.project
out
builds/
commands/helpers/archive.zip
executors/docker/bindata.go
dockerfiles/alpine/gitlab-ci-multi-runner-linux-amd64
dockerfiles/build/gitlab-runner-helper
......
......@@ -86,7 +86,7 @@ func (c *CacheArchiverCommand) Execute(*cli.Context) {
if c.URL != "" {
err := c.doRetry(c.upload)
if err != nil {
logrus.Warningln(err)
logrus.Fatalln(err)
}
}
}
......
......@@ -72,7 +72,7 @@ func TestCacheArchiverRemoteServerNotFound(t *testing.T) {
File: cacheExtractorArchive,
URL: ts.URL + "/invalid-file.zip",
}
assert.NotPanics(t, func() {
assert.Panics(t, func() {
cmd.Execute(nil)
})
}
......@@ -92,14 +92,14 @@ func TestCacheArchiverRemoteServe(t *testing.T) {
})
}
func TestCacheArchiverRemoteServerDoesntFailOnInvalidServer(t *testing.T) {
func TestCacheArchiverRemoteServerFailOnInvalidServer(t *testing.T) {
helpers.MakeFatalToPanic()
os.Remove(cacheExtractorArchive)
cmd := CacheArchiverCommand{
File: cacheExtractorArchive,
URL: "http://localhost:65333/cache.zip",
}
assert.NotPanics(t, func() {
assert.Panics(t, func() {
cmd.Execute(nil)
})
......
......@@ -79,11 +79,7 @@ func (c *CacheExtractorCommand) Execute(context *cli.Context) {
if c.URL != "" {
err := c.doRetry(c.download)
if err != nil {
if os.IsNotExist(err) {
logrus.Fatalln(err)
} else {
logrus.Warningln(err)
}
logrus.Fatalln(err)
}
}
......
......@@ -133,14 +133,14 @@ func TestCacheExtractorRemoteServer(t *testing.T) {
}, "archive is up to date")
}
func TestCacheExtractorRemoteServerDoesntFailOnInvalidServer(t *testing.T) {
func TestCacheExtractorRemoteServerFailOnInvalidServer(t *testing.T) {
helpers.MakeFatalToPanic()
os.Remove(cacheExtractorArchive)
cmd := CacheExtractorCommand{
File: cacheExtractorArchive,
URL: "http://localhost:65333/cache.zip",
}
assert.NotPanics(t, func() {
assert.Panics(t, func() {
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