-
Notifications
You must be signed in to change notification settings - Fork 9
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
RHOAIENG-16055: new(tests): test to start a Workbench, by creating the Notebook CR directly #94
base: main
Are you sure you want to change the base?
Conversation
The following are automatically added/executed:
Available user actions:
Supported labels{'/hold', '/verified', '/lgtm', '/wip'} |
for more information, see https://pre-commit.ci RHOAIENG-16055: new(tests): test to start a Workbench, by creating the Notebook CR directly
…e Notebook CR directly
330e5e2
to
92744bb
Compare
3f686b4
to
004d870
Compare
f5edaa0
to
c1eddd8
Compare
for more information, see https://pre-commit.ci
@@ -0,0 +1,309 @@ | |||
from __future__ import annotations | |||
|
|||
import logging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use simple_logger
resource_manager.destroy() | ||
|
||
|
||
class KubeResourceManager: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use ocpenshift python wrapper to CRUD resources
OPENSHIFT_DOMAIN = "openshift.io/" | ||
ODH_DOMAIN = "opendatahub.io/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
used in other places as well, please place under https://github.com/opendatahub-io/opendatahub-tests/blob/main/utilities/constants.py and re-use
|
||
LABEL_DASHBOARD = ODH_DOMAIN + "dashboard" | ||
LABEL_ODH_MANAGED = ODH_DOMAIN + "odh-managed" | ||
LABEL_SIDECAR_ISTIO_INJECT = "sidecar.istio.io/inject" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
self.privileged_client = privileged_client | ||
self.resources: list[ocp_resources.resource.Resource] = [] | ||
|
||
def createResourceWithoutWait(self, client: DynamicClient, resource: ocp_resources.resource.Resource): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use python naming conventions
import kubernetes.client | ||
from kubernetes.dynamic import DynamicClient | ||
|
||
from tests.workbenches.conftest import OdhAnnotationsLabels, OdhConstants, PodUtils |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
under conftest place fixtures; functions and classes should be under utils.py
in the relevant dir
@classmethod | ||
@property | ||
@functools.cache | ||
def logger(cls): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use simple_logger
), | ||
}, | ||
) | ||
def testCreateSimpleNotebook(self, function_resource_manager, admin_client, unprivileged_client): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all setup steps (e.g namespace, pvc) should be done in fixtures
please check existing fixtures and re-use
# } | ||
|
||
|
||
def loadDefaultNotebook(client: DynamicClient, namespace: str, name: str, image: str) -> Notebook: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
functions should go under utils.py
in the relevant dir
@@ -0,0 +1,146 @@ | |||
apiVersion: kubeflow.org/v1 | |||
kind: Notebook |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a template for this in the cluster?
|
||
with allure.step("Create Notebook CR"): | ||
# notebookImage: str = NotebookType.getNotebookImage(NotebookType.JUPYTER_MINIMAL_IMAGE, NotebookType.JUPYTER_MINIMAL_2023_2_TAG); | ||
notebookImage: str = "quay.io/modh/odh-minimal-notebook-container@sha256:615af25cfd4f3f2981b173e1a5ab24cb79f268ee72dabbddb6867ee1082eb902" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be fetched dinamically from the cluster?
notebookString = pathlib.Path( | ||
"/Users/jdanek/IdeaProjects/opendatahub-tests/tests/workbenches/notebook-controller/test_data/notebook.yaml" | ||
).read_text() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty sure this won't work :)
afterTestSteps={ | ||
Step( | ||
value="Delete ODH operator and all created resources", | ||
expected="Operator is removed and all other resources as well", | ||
) | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this has been functionally implemented but FWIW we don't plan to remove the operator after the test run
@@ -0,0 +1,39 @@ | |||
from typing import Callable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this used for? does it just provide additional documentation for tests in e.g. https://github.com/opendatahub-io/opendatahub-tests/pull/94/files#diff-358f1122838e1ac22415822c5a85d419e2d111c64285e488695af1cf6f03d490R35 ?
IMHO if this is implemented we should use it across the repo to keep consistency, so this should go under a higher level directory, but it should probably be discussed beforehand. Can you attend the shift left wg meeting to do so?
@@ -0,0 +1,309 @@ | |||
from __future__ import annotations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the majority of these classes could be avoided if you instead used the wrapper library https://github.com/RedHatQE/openshift-python-wrapper
Description
This is a port of
How Has This Been Tested?
Merge criteria: