Skip to content

Commit

Permalink
Add more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacome committed Nov 9, 2021
1 parent 338252b commit 52876ef
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
15 changes: 4 additions & 11 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
"""Describe overall framework configuration."""

import os
import pytest

import pytest
from kubernetes.config.kube_config import KUBE_CONFIG_DEFAULT_LOCATION
from settings import (
DEFAULT_IMAGE,
DEFAULT_PULL_POLICY,
DEFAULT_IC_TYPE,
DEFAULT_SERVICE,
DEFAULT_DEPLOYMENT_TYPE,
NUM_REPLICAS,
BATCH_START,
BATCH_RESOURCES,
)
from settings import (BATCH_RESOURCES, BATCH_START, DEFAULT_DEPLOYMENT_TYPE,
DEFAULT_IC_TYPE, DEFAULT_IMAGE, DEFAULT_PULL_POLICY,
DEFAULT_SERVICE, NUM_REPLICAS)
from suite.resources_utils import get_first_pod_name


Expand Down
11 changes: 8 additions & 3 deletions tests/suite/vs_vsr_resources_utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""Describe methods to utilize the VS/VSR resources."""

import yaml
import logging
from kubernetes.client import CustomObjectsApi, ApiextensionsV1Api, CoreV1Api

import yaml
from kubernetes.client import CoreV1Api, CustomObjectsApi
from kubernetes.client.rest import ApiException
from suite.custom_resources_utils import read_custom_resource
from suite.resources_utils import ensure_item_removal, get_file_contents
Expand Down Expand Up @@ -99,18 +100,22 @@ def patch_virtual_server_from_yaml(
:param namespace:
:return:
"""
print(f"Update a VirtualServer: {name}")
print(f"Update a VirtualServer: {name}, namespace: {namespace}")
with open(yaml_manifest) as f:
dep = yaml.safe_load(f)

try:
print(f"Try to patch VirtualServer: {dep}")
custom_objects.patch_namespaced_custom_object(
"k8s.nginx.org", "v1", namespace, "virtualservers", name, dep
)
print(f"VirtualServer updated with name '{dep['metadata']['name']}'")
except ApiException:
logging.exception(f"Failed with exception while patching VirtualServer: {name}")
raise
except Exception as ex:
logging.exception(f"Failed with exception while patching VirtualServer: {name}, Exception: {ex.with_traceback}")
raise


def delete_and_create_vs_from_yaml(
Expand Down

0 comments on commit 52876ef

Please sign in to comment.