Skip to content

Commit

Permalink
solver: include "solver" key in the dnfjson reply
Browse files Browse the repository at this point in the history
This commit includes the used sovler in the dnfjson reply. This
is mostly information (e.g. in service logs) but also useful in
tests to ensure that the expected solver was really run.

Note that this needs osbuild/images#723
first.
  • Loading branch information
mvo5 committed Aug 1, 2024
1 parent 0bbdabf commit 1ba25d6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions osbuild/solver/dnf.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ def depsolve(self, arguments):
"sslclientcert": repo.sslclientcert,
}
response = {
"solver": "dnf",
"packages": packages,
"repos": repositories,
}
Expand Down
1 change: 1 addition & 0 deletions osbuild/solver/dnf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ def depsolve(self, arguments):
"sslcacert": get_string_option(repo_cfg.get_sslcacert_option()),
}
response = {
"solver": "dnf5",
"packages": packages,
"repos": repositories,
}
Expand Down
9 changes: 9 additions & 0 deletions tools/test/test_depsolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,3 +302,12 @@ def test_depsolve(tmp_path, repo_servers, dnf_config, detect_fn, test_case):
assert n_filelist_files == len(REPO_PATHS)
else:
assert n_filelist_files == 0

if dnf_config:
use_dnf5 = json.loads(dnf_config)["use_dnf5"]
else:
use_dnf5 = False
if use_dnf5:
assert res["solver"] == "dnf5"
else:
assert res["solver"] == "dnf"

0 comments on commit 1ba25d6

Please sign in to comment.