Skip to content

Commit

Permalink
dnfjson: remove dnfInstalled() in favor of findDepsolveDnf()
Browse files Browse the repository at this point in the history
As suggested by Achilleas this commit removes the dnfInstalled()
helper as it's now redundant with the new findDepsolveDnf() check
(the osbuild-depsolve-dnf package should depend on libdnf).
  • Loading branch information
mvo5 committed Dec 19, 2023
1 parent 7ffefb9 commit 4bf2754
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions pkg/dnfjson/dnfjson_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"encoding/json"
"flag"
"fmt"
"os"
"os/exec"
"strings"
"testing"

Expand All @@ -17,23 +15,9 @@ import (

var forceDNF = flag.Bool("force-dnf", false, "force dnf testing, making them fail instead of skip if dnf isn't installed")

func dnfInstalled() bool {
cmd := exec.Command("python3", "-c", "import dnf")
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
fmt.Fprintf(os.Stderr, "failed to import dnf: %s\n", err.Error())
return false
}
return true
}

func TestDepsolver(t *testing.T) {
if !*forceDNF {
// dnf tests aren't forced: skip them if the dnf sniff check fails
if !dnfInstalled() {
t.Skip()
}

if findDepsolveDnf() == "" {
t.Skip("Test needs an installed osbuild-depsolve-dnf")
}
Expand Down Expand Up @@ -559,10 +543,6 @@ func expectedResult(repo rpmmd.RepoConfig) []rpmmd.PackageSpec {
func TestErrorRepoInfo(t *testing.T) {
if !*forceDNF {
// dnf tests aren't forced: skip them if the dnf sniff check fails
if !dnfInstalled() {
t.Skip()
}

if findDepsolveDnf() == "" {
t.Skip("Test needs an installed osbuild-depsolve-dnf")
}
Expand Down

0 comments on commit 4bf2754

Please sign in to comment.