From 3c3b2dfab31ecd1d0389bc587336f87770760e38 Mon Sep 17 00:00:00 2001 From: Lluis Gifre Date: Tue, 10 Aug 2021 13:08:42 +0200 Subject: [PATCH] Minor improvements in integration tests --- run_integration_tests.sh | 16 ++++++++-------- .../service/ContextServiceServicerImpl.py | 4 +--- src/device/service/DeviceServiceServicerImpl.py | 4 +--- src/integration_tester/.gitlab-ci.yml | 3 +-- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/run_integration_tests.sh b/run_integration_tests.sh index b9232c717..7cbbda122 100755 --- a/run_integration_tests.sh +++ b/run_integration_tests.sh @@ -1,10 +1,10 @@ #!/bin/bash -## Make folder containing the script the root folder for its execution -#cd $(dirname $0) - -#ENDPOINT=($(kubectl --namespace teraflow-development get service contextservice -o 'jsonpath={.spec.clusterIP} {.spec.ports[?(@.name=="grpc")].port}')) -#docker run -it --env TEST_TARGET_ADDRESS=${ENDPOINT[0]} --env TEST_TARGET_PORT=${ENDPOINT[1]} context_service:test - - -kubectl run integration-test --restart=Never --rm -i --tty --image centos -- /bin/bash +IMAGE_NAME='integration_tester' +IMAGE_TAG='latest' +CI_REGISTRY_IMAGE='registry.gitlab.com/teraflow-h2020/controller' + +kubectl delete pod $(echo $IMAGE_NAME | sed -r 's/[^a-zA-Z0-9\.\-]/-/g') --wait=true --ignore-not-found=true +kubectl get all +kubectl run $(echo $IMAGE_NAME | sed -r 's/[^a-zA-Z0-9\.\-]/-/g') --image "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG" --restart=Never --rm -i +kubectl get all diff --git a/src/context/service/ContextServiceServicerImpl.py b/src/context/service/ContextServiceServicerImpl.py index 765a82508..6a189d678 100644 --- a/src/context/service/ContextServiceServicerImpl.py +++ b/src/context/service/ContextServiceServicerImpl.py @@ -2,6 +2,7 @@ from typing import Dict, List, Set, Tuple import grpc, logging from prometheus_client import Counter, Histogram from common.Checkers import chk_string +from common.database.api.Constants import DEFAULT_CONTEXT_ID, DEFAULT_TOPOLOGY_ID from common.database.api.Database import Database from common.exceptions.ServiceException import ServiceException from context.proto.context_pb2 import Empty, Link, LinkId, Topology @@ -9,9 +10,6 @@ from context.proto.context_pb2_grpc import ContextServiceServicer LOGGER = logging.getLogger(__name__) -DEFAULT_CONTEXT_ID = 'admin' -DEFAULT_TOPOLOGY_ID = 'admin' - GETTOPOLOGY_COUNTER_STARTED = Counter ('context_gettopology_counter_started', 'Context:GetTopology counter of requests started' ) GETTOPOLOGY_COUNTER_COMPLETED = Counter ('context_gettopology_counter_completed', diff --git a/src/device/service/DeviceServiceServicerImpl.py b/src/device/service/DeviceServiceServicerImpl.py index 2aa135c28..71c4bfc6d 100644 --- a/src/device/service/DeviceServiceServicerImpl.py +++ b/src/device/service/DeviceServiceServicerImpl.py @@ -2,6 +2,7 @@ from typing import List, Tuple import grpc, logging from prometheus_client import Counter, Histogram from common.Checkers import chk_options, chk_string +from common.database.api.Constants import DEFAULT_CONTEXT_ID, DEFAULT_TOPOLOGY_ID from common.database.api.Database import Database from common.database.api.context.OperationalStatus import OperationalStatus, operationalstatus_enum_values, \ to_operationalstatus_enum @@ -11,9 +12,6 @@ from device.proto.device_pb2_grpc import DeviceServiceServicer LOGGER = logging.getLogger(__name__) -DEFAULT_CONTEXT_ID = 'admin' -DEFAULT_TOPOLOGY_ID = 'admin' - ADDDEVICE_COUNTER_STARTED = Counter ('device_adddevice_counter_started', 'Device:AddDevice counter of requests started' ) ADDDEVICE_COUNTER_COMPLETED = Counter ('device_adddevice_counter_completed', diff --git a/src/integration_tester/.gitlab-ci.yml b/src/integration_tester/.gitlab-ci.yml index 8068408ee..d090e73a2 100644 --- a/src/integration_tester/.gitlab-ci.yml +++ b/src/integration_tester/.gitlab-ci.yml @@ -57,8 +57,7 @@ integration_test integration_tester: - kubectl get all - kubectl delete pod $(echo $IMAGE_NAME | sed -r 's/[^a-zA-Z0-9\.\-]/-/g') --wait=true --ignore-not-found=true - kubectl get all - # --rm to remove tester when it finishes - - kubectl run $(echo $IMAGE_NAME | sed -r 's/[^a-zA-Z0-9\.\-]/-/g') --image "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG" --restart=Never -i + - kubectl run $(echo $IMAGE_NAME | sed -r 's/[^a-zA-Z0-9\.\-]/-/g') --image "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG" --restart=Never -i --rm - kubectl get all #when: manual #allow_failure: false -- GitLab