debian-forge-composer/cmd/osbuild-dnf-json-tests/main_test.go
Martin Sehnoutka 9d2dacbcab internal: pass architecture from the APIs to dnf-json
The following commit will introduce support for forced architecture in
dnf-json. The APIs already have this kind of information, so we can
simply pass it to the Depsolve and FetchMetadata functions.
2020-03-24 20:45:30 +01:00

34 lines
982 B
Go

// This package contains tests related to dnf-json and rpmmd package.
// +build integration
package main
import (
"fmt"
"github.com/stretchr/testify/assert"
"path"
"testing"
"github.com/osbuild/osbuild-composer/internal/rpmmd"
"github.com/osbuild/osbuild-composer/internal/test"
)
func TestFetchChecksum(t *testing.T) {
dir, err := test.SetUpTemporaryRepository()
defer func(dir string) {
err := test.TearDownTemporaryRepository(dir)
assert.Nil(t, err, "Failed to clean up temporary repository.")
}(dir)
assert.Nilf(t, err, "Failed to set up temporary repository: %v", err)
repoCfg := rpmmd.RepoConfig{
Id: "repo",
BaseURL: fmt.Sprintf("file://%s", dir),
IgnoreSSL: true,
}
rpmMetadata := rpmmd.NewRPMMD(path.Join(dir, "rpmmd"))
_, c, err := rpmMetadata.FetchMetadata([]rpmmd.RepoConfig{repoCfg}, "platform:f31", "x86_64")
assert.Nilf(t, err, "Failed to fetch checksum: %v", err)
assert.NotEqual(t, "", c["repo"], "The checksum is empty")
}