From 35eb6218efe909404afb15539b9f2da4c2be9aaa Mon Sep 17 00:00:00 2001 From: PruStephan Date: Wed, 6 Sep 2023 10:11:07 +0200 Subject: [PATCH] fixup! fixup! [#641] Add rc binaries tests --- binaries.json.license | 2 ++ docker/tests/Dockerfile-fedora-test | 2 +- docker/tests/Dockerfile-ubuntu-test | 2 +- docker/tests/test-fedora-binaries.py | 29 +++++++++------------------- docker/tests/test-ubuntu-binaries.py | 28 +++++++++------------------ 5 files changed, 22 insertions(+), 41 deletions(-) create mode 100644 binaries.json.license diff --git a/binaries.json.license b/binaries.json.license new file mode 100644 index 000000000..3efa5d29c --- /dev/null +++ b/binaries.json.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2023 Oxhead Alpha +SPDX-License-Identifier: LicenseRef-MIT-OA diff --git a/docker/tests/Dockerfile-fedora-test b/docker/tests/Dockerfile-fedora-test index 77ca771bb..caa77083b 100644 --- a/docker/tests/Dockerfile-fedora-test +++ b/docker/tests/Dockerfile-fedora-test @@ -16,4 +16,4 @@ ENV IS_RELEASED=${repo} COPY docker/tests/test-fedora-binaries.py /tezos-packaging/docker/tests/test-fedora-binaries.py COPY binaries.json /tezos-packaging/binaries.json -CMD [ "python3", "/tezos-packaging/docker/tests/test-fedora-binaries.py", "--no-cleanup" ] +CMD [ "python3", "/tezos-packaging/docker/tests/test-fedora-binaries.py"] diff --git a/docker/tests/Dockerfile-ubuntu-test b/docker/tests/Dockerfile-ubuntu-test index 2307f7263..e04dd3ab8 100644 --- a/docker/tests/Dockerfile-ubuntu-test +++ b/docker/tests/Dockerfile-ubuntu-test @@ -16,4 +16,4 @@ ENV IS_RELEASED=${repo} COPY docker/tests/test-ubuntu-binaries.py /tezos-packaging/docker/tests/test-ubuntu-binaries.py COPY binaries.json /tezos-packaging/binaries.json -CMD [ "python3", "/tezos-packaging/docker/tests/test-ubuntu-binaries.py", "--no-cleanup" ] +CMD [ "python3", "/tezos-packaging/docker/tests/test-ubuntu-binaries.py"] diff --git a/docker/tests/test-fedora-binaries.py b/docker/tests/test-fedora-binaries.py index 28e57561f..852180d6d 100644 --- a/docker/tests/test-fedora-binaries.py +++ b/docker/tests/test-fedora-binaries.py @@ -6,7 +6,8 @@ import json import os -def test(binaries, cleanup): + +def test(binaries): subprocess.run("sudo dnf update -y", shell=True, capture_output=True) processed_binaries = [] for binary in binaries: @@ -27,32 +28,20 @@ def test(binaries, cleanup): except Exception as e: print(f"Exception happened when trying to execute tests for {binary}.\n") raise e - if cleanup: - for binary in processed_binaries: - remove_res = subprocess.run( - f"dnf remove {binary}", shell=True, capture_output=True - ) - assert remove_res.returncode == 0 if __name__ == "__main__": - cleanup = True - - f = open('/tezos-packaging/binaries.json') + f = open("/tezos-packaging/binaries.json") data = json.load(f) - f.close() binaries = [] - is_released = os.environ['IS_RELEASED'] - if is_released == 'Tezos': - binaries = data['released'] - elif is_released == 'Tezos-rc': - binaries = data['candidates'] + is_released = os.environ["IS_RELEASED"] + if is_released == "Tezos": + binaries = data["released"] + elif is_released == "Tezos-rc": + binaries = data["candidates"] else: raise "Incorrect argument" - if len(sys.argv) > 3 and sys.argv[1] == "--no-cleanup": - cleanup = False - - test(binaries, cleanup) \ No newline at end of file + test(binaries) diff --git a/docker/tests/test-ubuntu-binaries.py b/docker/tests/test-ubuntu-binaries.py index 063f9a40b..f14e71582 100644 --- a/docker/tests/test-ubuntu-binaries.py +++ b/docker/tests/test-ubuntu-binaries.py @@ -6,7 +6,8 @@ import json import os -def test(binaries, cleanup): + +def test(binaries): subprocess.run("apt update -y", shell=True, capture_output=True) processed_binaries = [] for binary in binaries: @@ -27,32 +28,21 @@ def test(binaries, cleanup): except Exception as e: print(f"Exception happened when trying to execute tests for {binary}.\n") raise e - if cleanup: - for binary in processed_binaries: - remove_res = subprocess.run( - f"apt remove {binary}", shell=True, capture_output=True - ) - assert remove_res.returncode == 0 if __name__ == "__main__": - cleanup = True - - f = open('/tezos-packaging/binaries.json') + f = open("/tezos-packaging/binaries.json") data = json.load(f) f.close() binaries = [] - is_released = os.environ['IS_RELEASED'] - if is_released == 'tezos': - binaries = data['released'] - elif is_released == 'tezos-rc': - binaries = data['candidates'] + is_released = os.environ["IS_RELEASED"] + if is_released == "tezos": + binaries = data["released"] + elif is_released == "tezos-rc": + binaries = data["candidates"] else: raise "Incorrect argument" - if len(sys.argv) > 3 and sys.argv[1] == "--no-cleanup": - cleanup = False - - test(binaries, cleanup) + test(binaries)