Skip to content

Commit

Permalink
fixup! fixup! [#641] Add rc binaries tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PruStephan committed Sep 6, 2023
1 parent babff01 commit 81a49a4
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 41 deletions.
2 changes: 2 additions & 0 deletions binaries.json.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SPDX-FileCopyrightText: 2023 Oxhead Alpha
SPDX-License-Identifier: LicenseRef-MIT-OA
2 changes: 1 addition & 1 deletion docker/tests/Dockerfile-fedora-test
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
2 changes: 1 addition & 1 deletion docker/tests/Dockerfile-ubuntu-test
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
29 changes: 9 additions & 20 deletions docker/tests/test-fedora-binaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
test(binaries)
28 changes: 9 additions & 19 deletions docker/tests/test-ubuntu-binaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)

0 comments on commit 81a49a4

Please sign in to comment.