diff --git a/.github/workflows/run-test-cases.yml b/.github/workflows/run-test-cases.yml index 130ab208b..7643886f3 100644 --- a/.github/workflows/run-test-cases.yml +++ b/.github/workflows/run-test-cases.yml @@ -1,16 +1,10 @@ name: Test K3s, Kubernetes, and MicroK8s on: - workflow_dispatch: - inputs: pull_request: branches: [main] paths: - - test/run-end-to-end.py - - test/run-conservation-of-broker-pod.py - - test/run-helm-install-delete.py - - test/run-webhook.py - - test/shared_test_code.py + - test/e2e/** - .github/workflows/run-test-cases.yml - build/containers/Dockerfile.agent - build/containers/Dockerfile.controller @@ -24,11 +18,7 @@ on: push: branches: [main] paths: - - test/run-end-to-end.py - - test/run-conservation-of-broker-pod.py - - test/run-helm-install-delete.py - - test/run-webhook.py - - test/shared_test_code.py + - test/e2e/** - .github/workflows/run-test-cases.yml - build/containers/Dockerfile.agent - build/containers/Dockerfile.controller @@ -54,26 +44,38 @@ jobs: with: persist-credentials: false + - name: Rust install + uses: dtolnay/rust-toolchain@master + with: + toolchain: 1.68.1 + components: clippy, rustfmt + - name: Build local containers for PR tests if: startsWith(github.event_name, 'pull_request') env: BUILD_AMD64: 1 BUILD_ARM32: 0 BUILD_ARM64: 0 - BUILD_SLIM_AGENT: 0 - AGENT_FEATURES: "agent-full" - PACKAGES_TO_EXCLUDE: "akri-udev akri-onvif akri-opcua udev-video-broker debug-echo-discovery-handler onvif-discovery-handler opcua-discovery-handler udev-discovery-handler" + BUILD_SLIM_AGENT: 1 PREFIX: ghcr.io/project-akri/akri LABEL_PREFIX: pr CARGO_INCREMENTAL: 0 run: | make akri-build make controller-build-amd64 - make agent-full-build-amd64 + make agent-build-amd64 make webhook-configuration-build-amd64 - docker save ${PREFIX}/agent-full:${LABEL_PREFIX}-amd64 > agent.tar + make debug-echo-discovery-build-amd64 + make udev-discovery-build-amd64 + make onvif-discovery-build-amd64 + make opcua-discovery-build-amd64 + docker save ${PREFIX}/agent:${LABEL_PREFIX}-amd64 > agent.tar docker save ${PREFIX}/controller:${LABEL_PREFIX}-amd64 > controller.tar docker save ${PREFIX}/webhook-configuration:${LABEL_PREFIX}-amd64 > webhook-configuration.tar + docker save ${PREFIX}/debug-echo-discovery:${LABEL_PREFIX}-amd64 > debug-echo-discovery.tar + docker save ${PREFIX}/udev-discovery:${LABEL_PREFIX}-amd64 > udev-discovery.tar + docker save ${PREFIX}/opcua-discovery:${LABEL_PREFIX}-amd64 > opcua-discovery.tar + docker save ${PREFIX}/onvif-discovery:${LABEL_PREFIX}-amd64 > onvif-discovery.tar - name: Upload Agent container as artifact if: startsWith(github.event_name, 'pull_request') @@ -93,6 +95,30 @@ jobs: with: name: webhook-configuration.tar path: webhook-configuration.tar + - name: Upload DebugEcho discovery container as artifact + if: startsWith(github.event_name, 'pull_request') + uses: actions/upload-artifact@v3 + with: + name: debug-echo-discovery.tar + path: debug-echo-discovery.tar + - name: Upload UDEV discovery container as artifact + if: startsWith(github.event_name, 'pull_request') + uses: actions/upload-artifact@v3 + with: + name: udev-discovery.tar + path: udev-discovery.tar + - name: Upload ONVIF discovery container as artifact + if: startsWith(github.event_name, 'pull_request') + uses: actions/upload-artifact@v3 + with: + name: onvif-discovery.tar + path: onvif-discovery.tar + - name: Upload OPCUA discovery container as artifact + if: startsWith(github.event_name, 'pull_request') + uses: actions/upload-artifact@v3 + with: + name: opcua-discovery.tar + path: opcua-discovery.tar test-cases: needs: build-containers @@ -103,35 +129,30 @@ jobs: fail-fast: false matrix: kube: - - runtime: MicroK8s-1.24 + - runtime: microk8s version: 1.24/stable - - runtime: MicroK8s-1.25 + - runtime: microk8s version: 1.25/stable - - runtime: MicroK8s-1.26 + - runtime: microk8s version: 1.26/stable - - runtime: MicroK8s-1.27 + - runtime: microk8s version: 1.27/stable - - runtime: K3s-1.24 + - runtime: k3s version: v1.24.13+k3s1 - - runtime: K3s-1.25 + - runtime: k3s version: v1.25.9+k3s1 - - runtime: K3s-1.26 + - runtime: k3s version: v1.26.4+k3s1 - - runtime: K3s-1.27 + - runtime: k3s version: v1.27.1+k3s1 - - runtime: Kubernetes-1.24 + - runtime: k8s version: 1.24.13-00 - - runtime: Kubernetes-1.25 + - runtime: k8s version: 1.25.9-00 - - runtime: Kubernetes-1.26 + - runtime: k8s version: 1.26.4-00 - - runtime: Kubernetes-1.27 + - runtime: k8s version: 1.27.1-00 - test: - - case: end-to-end - file: test/run-end-to-end.py - - case: webhook - file: test/run-webhook.py steps: - name: Checkout the head commit of the branch @@ -142,29 +163,23 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: 3.8 - - name: Install Python kubernetes dependency + python-version: "3.10" + - name: Install Poetry and dependencies + working-directory: ./test/e2e run: | - python -m pip install --upgrade pip - pip install kubernetes + POETRY_HOME=/opt/poetry + python3 -m venv $POETRY_HOME + $POETRY_HOME/bin/pip install poetry==1.5.1 + $POETRY_HOME/bin/poetry --version + $POETRY_HOME/bin/poetry install --no-root - - name: Download Agent container artifact - if: startsWith(github.event_name, 'pull_request') - uses: actions/download-artifact@v3 - with: - name: agent.tar - - name: Download Controller container artifact - if: startsWith(github.event_name, 'pull_request') - uses: actions/download-artifact@v3 - with: - name: controller.tar - - name: Download Webhook-Configuration container artifact + - name: Download container artifacts if: startsWith(github.event_name, 'pull_request') uses: actions/download-artifact@v3 with: - name: webhook-configuration.tar + path: /tmp/images - - if: startsWith(matrix.kube.runtime, 'K3s') + - if: startsWith(matrix.kube.runtime, 'k3s') name: Install K3s env: INSTALL_K3S_VERSION: ${{ matrix.kube.version }} @@ -175,19 +190,15 @@ jobs: mkdir -p $HOME/.kube sudo cp -i /etc/rancher/k3s/k3s.yaml $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config - echo "--set kubernetesDistro=k3s" > /tmp/k8s_distro_to_test.txt - echo 'kubectl' > /tmp/runtime_cmd_to_test.txt - echo '~/.kube/config' > /tmp/kubeconfig_path_to_test.txt until kubectl get node ${HOSTNAME,,} -o jsonpath='{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status}' | grep 'Ready=True'; do echo "waiting for k3s to become ready"; sleep 10; done - if: (startsWith(github.event_name, 'pull_request')) && (startsWith(matrix.kube.runtime, 'K3s')) name: Import local agent and controller to K3s + working-directory: /tmp/images run: | - sudo k3s ctr image import agent.tar - sudo k3s ctr image import controller.tar - sudo k3s ctr image import webhook-configuration.tar + sudo find -name "*.tar" -type f -exec k3s ctr image import {} \; - - if: startsWith(matrix.kube.runtime, 'Kubernetes') + - if: startsWith(matrix.kube.runtime, 'k8s') name: Install Kubernetes run: | sudo apt-get update -y @@ -236,12 +247,9 @@ jobs: kubectl taint nodes --all node-role.kubernetes.io/master- fi - echo '--set kubernetesDistro=k8s' > /tmp/k8s_distro_to_test.txt - echo 'kubectl' > /tmp/runtime_cmd_to_test.txt - echo '~/.kube/config' > /tmp/kubeconfig_path_to_test.txt until kubectl get node ${HOSTNAME,,} -o jsonpath='{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status}' | grep 'Ready=True'; do echo "waiting for kubernetes to become ready"; sleep 10; done - - if: startsWith(matrix.kube.runtime, 'Kubernetes') + - if: startsWith(matrix.kube.runtime, 'k8s') name: Output Kubelet, Containerd, Docker Logs run: | echo "Kubelet Logs:" @@ -251,17 +259,16 @@ jobs: echo "\nDocker Logs" sudo journalctl -xeu docker --no-pager - - if: (startsWith(github.event_name, 'pull_request')) && (startsWith(matrix.kube.runtime, 'Kubernetes')) + - if: (startsWith(github.event_name, 'pull_request')) && (startsWith(matrix.kube.runtime, 'k8s')) name: Import local agent and controller to Kubernetes + working-directory: /tmp/images run: | # Need to load to containerd with ctr # -n allows kubernetes to see the image - sudo ctr -n=k8s.io image import agent.tar - sudo ctr -n=k8s.io image import controller.tar - sudo ctr -n=k8s.io image import webhook-configuration.tar + sudo find -name "*.tar" -type f -exec ctr -n=k8s.io image import {} \; sudo crictl --runtime-endpoint unix:///var/run/containerd/containerd.sock images - - if: startsWith(matrix.kube.runtime, 'MicroK8s') + - if: startsWith(matrix.kube.runtime, 'microk8s') name: Install MicroK8s run: | set -x @@ -275,19 +282,15 @@ jobs: sudo sed -i 's/memory.available<100Mi,nodefs.available<1Gi,imagefs.available<1Gi/memory.available<25Mi,nodefs.available<50Mi,imagefs.available<50Mi/' /var/snap/microk8s/current/args/kubelet sudo systemctl restart snap.microk8s.daemon-kubelite until sudo microk8s.status --wait-ready; do sleep 5s; echo "Try again"; done - echo '--set kubernetesDistro=microk8s' > /tmp/k8s_distro_to_test.txt - echo 'kubectl' > /tmp/runtime_cmd_to_test.txt - echo '~/.kube/config' > /tmp/kubeconfig_path_to_test.txt - - if: (startsWith(github.event_name, 'pull_request')) && (startsWith(matrix.kube.runtime, 'MicroK8s')) + - if: (startsWith(github.event_name, 'pull_request')) && (startsWith(matrix.kube.runtime, 'microk8s')) name: Import local agent and controller to MicroK8s + working-directory: /tmp/images run: | sudo microk8s.status --wait-ready until sudo microk8s ctr images ls; do sleep 5s; echo "Try again"; done sudo microk8s ctr images ls - sudo microk8s ctr --debug --timeout 60s images import agent.tar - sudo microk8s ctr --debug --timeout 60s images import controller.tar - sudo microk8s ctr --debug --timeout 60s images import webhook-configuration.tar + sudo find -name "*.tar" -type f -exec microk8s ctr --debug --timeout 60s images import {} \; sudo microk8s ctr images ls - name: Add Akri Helm Chart @@ -296,60 +299,23 @@ jobs: # For push and release, we need to wait for the Helm chart and # associated containers to build. - if: github.event_name == 'push' || github.event_name == 'release' - name: Set sleep duration before running script to 2700 - run: echo 2700 > /tmp/sleep_duration.txt + name: sleep before running script for 2700s + run: sleep 2700 - # For pull_request, use the locally built containers. - - if: startsWith(github.event_name, 'pull_request') - name: Tell Helm to use the 'local' labels for container images + - name: Execute test script + working-directory: ./test/e2e run: | - git fetch origin main - git show origin/main:version.txt > /tmp/version_to_test.txt - echo '--set agent.image.pullPolicy=Never,agent.image.tag=pr-amd64,controller.image.pullPolicy=Never,controller.image.tag=pr-amd64,webhookConfiguration.image.pullPolicy=Never,webhookConfiguration.image.tag=pr-amd64' > /tmp/extra_helm_args.txt - # For non-PR (i.e. push, release, manual), version.txt is corresponds - # to an existing Helm chart. - - if: (!(startsWith(github.event_name, 'pull_request'))) - name: Use current version for push - run: cat version.txt > /tmp/version_to_test.txt + case "${{ github.event_name }}" in "push");; "release") extra_param="--release";; *) extra_param="--use-local";; esac + /opt/poetry/bin/poetry run pytest -v --distribution ${{ matrix.kube.runtime}} --test-version $(cat ../../version.txt) $extra_param - # For workflow_dispatch and pull_request, use the files in deployment/helm - # as basis for helm install ... this enables us to test any changes made to - # the helm chart files in a PR (where no helm chart is published) - - if: github.event_name != 'push' && github.event_name != 'release' - name: Tell Helm to use the files in deployment/helm to build chart - run: | - echo './deployment/helm' > /tmp/helm_chart_location.txt - # For push, use a specific version of the `akri-dev` charts that are built and - # published by the helm workflow. - - if: github.event_name == 'push' - name: Tell Helm to use the `akri-dev` published charts - run: | - echo "akri-helm-charts/akri-dev --version $(cat /tmp/version_to_test.txt)" > /tmp/helm_chart_location.txt - # For release, use a specific version of the `akri` charts that are built and - # published by the helm workflow. - - if: github.event_name == 'release' - name: Tell Helm to use the `akri` published charts - run: | - echo "akri-helm-charts/akri --version $(cat /tmp/version_to_test.txt)" > /tmp/helm_chart_location.txt - - - name: Execute test script ${{ matrix.test.file }} - run: python ${{ matrix.test.file }} - - - name: Upload Agent log as artifact - if: always() - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.kube.runtime }}-${{ matrix.test.case }}-agent-log - path: /tmp/agent_log.txt - - name: Upload controller log as artifact + - name: Sanitize logs artifact name + id: sanitize-artifact-name if: always() - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.kube.runtime }}-${{ matrix.test.case }}-controller-log - path: /tmp/controller_log.txt - - name: Upload webhook log as artifact + run: echo "name=${{ matrix.kube.runtime }}-${{ matrix.kube.version }}-logs" | tr "/:" "_" >> $GITHUB_OUTPUT + + - name: Upload logs as artifact if: always() uses: actions/upload-artifact@v3 with: - name: ${{ matrix.kube.runtime }}-${{ matrix.test.case }}-webhook-log - path: /tmp/webhook_log.txt + name: ${{ steps.sanitize-artifact-name.outputs.name }} + path: /tmp/logs/ \ No newline at end of file diff --git a/test/e2e/.gitignore b/test/e2e/.gitignore new file mode 100644 index 000000000..f07124031 --- /dev/null +++ b/test/e2e/.gitignore @@ -0,0 +1,2 @@ +__pycache__ +.pytest_cache \ No newline at end of file diff --git a/test/e2e/conftest.py b/test/e2e/conftest.py new file mode 100644 index 000000000..7abfe75ca --- /dev/null +++ b/test/e2e/conftest.py @@ -0,0 +1,120 @@ +from dataclasses import dataclass +import subprocess +import pytest +import kubernetes +from pathlib import Path + +from helpers import save_akri_logs + + +def pytest_addoption(parser): + parser.addoption( + "--distribution", action="store", help="Specify distribution to use" + ) + parser.addoption("--test-version", action="store", help="version to test") + parser.addoption( + "--local-tag", action="store", default="pr-amd64", help="tag for local images" + ) + parser.addoption("--use-local", action="store_true", help="use local images if set") + parser.addoption("--release", action="store_true", help="use released helm chart") + + +@dataclass +class Distribution: + name: str + kubeconfig: Path + kubectl: str + + +@pytest.fixture(scope="session") +def distribution_config(pytestconfig): + distribution = pytestconfig.getoption("--distribution", None) + if distribution == "k3s": + yield Distribution("k3s", Path.home() / ".kube/config", "kubectl") + elif distribution == "k8s": + yield Distribution("k8s", Path.home() / ".kube/config", "kubectl") + elif distribution == "microk8s": + yield Distribution("microk8s", Path.home() / ".kube/config", "kubectl") + elif distribution is None: + pytest.exit( + "Please provide a kubernetes distribution via '--distribution' flag" + ) + else: + pytest.exit( + "Wrong distribution provided, valid values are 'k3s', 'k8s' or 'microk8s'" + ) + + +@pytest.fixture(scope="session", autouse=True) +def kube_client(distribution_config): + kubernetes.config.load_kube_config(str(distribution_config.kubeconfig)) + return kubernetes.client.ApiClient() + + +@pytest.fixture(scope="session") +def akri_version(pytestconfig): + local_version = (Path(__file__).parent / "../../version.txt").read_text().strip() + version = pytestconfig.getoption("--test-version") + if version is None: + version = local_version + return version + + +@pytest.fixture(scope="module", autouse=True) +def install_akri(request, distribution_config, pytestconfig, akri_version): + discovery_handlers = getattr(request.module, "discovery_handlers", []) + + release = pytestconfig.getoption("--release", False) + subprocess.run(["helm", "repo", "update"], check=True) + helm_install_command = ["helm", "install", "akri"] + + if pytestconfig.getoption("--use-local"): + local_tag = pytestconfig.getoption("--local-tag", "pr-amd64") + helm_install_command.extend( + [ + Path(__file__).parent / "../../deployment/helm", + "--set", + "agent.image.pullPolicy=Never," + f"agent.image.tag={local_tag}," + "controller.image.pullPolicy=Never," + f"controller.image.tag={local_tag}," + "webhookConfiguration.image.pullPolicy=Never," + f"webhookConfiguration.image.tag={local_tag}", + ] + ) + else: + chart_name = "akri" if release else "akri-dev" + helm_install_command.extend( + [ + f"akri-helm-charts/{chart_name}", + "--version", + akri_version, + ] + ) + + for discovery_handler in discovery_handlers: + if discovery_handler == "debugEcho": + helm_install_command.extend( + [ + "--set", + "agent.allowDebugEcho=true,debugEcho.configuration.shared=false", + ] + ) + helm_install_command.extend( + [ + "--set", + f"{discovery_handler}.discovery.enabled=true", + ] + ) + helm_install_command.extend( + [ + "--set", + f"kubernetesDistro={distribution_config.name}", + "--debug", + "--atomic", + ] + ) + subprocess.run(helm_install_command, check=True) + yield + save_akri_logs(getattr(request.module, "__name__")) + subprocess.run(["helm", "delete", "akri", "--wait"]) diff --git a/test/e2e/helpers.py b/test/e2e/helpers.py new file mode 100644 index 000000000..01bb5e784 --- /dev/null +++ b/test/e2e/helpers.py @@ -0,0 +1,150 @@ +import kubernetes +from pathlib import Path + + +def get_pods_logs(label_selector, since=None): + v1_core = kubernetes.client.CoreV1Api() + pods = v1_core.list_namespaced_pod("default", label_selector=label_selector).items + return { + pod.metadata.name: v1_core.read_namespaced_pod_log( + pod.metadata.name, "default", since_seconds=since + ) + for pod in pods + } + + +def get_agent_logs(since=None): + return get_pods_logs("app.kubernetes.io/name=akri-agent", since=since) + + +def save_akri_logs(prefix): + directory = Path("/tmp/logs") + directory.mkdir(parents=True, exist_ok=True) + logs = get_pods_logs("app.kubernetes.io/part-of=akri") + for pod, content in logs.items(): + with open(directory / f"{prefix}-{pod}.log", "a") as f: + f.write(content) + + +def check_akri_is_healthy(handlers): + v1_core = kubernetes.client.CoreV1Api() + for component in [f"{h}-discovery" for h in handlers] + ["agent", "controller"]: + if component == "debugEcho-discovery": + component = "debug-echo-discovery" + pods = v1_core.list_namespaced_pod( + "default", + label_selector=f"app.kubernetes.io/name=akri-{component}", + field_selector="status.phase=Running", + ) + assert len(pods.items) > 0, f"{component} is not running" + + +def assert_broker_pods_running(config_name, count, timeout_seconds=400): + v1_core = kubernetes.client.CoreV1Api() + field_selector = ( + "status.phase=Running" if count > 0 else "status.phase!=Terminating" + ) + pods = v1_core.list_namespaced_pod( + "default", + label_selector=f"akri.sh/configuration={config_name}", + field_selector=field_selector, + ) + version = pods.metadata.resource_version + pods_set = {pod.metadata.name for pod in pods.items} + if len(pods_set) == count: + return + w = kubernetes.watch.Watch() + for e in w.stream( + v1_core.list_namespaced_pod, + "default", + label_selector=f"akri.sh/configuration={config_name}", + field_selector=field_selector, + resource_version=version, + timeout_seconds=timeout_seconds, + ): + if e["type"] == "DELETED": + pods_set.discard(e["object"].metadata.name) + else: + pods_set.add(e["object"].metadata.name) + if len(pods_set) == count: + w.stop() + return + raise AssertionError(f"{count} != {len(pods_set)}") + + +def assert_svc_present(config_name, instance_level, count, timeout_seconds=400): + v1_core = kubernetes.client.CoreV1Api() + label_selector = ( + "akri.sh/instance" if instance_level else f"akri.sh/configuration={config_name}" + ) + svcs = v1_core.list_namespaced_service("default", label_selector=label_selector) + version = svcs.metadata.resource_version + if instance_level: + svcs_set = { + svc.metadata.name + for svc in svcs.items + if svc.metadata.labels["akri.sh/instance"].startswith(f"{config_name}-") + } + else: + svcs_set = {svc.metadata.name for svc in svcs.items} + + if count == len(svcs_set): + return + w = kubernetes.watch.Watch() + for e in w.stream( + v1_core.list_namespaced_service, + "default", + label_selector=label_selector, + resource_version=version, + timeout_seconds=timeout_seconds, + ): + if instance_level and not e["object"].metadata.labels[ + "akri.sh/instance" + ].startswith(f"{config_name}-"): + continue + if e["type"] == "DELETED": + svcs_set.discard(e["object"].metadata.name) + else: + svcs_set.add(e["object"].metadata.name) + if len(svcs_set) == count: + w.stop() + return + raise AssertionError(f"{len(svcs_set)} != {count}") + + +def assert_akri_instances_present( + akri_version, config_name, count, timeout_seconds=400 +): + version = f'v{akri_version.split(".")[0]}' + v1_custom = kubernetes.client.CustomObjectsApi() + instances = v1_custom.list_namespaced_custom_object( + "akri.sh", version, "default", "instances" + ) + resource_version = instances["metadata"]["resourceVersion"] + instances = { + instance["metadata"]["name"] + for instance in instances["items"] + if instance["spec"]["configurationName"] == config_name + } + if len(instances) == count: + return + w = kubernetes.watch.Watch() + for e in w.stream( + v1_custom.list_namespaced_custom_object, + "akri.sh", + version, + "default", + "instances", + timeout_seconds=timeout_seconds, + resource_version=resource_version, + ): + if e["raw_object"]["spec"]["configurationName"] != config_name: + continue + if e["type"] == "DELETED": + instances.discard(e["raw_object"]["metadata"]["name"]) + else: + instances.add(e["raw_object"]["metadata"]["name"]) + if len(instances) == count: + w.stop() + return + raise AssertionError(f"{count} != {len(instances)}") diff --git a/test/e2e/poetry.lock b/test/e2e/poetry.lock new file mode 100644 index 000000000..03514b9b1 --- /dev/null +++ b/test/e2e/poetry.lock @@ -0,0 +1,499 @@ +# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand. + +[[package]] +name = "cachetools" +version = "5.3.1" +description = "Extensible memoizing collections and decorators" +optional = false +python-versions = ">=3.7" +files = [ + {file = "cachetools-5.3.1-py3-none-any.whl", hash = "sha256:95ef631eeaea14ba2e36f06437f36463aac3a096799e876ee55e5cdccb102590"}, + {file = "cachetools-5.3.1.tar.gz", hash = "sha256:dce83f2d9b4e1f732a8cd44af8e8fab2dbe46201467fc98b3ef8f269092bf62b"}, +] + +[[package]] +name = "certifi" +version = "2023.5.7" +description = "Python package for providing Mozilla's CA Bundle." +optional = false +python-versions = ">=3.6" +files = [ + {file = "certifi-2023.5.7-py3-none-any.whl", hash = "sha256:c6c2e98f5c7869efca1f8916fed228dd91539f9f1b444c314c06eef02980c716"}, + {file = "certifi-2023.5.7.tar.gz", hash = "sha256:0f0d56dc5a6ad56fd4ba36484d6cc34451e1c6548c61daad8c320169f91eddc7"}, +] + +[[package]] +name = "charset-normalizer" +version = "3.1.0" +description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." +optional = false +python-versions = ">=3.7.0" +files = [ + {file = "charset-normalizer-3.1.0.tar.gz", hash = "sha256:34e0a2f9c370eb95597aae63bf85eb5e96826d81e3dcf88b8886012906f509b5"}, + {file = "charset_normalizer-3.1.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:e0ac8959c929593fee38da1c2b64ee9778733cdf03c482c9ff1d508b6b593b2b"}, + {file = "charset_normalizer-3.1.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d7fc3fca01da18fbabe4625d64bb612b533533ed10045a2ac3dd194bfa656b60"}, + {file = "charset_normalizer-3.1.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:04eefcee095f58eaabe6dc3cc2262f3bcd776d2c67005880894f447b3f2cb9c1"}, + {file = "charset_normalizer-3.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:20064ead0717cf9a73a6d1e779b23d149b53daf971169289ed2ed43a71e8d3b0"}, + {file = "charset_normalizer-3.1.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1435ae15108b1cb6fffbcea2af3d468683b7afed0169ad718451f8db5d1aff6f"}, + {file = "charset_normalizer-3.1.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:c84132a54c750fda57729d1e2599bb598f5fa0344085dbde5003ba429a4798c0"}, + {file = "charset_normalizer-3.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:75f2568b4189dda1c567339b48cba4ac7384accb9c2a7ed655cd86b04055c795"}, + {file = "charset_normalizer-3.1.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:11d3bcb7be35e7b1bba2c23beedac81ee893ac9871d0ba79effc7fc01167db6c"}, + {file = "charset_normalizer-3.1.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:891cf9b48776b5c61c700b55a598621fdb7b1e301a550365571e9624f270c203"}, + {file = "charset_normalizer-3.1.0-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:5f008525e02908b20e04707a4f704cd286d94718f48bb33edddc7d7b584dddc1"}, + {file = "charset_normalizer-3.1.0-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:b06f0d3bf045158d2fb8837c5785fe9ff9b8c93358be64461a1089f5da983137"}, + {file = "charset_normalizer-3.1.0-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:49919f8400b5e49e961f320c735388ee686a62327e773fa5b3ce6721f7e785ce"}, + {file = "charset_normalizer-3.1.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:22908891a380d50738e1f978667536f6c6b526a2064156203d418f4856d6e86a"}, + {file = "charset_normalizer-3.1.0-cp310-cp310-win32.whl", hash = "sha256:12d1a39aa6b8c6f6248bb54550efcc1c38ce0d8096a146638fd4738e42284448"}, + {file = "charset_normalizer-3.1.0-cp310-cp310-win_amd64.whl", hash = "sha256:65ed923f84a6844de5fd29726b888e58c62820e0769b76565480e1fdc3d062f8"}, + {file = "charset_normalizer-3.1.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:9a3267620866c9d17b959a84dd0bd2d45719b817245e49371ead79ed4f710d19"}, + {file = "charset_normalizer-3.1.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6734e606355834f13445b6adc38b53c0fd45f1a56a9ba06c2058f86893ae8017"}, + {file = "charset_normalizer-3.1.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:f8303414c7b03f794347ad062c0516cee0e15f7a612abd0ce1e25caf6ceb47df"}, + {file = "charset_normalizer-3.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:aaf53a6cebad0eae578f062c7d462155eada9c172bd8c4d250b8c1d8eb7f916a"}, + {file = "charset_normalizer-3.1.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3dc5b6a8ecfdc5748a7e429782598e4f17ef378e3e272eeb1340ea57c9109f41"}, + {file = "charset_normalizer-3.1.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e1b25e3ad6c909f398df8921780d6a3d120d8c09466720226fc621605b6f92b1"}, + {file = "charset_normalizer-3.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0ca564606d2caafb0abe6d1b5311c2649e8071eb241b2d64e75a0d0065107e62"}, + {file = "charset_normalizer-3.1.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b82fab78e0b1329e183a65260581de4375f619167478dddab510c6c6fb04d9b6"}, + {file = "charset_normalizer-3.1.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:bd7163182133c0c7701b25e604cf1611c0d87712e56e88e7ee5d72deab3e76b5"}, + {file = "charset_normalizer-3.1.0-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:11d117e6c63e8f495412d37e7dc2e2fff09c34b2d09dbe2bee3c6229577818be"}, + {file = "charset_normalizer-3.1.0-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:cf6511efa4801b9b38dc5546d7547d5b5c6ef4b081c60b23e4d941d0eba9cbeb"}, + {file = "charset_normalizer-3.1.0-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:abc1185d79f47c0a7aaf7e2412a0eb2c03b724581139193d2d82b3ad8cbb00ac"}, + {file = "charset_normalizer-3.1.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:cb7b2ab0188829593b9de646545175547a70d9a6e2b63bf2cd87a0a391599324"}, + {file = "charset_normalizer-3.1.0-cp311-cp311-win32.whl", hash = "sha256:c36bcbc0d5174a80d6cccf43a0ecaca44e81d25be4b7f90f0ed7bcfbb5a00909"}, + {file = "charset_normalizer-3.1.0-cp311-cp311-win_amd64.whl", hash = "sha256:cca4def576f47a09a943666b8f829606bcb17e2bc2d5911a46c8f8da45f56755"}, + {file = "charset_normalizer-3.1.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:0c95f12b74681e9ae127728f7e5409cbbef9cd914d5896ef238cc779b8152373"}, + {file = "charset_normalizer-3.1.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fca62a8301b605b954ad2e9c3666f9d97f63872aa4efcae5492baca2056b74ab"}, + {file = "charset_normalizer-3.1.0-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ac0aa6cd53ab9a31d397f8303f92c42f534693528fafbdb997c82bae6e477ad9"}, + {file = "charset_normalizer-3.1.0-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:c3af8e0f07399d3176b179f2e2634c3ce9c1301379a6b8c9c9aeecd481da494f"}, + {file = "charset_normalizer-3.1.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3a5fc78f9e3f501a1614a98f7c54d3969f3ad9bba8ba3d9b438c3bc5d047dd28"}, + {file = "charset_normalizer-3.1.0-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:628c985afb2c7d27a4800bfb609e03985aaecb42f955049957814e0491d4006d"}, + {file = "charset_normalizer-3.1.0-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:74db0052d985cf37fa111828d0dd230776ac99c740e1a758ad99094be4f1803d"}, + {file = "charset_normalizer-3.1.0-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:1e8fcdd8f672a1c4fc8d0bd3a2b576b152d2a349782d1eb0f6b8e52e9954731d"}, + {file = "charset_normalizer-3.1.0-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:04afa6387e2b282cf78ff3dbce20f0cc071c12dc8f685bd40960cc68644cfea6"}, + {file = "charset_normalizer-3.1.0-cp37-cp37m-musllinux_1_1_s390x.whl", hash = "sha256:dd5653e67b149503c68c4018bf07e42eeed6b4e956b24c00ccdf93ac79cdff84"}, + {file = "charset_normalizer-3.1.0-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:d2686f91611f9e17f4548dbf050e75b079bbc2a82be565832bc8ea9047b61c8c"}, + {file = "charset_normalizer-3.1.0-cp37-cp37m-win32.whl", hash = "sha256:4155b51ae05ed47199dc5b2a4e62abccb274cee6b01da5b895099b61b1982974"}, + {file = "charset_normalizer-3.1.0-cp37-cp37m-win_amd64.whl", hash = "sha256:322102cdf1ab682ecc7d9b1c5eed4ec59657a65e1c146a0da342b78f4112db23"}, + {file = "charset_normalizer-3.1.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:e633940f28c1e913615fd624fcdd72fdba807bf53ea6925d6a588e84e1151531"}, + {file = "charset_normalizer-3.1.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:3a06f32c9634a8705f4ca9946d667609f52cf130d5548881401f1eb2c39b1e2c"}, + {file = "charset_normalizer-3.1.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:7381c66e0561c5757ffe616af869b916c8b4e42b367ab29fedc98481d1e74e14"}, + {file = "charset_normalizer-3.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3573d376454d956553c356df45bb824262c397c6e26ce43e8203c4c540ee0acb"}, + {file = "charset_normalizer-3.1.0-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e89df2958e5159b811af9ff0f92614dabf4ff617c03a4c1c6ff53bf1c399e0e1"}, + {file = "charset_normalizer-3.1.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:78cacd03e79d009d95635e7d6ff12c21eb89b894c354bd2b2ed0b4763373693b"}, + {file = "charset_normalizer-3.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:de5695a6f1d8340b12a5d6d4484290ee74d61e467c39ff03b39e30df62cf83a0"}, + {file = "charset_normalizer-3.1.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1c60b9c202d00052183c9be85e5eaf18a4ada0a47d188a83c8f5c5b23252f649"}, + {file = "charset_normalizer-3.1.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:f645caaf0008bacf349875a974220f1f1da349c5dbe7c4ec93048cdc785a3326"}, + {file = "charset_normalizer-3.1.0-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:ea9f9c6034ea2d93d9147818f17c2a0860d41b71c38b9ce4d55f21b6f9165a11"}, + {file = "charset_normalizer-3.1.0-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:80d1543d58bd3d6c271b66abf454d437a438dff01c3e62fdbcd68f2a11310d4b"}, + {file = "charset_normalizer-3.1.0-cp38-cp38-musllinux_1_1_s390x.whl", hash = "sha256:73dc03a6a7e30b7edc5b01b601e53e7fc924b04e1835e8e407c12c037e81adbd"}, + {file = "charset_normalizer-3.1.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:6f5c2e7bc8a4bf7c426599765b1bd33217ec84023033672c1e9a8b35eaeaaaf8"}, + {file = "charset_normalizer-3.1.0-cp38-cp38-win32.whl", hash = "sha256:12a2b561af122e3d94cdb97fe6fb2bb2b82cef0cdca131646fdb940a1eda04f0"}, + {file = "charset_normalizer-3.1.0-cp38-cp38-win_amd64.whl", hash = "sha256:3160a0fd9754aab7d47f95a6b63ab355388d890163eb03b2d2b87ab0a30cfa59"}, + {file = "charset_normalizer-3.1.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:38e812a197bf8e71a59fe55b757a84c1f946d0ac114acafaafaf21667a7e169e"}, + {file = "charset_normalizer-3.1.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:6baf0baf0d5d265fa7944feb9f7451cc316bfe30e8df1a61b1bb08577c554f31"}, + {file = "charset_normalizer-3.1.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:8f25e17ab3039b05f762b0a55ae0b3632b2e073d9c8fc88e89aca31a6198e88f"}, + {file = "charset_normalizer-3.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3747443b6a904001473370d7810aa19c3a180ccd52a7157aacc264a5ac79265e"}, + {file = "charset_normalizer-3.1.0-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b116502087ce8a6b7a5f1814568ccbd0e9f6cfd99948aa59b0e241dc57cf739f"}, + {file = "charset_normalizer-3.1.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d16fd5252f883eb074ca55cb622bc0bee49b979ae4e8639fff6ca3ff44f9f854"}, + {file = "charset_normalizer-3.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:21fa558996782fc226b529fdd2ed7866c2c6ec91cee82735c98a197fae39f706"}, + {file = "charset_normalizer-3.1.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6f6c7a8a57e9405cad7485f4c9d3172ae486cfef1344b5ddd8e5239582d7355e"}, + {file = "charset_normalizer-3.1.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:ac3775e3311661d4adace3697a52ac0bab17edd166087d493b52d4f4f553f9f0"}, + {file = "charset_normalizer-3.1.0-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:10c93628d7497c81686e8e5e557aafa78f230cd9e77dd0c40032ef90c18f2230"}, + {file = "charset_normalizer-3.1.0-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:6f4f4668e1831850ebcc2fd0b1cd11721947b6dc7c00bf1c6bd3c929ae14f2c7"}, + {file = "charset_normalizer-3.1.0-cp39-cp39-musllinux_1_1_s390x.whl", hash = "sha256:0be65ccf618c1e7ac9b849c315cc2e8a8751d9cfdaa43027d4f6624bd587ab7e"}, + {file = "charset_normalizer-3.1.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:53d0a3fa5f8af98a1e261de6a3943ca631c526635eb5817a87a59d9a57ebf48f"}, + {file = "charset_normalizer-3.1.0-cp39-cp39-win32.whl", hash = "sha256:a04f86f41a8916fe45ac5024ec477f41f886b3c435da2d4e3d2709b22ab02af1"}, + {file = "charset_normalizer-3.1.0-cp39-cp39-win_amd64.whl", hash = "sha256:830d2948a5ec37c386d3170c483063798d7879037492540f10a475e3fd6f244b"}, + {file = "charset_normalizer-3.1.0-py3-none-any.whl", hash = "sha256:3d9098b479e78c85080c98e1e35ff40b4a31d8953102bb0fd7d1b6f8a2111a3d"}, +] + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +files = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] + +[[package]] +name = "exceptiongroup" +version = "1.1.1" +description = "Backport of PEP 654 (exception groups)" +optional = false +python-versions = ">=3.7" +files = [ + {file = "exceptiongroup-1.1.1-py3-none-any.whl", hash = "sha256:232c37c63e4f682982c8b6459f33a8981039e5fb8756b2074364e5055c498c9e"}, + {file = "exceptiongroup-1.1.1.tar.gz", hash = "sha256:d484c3090ba2889ae2928419117447a14daf3c1231d5e30d0aae34f354f01785"}, +] + +[package.extras] +test = ["pytest (>=6)"] + +[[package]] +name = "faker" +version = "18.10.1" +description = "Faker is a Python package that generates fake data for you." +optional = false +python-versions = ">=3.7" +files = [ + {file = "Faker-18.10.1-py3-none-any.whl", hash = "sha256:633b278caa3ec239463f9139c74da2607c8da5710e56d5d7d30fc8a7440104c4"}, + {file = "Faker-18.10.1.tar.gz", hash = "sha256:d9f363720c4a6cf9884c6c3e26e2ce26266ffe5d741a9bc7cb9256779bc62190"}, +] + +[package.dependencies] +python-dateutil = ">=2.4" + +[[package]] +name = "google-auth" +version = "2.17.3" +description = "Google Authentication Library" +optional = false +python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*" +files = [ + {file = "google-auth-2.17.3.tar.gz", hash = "sha256:ce311e2bc58b130fddf316df57c9b3943c2a7b4f6ec31de9663a9333e4064efc"}, + {file = "google_auth-2.17.3-py2.py3-none-any.whl", hash = "sha256:f586b274d3eb7bd932ea424b1c702a30e0393a2e2bc4ca3eae8263ffd8be229f"}, +] + +[package.dependencies] +cachetools = ">=2.0.0,<6.0" +pyasn1-modules = ">=0.2.1" +rsa = {version = ">=3.1.4,<5", markers = "python_version >= \"3.6\""} +six = ">=1.9.0" + +[package.extras] +aiohttp = ["aiohttp (>=3.6.2,<4.0.0dev)", "requests (>=2.20.0,<3.0.0dev)"] +enterprise-cert = ["cryptography (==36.0.2)", "pyopenssl (==22.0.0)"] +pyopenssl = ["cryptography (>=38.0.3)", "pyopenssl (>=20.0.0)"] +reauth = ["pyu2f (>=0.1.5)"] +requests = ["requests (>=2.20.0,<3.0.0dev)"] + +[[package]] +name = "idna" +version = "3.4" +description = "Internationalized Domain Names in Applications (IDNA)" +optional = false +python-versions = ">=3.5" +files = [ + {file = "idna-3.4-py3-none-any.whl", hash = "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"}, + {file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"}, +] + +[[package]] +name = "iniconfig" +version = "2.0.0" +description = "brain-dead simple config-ini parsing" +optional = false +python-versions = ">=3.7" +files = [ + {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, + {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, +] + +[[package]] +name = "kubernetes" +version = "26.1.0" +description = "Kubernetes python client" +optional = false +python-versions = ">=3.6" +files = [ + {file = "kubernetes-26.1.0-py2.py3-none-any.whl", hash = "sha256:e3db6800abf7e36c38d2629b5cb6b74d10988ee0cba6fba45595a7cbe60c0042"}, + {file = "kubernetes-26.1.0.tar.gz", hash = "sha256:5854b0c508e8d217ca205591384ab58389abdae608576f9c9afc35a3c76a366c"}, +] + +[package.dependencies] +certifi = ">=14.05.14" +google-auth = ">=1.0.1" +python-dateutil = ">=2.5.3" +pyyaml = ">=5.4.1" +requests = "*" +requests-oauthlib = "*" +setuptools = ">=21.0.0" +six = ">=1.9.0" +urllib3 = ">=1.24.2" +websocket-client = ">=0.32.0,<0.40.0 || >0.40.0,<0.41.dev0 || >=0.43.dev0" + +[package.extras] +adal = ["adal (>=1.0.2)"] + +[[package]] +name = "oauthlib" +version = "3.2.2" +description = "A generic, spec-compliant, thorough implementation of the OAuth request-signing logic" +optional = false +python-versions = ">=3.6" +files = [ + {file = "oauthlib-3.2.2-py3-none-any.whl", hash = "sha256:8139f29aac13e25d502680e9e19963e83f16838d48a0d71c287fe40e7067fbca"}, + {file = "oauthlib-3.2.2.tar.gz", hash = "sha256:9859c40929662bec5d64f34d01c99e093149682a3f38915dc0655d5a633dd918"}, +] + +[package.extras] +rsa = ["cryptography (>=3.0.0)"] +signals = ["blinker (>=1.4.0)"] +signedtoken = ["cryptography (>=3.0.0)", "pyjwt (>=2.0.0,<3)"] + +[[package]] +name = "packaging" +version = "23.1" +description = "Core utilities for Python packages" +optional = false +python-versions = ">=3.7" +files = [ + {file = "packaging-23.1-py3-none-any.whl", hash = "sha256:994793af429502c4ea2ebf6bf664629d07c1a9fe974af92966e4b8d2df7edc61"}, + {file = "packaging-23.1.tar.gz", hash = "sha256:a392980d2b6cffa644431898be54b0045151319d1e7ec34f0cfed48767dd334f"}, +] + +[[package]] +name = "pluggy" +version = "1.0.0" +description = "plugin and hook calling mechanisms for python" +optional = false +python-versions = ">=3.6" +files = [ + {file = "pluggy-1.0.0-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"}, + {file = "pluggy-1.0.0.tar.gz", hash = "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"}, +] + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] + +[[package]] +name = "pyasn1" +version = "0.5.0" +description = "Pure-Python implementation of ASN.1 types and DER/BER/CER codecs (X.208)" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7" +files = [ + {file = "pyasn1-0.5.0-py2.py3-none-any.whl", hash = "sha256:87a2121042a1ac9358cabcaf1d07680ff97ee6404333bacca15f76aa8ad01a57"}, + {file = "pyasn1-0.5.0.tar.gz", hash = "sha256:97b7290ca68e62a832558ec3976f15cbf911bf5d7c7039d8b861c2a0ece69fde"}, +] + +[[package]] +name = "pyasn1-modules" +version = "0.3.0" +description = "A collection of ASN.1-based protocols modules" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7" +files = [ + {file = "pyasn1_modules-0.3.0-py2.py3-none-any.whl", hash = "sha256:d3ccd6ed470d9ffbc716be08bd90efbd44d0734bc9303818f7336070984a162d"}, + {file = "pyasn1_modules-0.3.0.tar.gz", hash = "sha256:5bd01446b736eb9d31512a30d46c1ac3395d676c6f3cafa4c03eb54b9925631c"}, +] + +[package.dependencies] +pyasn1 = ">=0.4.6,<0.6.0" + +[[package]] +name = "pytest" +version = "7.3.1" +description = "pytest: simple powerful testing with Python" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-7.3.1-py3-none-any.whl", hash = "sha256:3799fa815351fea3a5e96ac7e503a96fa51cc9942c3753cda7651b93c1cfa362"}, + {file = "pytest-7.3.1.tar.gz", hash = "sha256:434afafd78b1d78ed0addf160ad2b77a30d35d4bdf8af234fe621919d9ed15e3"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} +exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=0.12,<2.0" +tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} + +[package.extras] +testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "xmlschema"] + +[[package]] +name = "python-dateutil" +version = "2.8.2" +description = "Extensions to the standard Python datetime module" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" +files = [ + {file = "python-dateutil-2.8.2.tar.gz", hash = "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86"}, + {file = "python_dateutil-2.8.2-py2.py3-none-any.whl", hash = "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"}, +] + +[package.dependencies] +six = ">=1.5" + +[[package]] +name = "pyyaml" +version = "6.0" +description = "YAML parser and emitter for Python" +optional = false +python-versions = ">=3.6" +files = [ + {file = "PyYAML-6.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d4db7c7aef085872ef65a8fd7d6d09a14ae91f691dec3e87ee5ee0539d516f53"}, + {file = "PyYAML-6.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9df7ed3b3d2e0ecfe09e14741b857df43adb5a3ddadc919a2d94fbdf78fea53c"}, + {file = "PyYAML-6.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:77f396e6ef4c73fdc33a9157446466f1cff553d979bd00ecb64385760c6babdc"}, + {file = "PyYAML-6.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a80a78046a72361de73f8f395f1f1e49f956c6be882eed58505a15f3e430962b"}, + {file = "PyYAML-6.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:f84fbc98b019fef2ee9a1cb3ce93e3187a6df0b2538a651bfb890254ba9f90b5"}, + {file = "PyYAML-6.0-cp310-cp310-win32.whl", hash = "sha256:2cd5df3de48857ed0544b34e2d40e9fac445930039f3cfe4bcc592a1f836d513"}, + {file = "PyYAML-6.0-cp310-cp310-win_amd64.whl", hash = "sha256:daf496c58a8c52083df09b80c860005194014c3698698d1a57cbcfa182142a3a"}, + {file = "PyYAML-6.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:d4b0ba9512519522b118090257be113b9468d804b19d63c71dbcf4a48fa32358"}, + {file = "PyYAML-6.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:81957921f441d50af23654aa6c5e5eaf9b06aba7f0a19c18a538dc7ef291c5a1"}, + {file = "PyYAML-6.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:afa17f5bc4d1b10afd4466fd3a44dc0e245382deca5b3c353d8b757f9e3ecb8d"}, + {file = "PyYAML-6.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:dbad0e9d368bb989f4515da330b88a057617d16b6a8245084f1b05400f24609f"}, + {file = "PyYAML-6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:432557aa2c09802be39460360ddffd48156e30721f5e8d917f01d31694216782"}, + {file = "PyYAML-6.0-cp311-cp311-win32.whl", hash = "sha256:bfaef573a63ba8923503d27530362590ff4f576c626d86a9fed95822a8255fd7"}, + {file = "PyYAML-6.0-cp311-cp311-win_amd64.whl", hash = "sha256:01b45c0191e6d66c470b6cf1b9531a771a83c1c4208272ead47a3ae4f2f603bf"}, + {file = "PyYAML-6.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:897b80890765f037df3403d22bab41627ca8811ae55e9a722fd0392850ec4d86"}, + {file = "PyYAML-6.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:50602afada6d6cbfad699b0c7bb50d5ccffa7e46a3d738092afddc1f9758427f"}, + {file = "PyYAML-6.0-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:48c346915c114f5fdb3ead70312bd042a953a8ce5c7106d5bfb1a5254e47da92"}, + {file = "PyYAML-6.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:98c4d36e99714e55cfbaaee6dd5badbc9a1ec339ebfc3b1f52e293aee6bb71a4"}, + {file = "PyYAML-6.0-cp36-cp36m-win32.whl", hash = "sha256:0283c35a6a9fbf047493e3a0ce8d79ef5030852c51e9d911a27badfde0605293"}, + {file = "PyYAML-6.0-cp36-cp36m-win_amd64.whl", hash = "sha256:07751360502caac1c067a8132d150cf3d61339af5691fe9e87803040dbc5db57"}, + {file = "PyYAML-6.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:819b3830a1543db06c4d4b865e70ded25be52a2e0631ccd2f6a47a2822f2fd7c"}, + {file = "PyYAML-6.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:473f9edb243cb1935ab5a084eb238d842fb8f404ed2193a915d1784b5a6b5fc0"}, + {file = "PyYAML-6.0-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0ce82d761c532fe4ec3f87fc45688bdd3a4c1dc5e0b4a19814b9009a29baefd4"}, + {file = "PyYAML-6.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:231710d57adfd809ef5d34183b8ed1eeae3f76459c18fb4a0b373ad56bedcdd9"}, + {file = "PyYAML-6.0-cp37-cp37m-win32.whl", hash = "sha256:c5687b8d43cf58545ade1fe3e055f70eac7a5a1a0bf42824308d868289a95737"}, + {file = "PyYAML-6.0-cp37-cp37m-win_amd64.whl", hash = "sha256:d15a181d1ecd0d4270dc32edb46f7cb7733c7c508857278d3d378d14d606db2d"}, + {file = "PyYAML-6.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:0b4624f379dab24d3725ffde76559cff63d9ec94e1736b556dacdfebe5ab6d4b"}, + {file = "PyYAML-6.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:213c60cd50106436cc818accf5baa1aba61c0189ff610f64f4a3e8c6726218ba"}, + {file = "PyYAML-6.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9fa600030013c4de8165339db93d182b9431076eb98eb40ee068700c9c813e34"}, + {file = "PyYAML-6.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:277a0ef2981ca40581a47093e9e2d13b3f1fbbeffae064c1d21bfceba2030287"}, + {file = "PyYAML-6.0-cp38-cp38-win32.whl", hash = "sha256:d4eccecf9adf6fbcc6861a38015c2a64f38b9d94838ac1810a9023a0609e1b78"}, + {file = "PyYAML-6.0-cp38-cp38-win_amd64.whl", hash = "sha256:1e4747bc279b4f613a09eb64bba2ba602d8a6664c6ce6396a4d0cd413a50ce07"}, + {file = "PyYAML-6.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:055d937d65826939cb044fc8c9b08889e8c743fdc6a32b33e2390f66013e449b"}, + {file = "PyYAML-6.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:e61ceaab6f49fb8bdfaa0f92c4b57bcfbea54c09277b1b4f7ac376bfb7a7c174"}, + {file = "PyYAML-6.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d67d839ede4ed1b28a4e8909735fc992a923cdb84e618544973d7dfc71540803"}, + {file = "PyYAML-6.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cba8c411ef271aa037d7357a2bc8f9ee8b58b9965831d9e51baf703280dc73d3"}, + {file = "PyYAML-6.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:40527857252b61eacd1d9af500c3337ba8deb8fc298940291486c465c8b46ec0"}, + {file = "PyYAML-6.0-cp39-cp39-win32.whl", hash = "sha256:b5b9eccad747aabaaffbc6064800670f0c297e52c12754eb1d976c57e4f74dcb"}, + {file = "PyYAML-6.0-cp39-cp39-win_amd64.whl", hash = "sha256:b3d267842bf12586ba6c734f89d1f5b871df0273157918b0ccefa29deb05c21c"}, + {file = "PyYAML-6.0.tar.gz", hash = "sha256:68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a2"}, +] + +[[package]] +name = "requests" +version = "2.31.0" +description = "Python HTTP for Humans." +optional = false +python-versions = ">=3.7" +files = [ + {file = "requests-2.31.0-py3-none-any.whl", hash = "sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f"}, + {file = "requests-2.31.0.tar.gz", hash = "sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1"}, +] + +[package.dependencies] +certifi = ">=2017.4.17" +charset-normalizer = ">=2,<4" +idna = ">=2.5,<4" +urllib3 = ">=1.21.1,<3" + +[package.extras] +socks = ["PySocks (>=1.5.6,!=1.5.7)"] +use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] + +[[package]] +name = "requests-oauthlib" +version = "1.3.1" +description = "OAuthlib authentication support for Requests." +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +files = [ + {file = "requests-oauthlib-1.3.1.tar.gz", hash = "sha256:75beac4a47881eeb94d5ea5d6ad31ef88856affe2332b9aafb52c6452ccf0d7a"}, + {file = "requests_oauthlib-1.3.1-py2.py3-none-any.whl", hash = "sha256:2577c501a2fb8d05a304c09d090d6e47c306fef15809d102b327cf8364bddab5"}, +] + +[package.dependencies] +oauthlib = ">=3.0.0" +requests = ">=2.0.0" + +[package.extras] +rsa = ["oauthlib[signedtoken] (>=3.0.0)"] + +[[package]] +name = "rsa" +version = "4.9" +description = "Pure-Python RSA implementation" +optional = false +python-versions = ">=3.6,<4" +files = [ + {file = "rsa-4.9-py3-none-any.whl", hash = "sha256:90260d9058e514786967344d0ef75fa8727eed8a7d2e43ce9f4bcf1b536174f7"}, + {file = "rsa-4.9.tar.gz", hash = "sha256:e38464a49c6c85d7f1351b0126661487a7e0a14a50f1675ec50eb34d4f20ef21"}, +] + +[package.dependencies] +pyasn1 = ">=0.1.3" + +[[package]] +name = "setuptools" +version = "67.8.0" +description = "Easily download, build, install, upgrade, and uninstall Python packages" +optional = false +python-versions = ">=3.7" +files = [ + {file = "setuptools-67.8.0-py3-none-any.whl", hash = "sha256:5df61bf30bb10c6f756eb19e7c9f3b473051f48db77fddbe06ff2ca307df9a6f"}, + {file = "setuptools-67.8.0.tar.gz", hash = "sha256:62642358adc77ffa87233bc4d2354c4b2682d214048f500964dbe760ccedf102"}, +] + +[package.extras] +docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-hoverxref (<2)", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (==0.8.3)", "sphinx-reredirects", "sphinxcontrib-towncrier"] +testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pip-run (>=8.8)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-ruff", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] +testing-integration = ["build[virtualenv]", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] + +[[package]] +name = "six" +version = "1.16.0" +description = "Python 2 and 3 compatibility utilities" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" +files = [ + {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, + {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, +] + +[[package]] +name = "tomli" +version = "2.0.1" +description = "A lil' TOML parser" +optional = false +python-versions = ">=3.7" +files = [ + {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, + {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, +] + +[[package]] +name = "urllib3" +version = "2.0.3" +description = "HTTP library with thread-safe connection pooling, file post, and more." +optional = false +python-versions = ">=3.7" +files = [ + {file = "urllib3-2.0.3-py3-none-any.whl", hash = "sha256:48e7fafa40319d358848e1bc6809b208340fafe2096f1725d05d67443d0483d1"}, + {file = "urllib3-2.0.3.tar.gz", hash = "sha256:bee28b5e56addb8226c96f7f13ac28cb4c301dd5ea8a6ca179c0b9835e032825"}, +] + +[package.extras] +brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)"] +secure = ["certifi", "cryptography (>=1.9)", "idna (>=2.0.0)", "pyopenssl (>=17.1.0)", "urllib3-secure-extra"] +socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] +zstd = ["zstandard (>=0.18.0)"] + +[[package]] +name = "websocket-client" +version = "1.5.2" +description = "WebSocket client for Python with low level API options" +optional = false +python-versions = ">=3.7" +files = [ + {file = "websocket-client-1.5.2.tar.gz", hash = "sha256:c7d67c13b928645f259d9b847ab5b57fd2d127213ca41ebd880de1f553b7c23b"}, + {file = "websocket_client-1.5.2-py3-none-any.whl", hash = "sha256:f8c64e28cd700e7ba1f04350d66422b6833b82a796b525a51e740b8cc8dab4b1"}, +] + +[package.extras] +docs = ["Sphinx (>=3.4)", "sphinx-rtd-theme (>=0.5)"] +optional = ["python-socks", "wsaccel"] +test = ["websockets"] + +[metadata] +lock-version = "2.0" +python-versions = "^3.10" +content-hash = "d82f67b975ee77ff34728b6829aa4231627424598842d7c18e9b804246d9da75" diff --git a/test/e2e/pyproject.toml b/test/e2e/pyproject.toml new file mode 100644 index 000000000..e0fc3a12e --- /dev/null +++ b/test/e2e/pyproject.toml @@ -0,0 +1,20 @@ +[tool.poetry] +name = "akri-e2e" +version = "0.10.10" +description = "Akri end to end test framework" +authors = ["Nicolas Belouin "] +license = "Apache 2.0" +readme = "README.md" +packages = [{include = "akri_e2e"}] + +[tool.poetry.dependencies] +python = "^3.10" +pytest = "^7.3.1" +kubernetes = "^26.1.0" +pyyaml = "^6.0" +faker = "^18.10.1" + + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/test/e2e/test_core.py b/test/e2e/test_core.py new file mode 100644 index 000000000..21a8eb7da --- /dev/null +++ b/test/e2e/test_core.py @@ -0,0 +1,160 @@ +from pathlib import Path + +import yaml +import pytest +import kubernetes + +from helpers import ( + check_akri_is_healthy, + assert_akri_instances_present, + assert_broker_pods_running, + assert_svc_present, + get_agent_logs, +) + +discovery_handlers = ["debugEcho"] + + +@pytest.fixture(scope="module") +def basic_config(akri_version): + with open(Path(__file__).parent / "yaml/debugEchoConfiguration.yaml") as f: + body = yaml.safe_load(f) + client = kubernetes.client.CustomObjectsApi() + version = f'v{akri_version.split(".")[0]}' + client.create_namespaced_custom_object( + "akri.sh", version, "default", "configurations", body + ) + yield body["metadata"]["name"] + client.delete_namespaced_custom_object( + "akri.sh", version, "default", "configurations", body["metadata"]["name"] + ) + + +def test_crd_applied(): + v1_ext = kubernetes.client.ApiextensionsV1Api() + current_crds = [ + x["spec"]["names"]["kind"].lower() + for x in v1_ext.list_custom_resource_definition().to_dict()["items"] + if x["spec"]["group"] == "akri.sh" + ] + assert "configuration" in current_crds + assert "instance" in current_crds + + +def test_akri_healthy(): + check_akri_is_healthy(discovery_handlers) + + +def test_all_scheduled(akri_version, basic_config): + check_akri_is_healthy(discovery_handlers) + assert_akri_instances_present(akri_version, basic_config, 2) + assert_broker_pods_running(basic_config, 2) + assert_svc_present(basic_config, True, 2) + assert_svc_present(basic_config, False, 1) + + +def test_device_offline(akri_version, basic_config): + # Check we are in sane setup + assert_akri_instances_present(akri_version, basic_config, 2) + assert_broker_pods_running(basic_config, 2) + assert_svc_present(basic_config, True, 2) + assert_svc_present(basic_config, False, 1) + + v1_core = kubernetes.client.CoreV1Api() + pods = v1_core.list_namespaced_pod( + "default", + label_selector=f"app.kubernetes.io/name=akri-debug-echo-discovery", + field_selector="status.phase=Running", + ).items + base_command = ["/bin/sh", "-c"] + command = "echo {} > /tmp/debug-echo-availability.txt" + # Unplug the devices + for pod in pods: + kubernetes.stream.stream( + v1_core.connect_get_namespaced_pod_exec, + pod.metadata.name, + "default", + command=base_command + [command.format("OFFLINE")], + stdout=True, + stdin=False, + stderr=False, + tty=False, + ) + assert_akri_instances_present(akri_version, basic_config, 0) + assert_broker_pods_running(basic_config, 0) + assert_svc_present(basic_config, True, 0) + assert_svc_present(basic_config, False, 0) + # Plug them back + for pod in pods: + kubernetes.stream.stream( + v1_core.connect_get_namespaced_pod_exec, + pod.metadata.name, + "default", + command=base_command + [command.format("ONLINE")], + stdout=True, + stdin=False, + stderr=False, + tty=False, + ) + assert_akri_instances_present(akri_version, basic_config, 2) + assert_broker_pods_running(basic_config, 2) + assert_svc_present(basic_config, True, 2) + assert_svc_present(basic_config, False, 1) + + +def test_cleanup(akri_version, faker): + with open(Path(__file__).parent / "yaml/debugEchoConfiguration.yaml") as f: + body = yaml.safe_load(f) + # Change configuration name to avoid conflicting with basic_config fixture + body["metadata"]["name"] = faker.domain_word() + client = kubernetes.client.CustomObjectsApi() + version = f'v{akri_version.split(".")[0]}' + client.create_namespaced_custom_object( + "akri.sh", version, "default", "configurations", body + ) + # Wait for broker pods + config_name = body["metadata"]["name"] + assert_broker_pods_running(config_name, 2) + client.delete_namespaced_custom_object( + "akri.sh", version, "default", "configurations", config_name + ) + check_akri_is_healthy(discovery_handlers) + assert_akri_instances_present(akri_version, config_name, 0) + assert_broker_pods_running(config_name, 0) + assert_svc_present(config_name, True, 0) + assert_svc_present(config_name, False, 0) + + +def test_slot_reconciliation(): + agent_logs = get_agent_logs(since=20) + for logs in agent_logs.values(): + assert "get_node_slots - crictl called successfully" in logs + + +def test_broker_recreated_if_deleted(basic_config): + # Ensure we are in sane state + assert_broker_pods_running(basic_config, 2) + v1_core = kubernetes.client.CoreV1Api() + pods = v1_core.list_namespaced_pod( + "default", + label_selector=f"akri.sh/configuration={basic_config}", + field_selector="status.phase=Running", + ).items + + deleted_pod = v1_core.delete_namespaced_pod(pods[0].metadata.name, "default") + w = kubernetes.watch.Watch() + for e in w.stream( + v1_core.list_namespaced_pod, + "default", + field_selector=f"metadata.name={deleted_pod.metadata.name}", + resource_version=deleted_pod.metadata.resource_version, + ): + if e["type"] == "DELETED": + w.stop() + assert_broker_pods_running(basic_config, 2) + new_pods = v1_core.list_namespaced_pod( + "default", + label_selector=f"akri.sh/configuration={basic_config}", + field_selector="status.phase=Running", + ).items + assert pods[0].metadata.uid not in [pod.metadata.uid for pod in new_pods] diff --git a/test/e2e/test_webhook.py b/test/e2e/test_webhook.py new file mode 100644 index 000000000..dd88c6402 --- /dev/null +++ b/test/e2e/test_webhook.py @@ -0,0 +1,32 @@ +from pathlib import Path +from kubernetes.client.rest import ApiException + +import kubernetes +import yaml +import pytest + +discovery_handlers = ["debugEcho"] + + +def test_valid_configuration_accepted(akri_version): + with open(Path(__file__).parent / "yaml/webhookValidConfiguration.yaml") as f: + body = yaml.safe_load(f) + client = kubernetes.client.CustomObjectsApi() + version = f'v{akri_version.split(".")[0]}' + client.create_namespaced_custom_object( + "akri.sh", version, "default", "configurations", body + ) + client.delete_namespaced_custom_object( + "akri.sh", version, "default", "configurations", body["metadata"]["name"] + ) + + +def test_invalid_configuration_rejected(akri_version): + with open(Path(__file__).parent / "yaml/webhookInvalidConfiguration.yaml") as f: + body = yaml.safe_load(f) + client = kubernetes.client.CustomObjectsApi() + version = f'v{akri_version.split(".")[0]}' + with pytest.raises(ApiException): + client.create_namespaced_custom_object( + "akri.sh", version, "default", "configurations", body + ) diff --git a/test/e2e/yaml/debugEchoConfiguration.yaml b/test/e2e/yaml/debugEchoConfiguration.yaml new file mode 100644 index 000000000..9254a4fd9 --- /dev/null +++ b/test/e2e/yaml/debugEchoConfiguration.yaml @@ -0,0 +1,43 @@ +apiVersion: akri.sh/v0 +kind: Configuration +metadata: + name: akri-debug-echo-foo +spec: + discoveryHandler: + name: debugEcho + discoveryDetails: |+ + descriptions: + - bar0 + - bar1 + brokerSpec: + brokerPodSpec: + containers: + - name: akri-debug-echo-foo-broker + image: "nginx:stable-alpine" + resources: + requests: + "{{PLACEHOLDER}}" : "1" + memory: 10Mi + cpu: 10m + limits: + "{{PLACEHOLDER}}" : "1" + memory: 30Mi + cpu: 29m + instanceServiceSpec: + type: ClusterIP + ports: + - name: akri-debug-echo-foo-instance-service + port: 6052 + protocol: TCP + targetPort: 6052 + configurationServiceSpec: + type: ClusterIP + ports: + - name: akri-debug-echo-foo-configuration-service + port: 6052 + protocol: TCP + targetPort: 6052 + brokerProperties: + RESOLUTION_WIDTH: "800" + RESOLUTION_HEIGHT: "600" + capacity: 2 diff --git a/test/e2e/yaml/webhookInvalidConfiguration.yaml b/test/e2e/yaml/webhookInvalidConfiguration.yaml new file mode 100644 index 000000000..fc3a71c3a --- /dev/null +++ b/test/e2e/yaml/webhookInvalidConfiguration.yaml @@ -0,0 +1,39 @@ +apiVersion: akri.sh/v0 +kind: Configuration +metadata: + annotations: + kubectl.kubernetes.io/last-applied-configuration: "" + creationTimestamp: "2021-01-01T00:00:00Z" + generation: 1 + managedFields: [] + name: broker + uid: "00000000-0000-0000-0000-000000000000" +spec: + capacity: 1 + discoveryHandler: + name: debugEcho + discoveryDetails: | + descriptions: ["foo", "bar"] + brokerSpec: + brokerPodSpec: + resources: + limits: + "{{PLACEHOLDER}}": "1" + containers: + - name: test-broker + image: "nginx:stable-alpine" + imagePullPolicy: Always + instanceServiceSpec: + type: ClusterIP + ports: + - name: name + port: 0 + targetPort: 0 + protocol: TCP + configurationServiceSpec: + type: ClusterIP + ports: + - name: name + port: 0 + targetPort: 0 + protocol: TCP diff --git a/test/e2e/yaml/webhookValidConfiguration.yaml b/test/e2e/yaml/webhookValidConfiguration.yaml new file mode 100644 index 000000000..1f51ffae7 --- /dev/null +++ b/test/e2e/yaml/webhookValidConfiguration.yaml @@ -0,0 +1,39 @@ +apiVersion: akri.sh/v0 +kind: Configuration +metadata: + annotations: + kubectl.kubernetes.io/last-applied-configuration: "" + creationTimestamp: "2021-01-01T00:00:00Z" + generation: 1 + managedFields: [] + name: broker + uid: "00000000-0000-0000-0000-000000000000" +spec: + capacity: 1 + discoveryHandler: + name: debugEcho + discoveryDetails: | + descriptions: ["foo", "bar"] + brokerSpec: + brokerPodSpec: + containers: + - name: test-broker + image: "nginx:stable-alpine" + imagePullPolicy: Always + resources: + limits: + "{{PLACEHOLDER}}": "1" + instanceServiceSpec: + type: ClusterIP + ports: + - name: name + port: 0 + targetPort: 0 + protocol: TCP + configurationServiceSpec: + type: ClusterIP + ports: + - name: name + port: 0 + targetPort: 0 + protocol: TCP