worker: add JobArtifact() and DeleteJobArtifacts()

This allows removing the `artifactsDir` from `weldr.API`. It makes more
sense to deal with that directory in one place only.
This commit is contained in:
Lars Karlitski 2020-05-26 20:40:14 +02:00 committed by Ondřej Budai
parent b452a31eed
commit e06076ed8c
5 changed files with 69 additions and 39 deletions

View file

@ -4,7 +4,6 @@ import (
"archive/tar"
"bytes"
"io"
"io/ioutil"
"math/rand"
"net/http"
"net/http/httptest"
@ -38,13 +37,7 @@ func createWeldrAPI(fixtureGenerator rpmmd_mock.FixtureGenerator) (*API, *store.
panic(err)
}
artifactsDir, err := ioutil.TempDir("", "client_test-")
if err != nil {
panic(err)
}
defer os.RemoveAll(artifactsDir)
return New(rpm, arch, d, repos, nil, fixture.Store, fixture.Workers, artifactsDir, ""), fixture.Store
return New(rpm, arch, d, repos, nil, fixture.Store, fixture.Workers, ""), fixture.Store
}
func TestBasic(t *testing.T) {