Skip to content

Install the latest ODO for integration tests #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 31 additions & 29 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
- cron: 0 1 * * *

jobs:
test_with_minikube_linux:
test_with_minikube:
name: Run tests
strategy:
matrix:
Expand All @@ -30,39 +30,41 @@ jobs:
- name: Check out repository code
uses: actions/checkout@v2

- name: Linux - Setup Minikube
- name: Start minikube
uses: medyagh/setup-minikube@latest

# This step is disabled until the issue is addressed: https://github.com/redhat-actions/openshift-tools-installer/issues/66
# - name: Install ODO
# uses: redhat-actions/openshift-tools-installer@v1
# with:
# # Installs the latest release of odo
# odo: "latest"

- name: Install ODO for Linux
if: matrix.os == 'ubuntu-latest'
uses: manusa/[email protected]
with:
minikube version: 'v1.21.0'
kubernetes version: 'v1.21.0'
driver: 'docker'
github token: ${{ secrets.GITHUB_TOKEN }}
start args: '--addons=ingress'
run: |
curl -L https://developers.redhat.com/content-gateway/rest/mirror/pub/openshift-v4/clients/odo/latest/odo-linux-amd64 -o odo
curl -L https://developers.redhat.com/content-gateway/rest/mirror/pub/openshift-v4/clients/odo/latest/odo-linux-amd64.sha256 -o odo.sha256
echo "$(<odo.sha256) odo" | shasum -a 256 --check
sudo install -o root -g root -m 0755 odo /usr/local/bin/odo
odo version

- name: MacOS - Setup Minikube
- name: Install ODO for MacOS
if: matrix.os == 'macos-10.15'
uses: medyagh/setup-minikube@latest
with:
container-runtime: containerd

- name: Install ODO
uses: redhat-actions/openshift-tools-installer@v1
with:
# Installs the latest release of odo
odo: "latest"
run: |
curl -L https://developers.redhat.com/content-gateway/rest/mirror/pub/openshift-v4/clients/odo/latest/odo-darwin-amd64 -o odo
curl -L https://developers.redhat.com/content-gateway/rest/mirror/pub/openshift-v4/clients/odo/latest/odo-darwin-amd64.sha256 -o odo.sha256
echo "$(<odo.sha256) odo" | shasum -a 256 --check
chmod +x ./odo
sudo mv ./odo /usr/local/bin/odo
odo version

# Setup Python
- name: Setup Python
uses: actions/setup-python@v2
- name: Install Python, pipenv and Pipfile packages
uses: palewire/install-python-pipenv-pipfile@v2
with:
python-version: "3.9.9"

- name: Install pipenv
uses: dschep/install-pipenv-action@v1
python-version: "3.9.10"

- name: Run test with pipenv and pytest
run: |
odo version
pipenv install --dev
pipenv run pytest tests -v
run: pipenv run pytest tests -v

2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ pyyaml = "*"
jmespath = "*"

[requires]
python_version = "3.9.9"
python_version = "3.9.10"
16 changes: 8 additions & 8 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ All related issues are being tracked under the main devfile API repo https://git

## Pytest for ODO
### Prerequisites
- Python 3.9.9
- Python 3.9.10
- pipenv : run `pip install --user pipenv`
- Minikube or OpenShift
- odo
Expand Down
2 changes: 1 addition & 1 deletion pyvenv.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
home = /usr/local/bin
include-system-site-packages = false
version = 3.9.9
version = 3.9.10
3 changes: 2 additions & 1 deletion tests/test_catalog_cmd.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
from utils.config import *
from utils.util import *

Expand Down Expand Up @@ -57,7 +58,7 @@ def test_catalog_cmd_list_components_json_format(self):
assert validate_json_format(result.stdout)
assert match_all(result.stdout, list_components)


@pytest.mark.skipif(sys.platform == "linux", reason="An issue is found on Linux")
def test_catalog_cmd_list_describe_json_format(self):

print('Test case : when executing catalog describe component with -o json, it should display a valid JSON')
Expand Down
2 changes: 1 addition & 1 deletion tests/test_dot_devfile_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_url_create_with_dot_devfile(self):
os.chdir(self.CONTEXT)

# Todo: compatibility test with .devfile.yaml is working with odo version higher than v2.5.0.
# Decomment the line when odo mirror site issue is fixed.
# Uncomment the line when odo mirror site issue is fixed.
# subprocess.run(["mv", "devfile.yaml", ".devfile.yaml"])
subprocess.run(["odo", "url", "create", self.ENDPOINT_1, "--port", self.PORT_1,
"--host", self.HOST, "--secure", "--ingress"])
Expand Down