Commit 15fd8497 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Initial try of integration tests

parent 63caa199
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ stages:
  - test
  - dependencies
  - deploy
  - integration_test

# include the individual .gitlab-ci.yml of each micro-service
include: 
@@ -11,3 +12,4 @@ include:
  #- local: '/src/monitoring/.gitlab-ci.yml'
  - local: '/src/context/.gitlab-ci.yml'
  - local: '/src/device/.gitlab-ci.yml'
  - local: '/src/integration_tester/.gitlab-ci.yml'
+3 −0
Original line number Diff line number Diff line
@@ -5,3 +5,6 @@

#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
+13 −0
Original line number Diff line number Diff line
@@ -28,3 +28,16 @@ def validate_topology(message):
    assert 'topoId' in message
    assert 'device' in message
    assert 'link' in message

def validate_topology_is_empty(message):
    validate_topology(message)
    assert len(message['device']) == 0
    assert len(message['link']) == 0

def validate_topology_has_devices(message):
    validate_topology(message)
    assert len(message['device']) > 0

def validate_topology_has_links(message):
    validate_topology(message)
    assert len(message['link']) > 0

src/context/tests/Dockerfile

deleted100644 → 0
+0 −4
Original line number Diff line number Diff line
FROM context:latest

# Run integration tests
ENTRYPOINT ["pytest", "-v", "--log-level=DEBUG", "context/tests/test_integration.py"]
+0 −24
Original line number Diff line number Diff line
#import logging, os, pytest, sys
#
#from pathlib import Path
#sys.path.append(__file__.split('src')[0] + 'src')
#print(sys.path)
#
#from context.client.ContextClient import ContextClient
#from context.proto.context_pb2 import Empty
#from .tools.ValidateTopology import validate_topology_dict
#
#LOGGER = logging.getLogger(__name__)
#LOGGER.setLevel(logging.DEBUG)
#
#@pytest.fixture(scope='session')
#def remote_context_client():
#    address = os.environ.get('TEST_TARGET_ADDRESS')
#    if(address is None): raise Exception('EnvironmentVariable(TEST_TARGET_ADDRESS) not specified')
#    port = os.environ.get('TEST_TARGET_PORT')
#    if(port is None): raise Exception('EnvironmentVariable(TEST_TARGET_PORT) not specified')
#    return ContextClient(address=address, port=port)
#
#def test_remote_get_topology(remote_context_client):
#    response = remote_context_client.GetTopology(Empty())
#    validate_topology_dict(response)
Loading