Skip to content

Commit

Permalink
fixup! [#641] Add tezos binaries tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PruStephan committed Aug 21, 2023
1 parent 0bddca0 commit 5eee026
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
uses: actions/checkout@v2

- name: Test fedora binaries
run: ./docker/tests/scripts/test-fedora-binaries.sh
run: nix develop .#buildkite -c ./docker/tests/scripts/test-fedora-binaries.sh

- name: Test ubuntu binaries
run: ./docker/tests/scripts/test-fedora-binaries.sh
run: nix develop .#buildkite -c ./docker/tests/scripts/test-fedora-binaries.sh

4 changes: 1 addition & 3 deletions docker/tests/Dockerfile-fedora-test
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ FROM fedora:${dist}
WORKDIR /tezos-packaging/docker

RUN dnf update -y
RUN dnf install -y python3-devel python3-setuptools
RUN sudo dnf update -y
RUN sudo dnf install -y 'dnf-command(copr)'
RUN dnf install -y python3-devel python3-setuptools 'dnf-command(copr)'
RUN sudo dnf copr enable -y @Serokell/Tezos

COPY docker/tests/test-fedora-binaries.py /tezos-packaging/docker/tests/test-fedora-binaries.py
Expand Down
8 changes: 2 additions & 6 deletions docker/tests/Dockerfile-ubuntu-test
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@ FROM ubuntu:${dist}
WORKDIR /tezos-packaging/docker

RUN apt update -y
RUN apt-get install -y python3-all python3-setuptools
RUN apt update -y
RUN apt install -y software-properties-common
RUN apt update -y
RUN add-apt-repository -y ppa:serokell/tezos
RUN apt-get update -y
RUN apt install -y python3-all python3-setuptools software-properties-common
RUN add-apt-repository -yu ppa:serokell/tezos

COPY docker/tests/test-ubuntu-binaries.py /tezos-packaging/docker/tests/test-ubuntu-binaries.py
CMD [ "python3", "/tezos-packaging/docker/tests/test-ubuntu-binaries.py", "--no-cleanup" ]
2 changes: 0 additions & 2 deletions docker/tests/scripts/test-fedora-binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
# SPDX-FileCopyrightText: 2023 Oxhead Alpha
# SPDX-License-Identifier: LicenseRef-MIT-OA

set -e

for version in $(jq -r '.fedora[]' docker/supported_versions.json); do
docker build --build-arg dist="$version" -t fedora-test -f docker/tests/Dockerfile-fedora-test .
docker run -i fedora-test
Expand Down
7 changes: 4 additions & 3 deletions docker/tests/test-fedora-binaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,25 @@


def test(cleanup: bool):
subprocess.run("sudo dnf update -y", shell=True, capture_output=True)
processed_binaries = []
for binary in binaries:
try:
install_command = f"sudo dnf install -y {binary}"
installation_result = subprocess.run(install_command, shell=True)
installation_result = subprocess.run(install_command, shell=True, capture_output=True)
assert installation_result.returncode == 0

processed_binaries.append(binary)

check_binary_command = f"sudo {binary} --version"
check_binary_command = f"echo \"{binary}: $({binary.replace('tezos', 'octez')} --version)\""
check_binary_result = subprocess.run(check_binary_command, shell=True)
assert check_binary_result.returncode == 0
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}")
remove_res = subprocess.run(f"dnf remove {binary}", shell=True, capture_output=True)
assert remove_res.returncode == 0


Expand Down
13 changes: 5 additions & 8 deletions docker/tests/test-ubuntu-binaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,25 @@


def test(cleanup: bool):
global binaries

binaries = [s.lower() for s in binaries]

subprocess.run("apt update -y", shell=True, capture_output=True)
processed_binaries = []
for binary in binaries:
try:
install_command = f"apt install -y {binary}"
installation_result = subprocess.run(install_command, shell=True)
install_command = f"apt install -y {binary.lower()}"
installation_result = subprocess.run(install_command, shell=True, capture_output=True)
assert installation_result.returncode == 0

processed_binaries.append(binary)

check_binary_command = f"{binary} --version"
check_binary_command = f"echo \"{binary}: $({binary.replace('tezos', 'octez')} --version)\""
check_binary_result = subprocess.run(check_binary_command, shell=True)
assert check_binary_result.returncode == 0
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("apt remove {binary}")
remove_res = subprocess.run(f"apt remove {binary}", shell=True, capture_output=True)
assert remove_res.returncode == 0


Expand Down

0 comments on commit 5eee026

Please sign in to comment.