From 4066f05a22fdba104e85f6cea27cd596e9c2ae49 Mon Sep 17 00:00:00 2001
From: gifrerenom <lluis.gifre@cttc.es>
Date: Fri, 22 Mar 2024 10:15:24 +0000
Subject: [PATCH] Gitlab CI/CD pipeline - OFC'22 & ECOC'22:

- Removed conftest settings as seem to collide with error reporting.
- Enforced re-build of docker images
---
 src/tests/ecoc22/.gitlab-ci.yml    |  8 ++--
 src/tests/ecoc22/tests/conftest.py | 63 ------------------------------
 src/tests/ofc22/.gitlab-ci.yml     |  8 ++--
 src/tests/ofc22/tests/conftest.py  | 63 ------------------------------
 4 files changed, 8 insertions(+), 134 deletions(-)
 delete mode 100644 src/tests/ecoc22/tests/conftest.py
 delete mode 100644 src/tests/ofc22/tests/conftest.py

diff --git a/src/tests/ecoc22/.gitlab-ci.yml b/src/tests/ecoc22/.gitlab-ci.yml
index a6459aebc..09718b4b9 100644
--- a/src/tests/ecoc22/.gitlab-ci.yml
+++ b/src/tests/ecoc22/.gitlab-ci.yml
@@ -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
diff --git a/src/tests/ecoc22/tests/conftest.py b/src/tests/ecoc22/tests/conftest.py
deleted file mode 100644
index 6650864b0..000000000
--- a/src/tests/ecoc22/tests/conftest.py
+++ /dev/null
@@ -1,63 +0,0 @@
-# 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)
diff --git a/src/tests/ofc22/.gitlab-ci.yml b/src/tests/ofc22/.gitlab-ci.yml
index 98caf3b09..013a389bc 100644
--- a/src/tests/ofc22/.gitlab-ci.yml
+++ b/src/tests/ofc22/.gitlab-ci.yml
@@ -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
diff --git a/src/tests/ofc22/tests/conftest.py b/src/tests/ofc22/tests/conftest.py
deleted file mode 100644
index 6650864b0..000000000
--- a/src/tests/ofc22/tests/conftest.py
+++ /dev/null
@@ -1,63 +0,0 @@
-# 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)
-- 
GitLab