Commit 4066f05a authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Gitlab CI/CD pipeline - OFC'22 & ECOC'22:

- Removed conftest settings as seem to collide with error reporting.
- Enforced re-build of docker images
parent 4c304841
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -62,10 +62,10 @@ end2end_test ecoc22:
    #- yq -i '((select(.kind=="Deployment").spec.template.spec.containers.[] | select(.name=="server").env.[]) | select(.name=="LOG_LEVEL").value) |= "DEBUG"' manifests/sliceservice.yaml
    #- yq -i '((select(.kind=="Deployment").spec.template.spec.containers.[] | select(.name=="server").env.[]) | select(.name=="LOG_LEVEL").value) |= "DEBUG"' manifests/nbiservice.yaml
    - source src/tests/${TEST_NAME}/deploy_specs.sh
    - export TFS_REGISTRY_IMAGES="${CI_REGISTRY_IMAGE}"
    - export TFS_SKIP_BUILD="YES"
    - export TFS_IMAGE_TAG="latest"
    - echo "TFS_REGISTRY_IMAGES=${CI_REGISTRY_IMAGE}"
    #- export TFS_REGISTRY_IMAGES="${CI_REGISTRY_IMAGE}"
    #- export TFS_SKIP_BUILD="YES"
    #- export TFS_IMAGE_TAG="latest"
    #- echo "TFS_REGISTRY_IMAGES=${CI_REGISTRY_IMAGE}"

    # Deploy TeraFlowSDN
    - ./deploy/crdb.sh
+0 −63
Original line number Diff line number Diff line
# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Acknowledgement: https://stackoverflow.com/questions/46766899/pytest-timeout-fail-test-instead-killing-whole-test-run

import pytest, signal


class Termination(SystemExit):
    pass


class TimeoutExit(BaseException):
    pass


def _terminate(signum, frame):
    raise Termination("Runner is terminated from outside.")


def _timeout(signum, frame):
    raise TimeoutExit("Runner timeout is reached, runner is terminating.")


@pytest.hookimpl
def pytest_addoption(parser):
    parser.addoption(
        '--timeout', action='store', dest='timeout', type=int, default=None,
        help="number of seconds before each test failure")


@pytest.hookimpl
def pytest_configure(config):
    # Install the signal handlers that we want to process.
    signal.signal(signal.SIGTERM, _terminate)
    signal.signal(signal.SIGALRM, _timeout)


@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_protocol(item, nextitem):

    # Set the per-test timeout (an alarm signal).
    if item.config.option.timeout is not None:
        signal.alarm(item.config.option.timeout)

    try:
        # Run the setup, test body, and teardown stages.
        yield
    finally:
        # Disable the alarm when the test passes or fails.
        # I.e. when we get into the framework's body.
        signal.alarm(0)
+4 −4
Original line number Diff line number Diff line
@@ -63,10 +63,10 @@ end2end_test ofc22:
    #- yq -i '((select(.kind=="Deployment").spec.template.spec.containers.[] | select(.name=="server").env.[]) | select(.name=="LOG_LEVEL").value) |= "DEBUG"' manifests/nbiservice.yaml
    #- yq -i '((select(.kind=="Deployment").spec.template.spec.containers.[] | select(.name=="server").env.[]) | select(.name=="LOG_LEVEL").value) |= "DEBUG"' manifests/monitoringservice.yaml
    - source src/tests/${TEST_NAME}/deploy_specs.sh
    - export TFS_REGISTRY_IMAGES="${CI_REGISTRY_IMAGE}"
    - export TFS_SKIP_BUILD="YES"
    - export TFS_IMAGE_TAG="latest"
    - echo "TFS_REGISTRY_IMAGES=${CI_REGISTRY_IMAGE}"
    #- export TFS_REGISTRY_IMAGES="${CI_REGISTRY_IMAGE}"
    #- export TFS_SKIP_BUILD="YES"
    #- export TFS_IMAGE_TAG="latest"
    #- echo "TFS_REGISTRY_IMAGES=${CI_REGISTRY_IMAGE}"

    # Deploy TeraFlowSDN
    - ./deploy/crdb.sh

src/tests/ofc22/tests/conftest.py

deleted100644 → 0
+0 −63
Original line number Diff line number Diff line
# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Acknowledgement: https://stackoverflow.com/questions/46766899/pytest-timeout-fail-test-instead-killing-whole-test-run

import pytest, signal


class Termination(SystemExit):
    pass


class TimeoutExit(BaseException):
    pass


def _terminate(signum, frame):
    raise Termination("Runner is terminated from outside.")


def _timeout(signum, frame):
    raise TimeoutExit("Runner timeout is reached, runner is terminating.")


@pytest.hookimpl
def pytest_addoption(parser):
    parser.addoption(
        '--timeout', action='store', dest='timeout', type=int, default=None,
        help="number of seconds before each test failure")


@pytest.hookimpl
def pytest_configure(config):
    # Install the signal handlers that we want to process.
    signal.signal(signal.SIGTERM, _terminate)
    signal.signal(signal.SIGALRM, _timeout)


@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_protocol(item, nextitem):

    # Set the per-test timeout (an alarm signal).
    if item.config.option.timeout is not None:
        signal.alarm(item.config.option.timeout)

    try:
        # Run the setup, test body, and teardown stages.
        yield
    finally:
        # Disable the alarm when the test passes or fails.
        # I.e. when we get into the framework's body.
        signal.alarm(0)