From c5d951112a990d06771406a0aaf0a1c2a6845008 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 14 Dec 2023 13:36:38 +0100 Subject: [PATCH] dnfjson: skip TestDepsolver() if no osbuild-depsolve-dnf is installed Do not fail if `osbuild-depsolve-dnf` is missing. --- pkg/dnfjson/dnfjson.go | 2 +- pkg/dnfjson/dnfjson_test.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/dnfjson/dnfjson.go b/pkg/dnfjson/dnfjson.go index 365f5abc4b..887f3a0a11 100644 --- a/pkg/dnfjson/dnfjson.go +++ b/pkg/dnfjson/dnfjson.go @@ -57,7 +57,7 @@ func findDepsolveDnf() string { // if it's not found, return empty string; the run() function will fail if // it's used before setting. - return locations[0] + return "" } // Create a new unconfigured BaseSolver (without platform information). It can diff --git a/pkg/dnfjson/dnfjson_test.go b/pkg/dnfjson/dnfjson_test.go index c2e8da7874..921426b14b 100644 --- a/pkg/dnfjson/dnfjson_test.go +++ b/pkg/dnfjson/dnfjson_test.go @@ -33,6 +33,10 @@ func TestDepsolver(t *testing.T) { if !dnfInstalled() { t.Skip() } + + if findDepsolveDnf() == "" { + t.Skip("Test needs an installed osbuild-depsolve-dnf") + } } s := rpmrepo.NewTestServer() @@ -558,6 +562,10 @@ func TestErrorRepoInfo(t *testing.T) { if !dnfInstalled() { t.Skip() } + + if findDepsolveDnf() == "" { + t.Skip("Test needs an installed osbuild-depsolve-dnf") + } } assert := assert.New(t)