Drop common.CurrentArch() in favor of osbuild/images

Drop `common.CurrentArch()` implementation and use
`arch.Current().String()` from the osbuild/images instead.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2024-01-19 21:05:46 +01:00 committed by Achilleas Koutsou
parent c4e5ab5aca
commit 43e87632fb
11 changed files with 20 additions and 73 deletions

View file

@ -17,6 +17,7 @@ import (
"github.com/google/uuid"
"github.com/sirupsen/logrus"
"github.com/osbuild/images/pkg/arch"
"github.com/osbuild/osbuild-composer/internal/common"
"github.com/osbuild/osbuild-composer/internal/worker/api"
)
@ -172,7 +173,7 @@ func (c *Client) registerWorker() error {
var buf bytes.Buffer
err = json.NewEncoder(&buf).Encode(api.PostWorkersRequest{
Arch: common.CurrentArch(),
Arch: arch.Current().String(),
})
if err != nil {
logrus.Errorf("Unable create worker request: %v", err)

View file

@ -22,7 +22,6 @@ import (
"github.com/osbuild/images/pkg/manifest"
"github.com/osbuild/images/pkg/osbuild"
"github.com/osbuild/images/pkg/rpmmd"
"github.com/osbuild/osbuild-composer/internal/common"
"github.com/osbuild/osbuild-composer/internal/jobqueue/fsjobqueue"
"github.com/osbuild/osbuild-composer/internal/target"
"github.com/osbuild/osbuild-composer/internal/test"
@ -1626,7 +1625,7 @@ func TestWorkerWatch(t *testing.T) {
server := newTestServer(t, t.TempDir(), config, false)
reply := test.TestRouteWithReply(t, server.Handler(), false, "POST", "/api/worker/v1/workers", fmt.Sprintf(`{"arch":"%s"}`, common.CurrentArch()), 201, `{"href":"/api/worker/v1/workers","kind":"WorkerID","id": "15"}`, "id", "worker_id")
reply := test.TestRouteWithReply(t, server.Handler(), false, "POST", "/api/worker/v1/workers", fmt.Sprintf(`{"arch":"%s"}`, arch.Current().String()), 201, `{"href":"/api/worker/v1/workers","kind":"WorkerID","id": "15"}`, "id", "worker_id")
var resp api.PostWorkersResponse
require.NoError(t, json.Unmarshal(reply, &resp))
workerID, err := uuid.Parse(resp.WorkerId)
@ -1641,7 +1640,7 @@ func TestWorkerWatch(t *testing.T) {
func TestRequestJobForWorker(t *testing.T) {
server := newTestServer(t, t.TempDir(), defaultConfig, false)
reply := test.TestRouteWithReply(t, server.Handler(), false, "POST", "/api/worker/v1/workers", fmt.Sprintf(`{"arch":"%s"}`, common.CurrentArch()), 201, `{"href":"/api/worker/v1/workers","kind":"WorkerID","id": "15"}`, "id", "worker_id")
reply := test.TestRouteWithReply(t, server.Handler(), false, "POST", "/api/worker/v1/workers", fmt.Sprintf(`{"arch":"%s"}`, arch.Current().String()), 201, `{"href":"/api/worker/v1/workers","kind":"WorkerID","id": "15"}`, "id", "worker_id")
var resp api.PostWorkersResponse
require.NoError(t, json.Unmarshal(reply, &resp))
workerID, err := uuid.Parse(resp.WorkerId)