Skip to content

Commit

Permalink
tests: fix
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Spooren <[email protected]>
  • Loading branch information
aparcar committed Feb 6, 2024
1 parent 416ef0b commit 9220421
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 19 deletions.
3 changes: 1 addition & 2 deletions asu/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from asu.package_changes import appy_package_changes

log = logging.getLogger("rq.worker")
log.setLevel(logging.DEBUG)


def build(req: dict, job=None):
Expand Down Expand Up @@ -266,7 +265,7 @@ def build(req: dict, job=None):
podman,
image,
[
"bash",
"sh",
"-c",
(
"env;"
Expand Down
19 changes: 16 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ def redis_load_mock_data(redis):
redis.sadd("packages:SNAPSHOT:SNAPSHOT:ath79/generic", "vim", "tmux")
redis.sadd("packages:SNAPSHOT:SNAPSHOT:x86/64", "vim", "tmux")

redis.sadd("branches", "SNAPSHOT", "1.2", "21.02", "19.07")
redis.sadd("versions:SNAPSHOT", "SNAPSHOT")
redis.sadd("versions:1.2", "1.2.3")
redis.sadd("versions:21.02", "21.02.7", "21.02.0", "21.02.0-rc4", "21.02-SNAPSHOT")
redis.sadd("versions:19.07", "19.07.7", "19.07.6")

redis.sadd("profiles:21.02:21.02.7:ath79/generic", "tplink_tl-wdr4300-v1")
redis.sadd("packages:21.02:21.02.7:ath79/generic", "vim", "tmux")
redis.sadd("packages:21.02:21.02.7:x86/64", "vim", "tmux")
Expand All @@ -30,9 +36,16 @@ def redis_load_mock_data(redis):
"mapping:1.2:1.2.3:testtarget/testsubtarget",
mapping={"testvendor,testprofile": "testprofile"},
)
redis.sadd("targets:1.2", "testtarget/testsubtarget")
redis.sadd("targets:SNAPSHOT", "ath79/generic", "x86/64")
redis.sadd("targets:21.02", "testtarget/testsubtarget", "ath79/generic", "x86/64")
redis.hset("targets:1.2", mapping={"testtarget/testsubtarget": "testarch"})
redis.hset("targets:SNAPSHOT", mapping={"ath79/generic": "", "x86/64": ""})
redis.hset(
"targets:21.02",
mapping={
"testtarget/testsubtarget": "testarch",
"ath79/generic": "",
"x86/64": "",
},
)
redis.hset("mapping-abi", mapping={"test1-1": "test1"})


Expand Down
14 changes: 1 addition & 13 deletions tests/test_janitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,14 @@ def upstream(httpserver):
"packages/testarch/base/Packages.manifest",
"targets/testtarget/testsubtarget/packages/Packages.manifest",
"targets/testtarget/testsubtarget/profiles.json",
".targets.json",
]

for f in expected_file_requests:
httpserver.expect_request(f"{base_url}/{f}").respond_with_data(
(upstream_path / f).read_bytes()
)

httpserver.expect_request(
f"{base_url}/targets", query_string="json-targets"
).respond_with_json(["testtarget/testsubtarget"])


def test_update_branch(app, upstream):
# with app.app_context():
update_branch(
{**app.config, "JSON_PATH": app.config["PUBLIC_PATH"] / "json/v1"},
app.config["BRANCHES"]["SNAPSHOT"],
)
assert (app.config["PUBLIC_PATH"] / "json/v1/snapshots/overview.json").is_file()


def test_update_meta_latest_json(app):
with app.app_context():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_package_changes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

from asu.package_changes import appy_package_changes


Expand Down Expand Up @@ -53,6 +52,7 @@ def test_apply_package_changes_release():

assert req == original_req


def test_apply_package_changes_mediatek():
req = {
"version": "23.05",
Expand Down
1 change: 1 addition & 0 deletions tests/upstream/snapshots/.targets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"testtarget/testsubtarget": "testarch"}

0 comments on commit 9220421

Please sign in to comment.