Skip to content
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

Test fixes #12

Merged
merged 4 commits into from
Aug 10, 2023
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
14 changes: 8 additions & 6 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ jobs:
python-version: [ '3.9' ]
runs-on: ubuntu-latest
steps:
# - name: Check If PR comes from a fork
# if: github.event.pull_request.head.repo.full_name != github.repository
# run: |
# echo "Action cannot be executed from forked repos PR"
# exit 1
- name: Create multi-node KinD cluster
uses: redhat-chaos/actions/kind@main
- name: Check out code
Expand All @@ -30,19 +35,16 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Configure AWS Creds
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Check isort, black, and flake8
run: |
pip install black flake8 isort
isort --profile black .
black --line-length 79 .
flake8 .
curl -sSL https://install.python-poetry.org | python3 -
- name: Check isort, black, and flake8
run: |
curl -sSL https://install.python-poetry.org | python3 -
- name: Install project dependencies
run: poetry install --no-interaction
- name: Run tests with coverage
Expand Down
22 changes: 11 additions & 11 deletions poetry.lock

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

26 changes: 25 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ homepage = "https://github.com/redhat-chaos/krkn"

[tool.poetry.dependencies]
python = "^3.9"
kubernetes ="^26.0.0"
kubernetes ="^26.1.0"
arcaflow-lib-kubernetes="^0.1.2"
sphinxnotes-markdown-builder="^0.5.6"
requests="^2.29.0"
Expand All @@ -21,6 +21,30 @@ base64io = "^1.0.3"
jinja2 = "^3.1.2"
boto3 = "^1.28.12"

[tool.black]
line-length = 79
target-version = ['py37', 'py38']
include = '\.pyi?$'
exclude = '''
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist

# The following are specific to Black, you probably don't want those.
| blib2to3
| tests/data
| profiling
)/
'''

[build-system]
requires = ["poetry-core>=1.1.0"]
build-backend = "poetry.core.masonry.api"
Expand Down
24 changes: 24 additions & 0 deletions src/krkn_lib_kubernetes/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1862,3 +1862,27 @@ def archive_and_get_path_from_pod(
raise e

return downloaded_files

def is_pod_running(self, pod_name: str, namespace: str) -> bool:
"""
Checks if a pod and all its containers are running

:param pod_name:str: the name of the pod to check

:param namespace:str: the namespace of the pod to check

:return: True if is running or False if not
"""
try:
response = self.cli.read_namespaced_pod(
name=pod_name, namespace=namespace, pretty="true"
)

is_ready = True

for status in response.status.container_statuses:
if not status.ready:
is_ready = False
return is_ready
except Exception:
return False
Loading
Loading