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

@ -11,7 +11,6 @@ import (
"net"
"net/http"
"os"
"path"
"testing"
"github.com/osbuild/osbuild-composer/internal/distro/fedoratest"
@ -37,12 +36,6 @@ func executeTests(m *testing.M) int {
panic(err)
}
artifactsDir := path.Join(tmpdir, "artifacts")
err = os.Mkdir(artifactsDir, 0755)
if err != nil {
panic(err)
}
// Create a mock API server listening on the temporary socket
fixture := rpmmd_mock.BaseFixture()
rpm := rpmmd_mock.NewRPMMDMock(fixture)
@ -53,7 +46,7 @@ func executeTests(m *testing.M) int {
}
repos := []rpmmd.RepoConfig{{Id: "test-system-repo", BaseURL: "http://example.com/test/os/test_arch"}}
logger := log.New(os.Stdout, "", 0)
api := weldr.New(rpm, arch, distro, repos, logger, fixture.Store, fixture.Workers, artifactsDir, "")
api := weldr.New(rpm, arch, distro, repos, logger, fixture.Store, fixture.Workers, "")
server := http.Server{Handler: api}
defer server.Close()