Commit 9c16633a authored by Nikos Psaromanolakis's avatar Nikos Psaromanolakis
Browse files

possible fix

parent 25bd60e2
Loading
Loading
Loading
Loading
Loading
+77 −9
Changes for .gitlab-ci.yml: 77 added lines, 9 removed lines.
Original line number Diff line number Diff line
@@ -17,27 +17,87 @@ cache:
.karate_test_template:
  stage: test
  timeout: 30 minutes

  tags:
    - hypo

  variables:
    CHROME_BIN: "/usr/bin/chromium"
    CHROMEDRIVER_BIN: "/usr/bin/chromedriver"

  before_script:
    - mvn -version

    # Install Chromium and the matching ChromeDriver.
    - apt-get update -qq
    - >
      apt-get install
      -y
      -qq
      --no-install-recommends
      chromium
      chromium-driver
      curl

    # -------------------------------------------------------------
    # Fix the GitLab Runner hostname resolution problem.
    #
    # This addresses:
    # java.net.UnknownHostException:
    # runner-... Temporary failure in name resolution
    # -------------------------------------------------------------
    - |
      RUNNER_HOSTNAME="$(hostname)"
      RUNNER_IP="$(hostname -I | awk '{print $1}')"

      echo "Runner hostname: ${RUNNER_HOSTNAME}"
      echo "Runner IP: ${RUNNER_IP}"

      if ! getent hosts "${RUNNER_HOSTNAME}" > /dev/null 2>&1; then
        echo "${RUNNER_IP:-127.0.0.1} ${RUNNER_HOSTNAME}" >> /etc/hosts
      fi

      echo "Hostname resolution:"
      getent hosts "${RUNNER_HOSTNAME}"

    # Display browser and driver versions.
    - chromium --version
    - chromedriver --version

    # Verify that both executables exist.
    - test -x "$CHROME_BIN"
    - test -x "$CHROMEDRIVER_BIN"

    # Verify that Chromium can start in the runner.
    - |
      chromium \
        --headless=new \
        --no-sandbox \
        --disable-dev-shm-usage \
        --dump-dom \
        about:blank \
        > /tmp/chromium-smoke-test.html

    - mvn -q validate
    - mvn -q test-compile

    # Validate the Karate syntax without executing the tests.
    - mvn -q test "-Dkarate.options=--dryrun"
    - apt-get update -qq
    - apt-get install -y -qq chromium-browser xvfb
    # Start virtual display
    - Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
    - sleep 2

  script:
    #  KARATE_OPTIONS injected by each job
    - mvn test -Dkarate.env="$KARATE_ENV" "-Dkarate.options=$KARATE_OPTIONS"
    - >
      mvn test
      -Dkarate.env="$KARATE_ENV"
      "-Dkarate.options=$KARATE_OPTIONS"

  artifacts:
    when: always
    expire_in: 14 days

    paths:
      - target/karate-reports/
      - target/surefire-reports/

    reports:
      junit:
        - target/surefire-reports/TEST-*.xml
@@ -72,13 +132,21 @@ nightly_regression:
      when: on_success
    - when: never


# 4) Full regression on this branch
regression_portal:
  extends: .karate_test_template

  variables:
    KARATE_OPTIONS: "--tags @portal-login-test"

    # This must correspond to:
    # src/test/java/env/dev-etsi.json
    KARATE_ENV: "dev-etsi"

  rules:
    - if: '$CI_COMMIT_BRANCH == "portal-and-stress-test" && $CI_PIPELINE_SOURCE == "push"'
    - if: >
        $CI_COMMIT_BRANCH == "portal-and-stress-test" &&
        $CI_PIPELINE_SOURCE == "push"
      when: on_success

    - when: never
 No newline at end of file
+739 −119

File changed.

Preview size limit exceeded, changes collapsed.