Commit 9b9cc621 authored by Ramon Nou's avatar Ramon Nou
Browse files

Merge branch 'rnou/311-optimize-testing-pipeline' into 'master'

Some minor bugs solved on the ci. 
Now integration tests can be run manually independently if the allintegration step fails.

Closes #311

See merge request !205
parents 1d6ccfd1 1904b7a3
Loading
Loading
Loading
Loading
Loading
+64 −9
Original line number Diff line number Diff line
@@ -95,17 +95,69 @@ scripts:
    reports:
      junit: ${BUILD_PATH}/tests/scripts/report.xml

## == integration tests for gkfs ===========
gkfs:allintegration:
  stage: test
  image: gekkofs/testing:0.9.4-dev
  interruptible: true
  needs: ['gkfs']

  script:
    ## run tests
    - export PATH=${PATH}:/usr/local/bin
    - mkdir -p ${BUILD_PATH}/tests/run
    - cd ${BUILD_PATH}/tests/integration
    - ${PYTEST} -v -n $(nproc)
          ${INTEGRATION_TESTS_BIN_PATH}/
          --basetemp=${BUILD_PATH}/tests/run/
          --junit-xml=report.xml

    ## capture coverage information for this test and write it to
    ## $COVERAGE_PATH/$SUBTEST.info
    - cd ${CI_PROJECT_DIR}
    # use ccache
    - /usr/sbin/update-ccache-symlinks
    - export PATH="/usr/lib/ccache:$PATH"
    - cmake --preset ci-coverage
          -DCOVERAGE_OUTPUT_DIR=${COVERAGE_PATH}
          -DCOVERAGE_CAPTURE_TRACEFILE=${COVERAGE_PATH}/integration.info
    ## Since the pipeline recreates the source tree, the access times for .gcno
    ## files are newer than those of .gcda files. This makes gcov emit a
    ## warning for each file which slows it down. Updating the timestamps
    ## avoids this
    - find ${BUILD_PATH} -name "*.gcno" -exec touch {} \;
    - cmake --build ${BUILD_PATH} --target coverage-capture

  # fix relative paths so that GitLab can find the correct files
  after_script:
    - perl -i.orig
          -pe 's%file="(.*?)"%file="tests/integration/$1"%g;'
          -pe 's%(../)+install/share/gkfs/%%g;'
          ${BUILD_PATH}/tests/integration/report.xml

  artifacts:
    expire_in: 1 week
    when: always
    paths:
      - ${BUILD_PATH}
    reports:
      junit: ${BUILD_PATH}/tests/integration/report.xml

## == integration tests for gkfs ===========
gkfs:integration:
  stage: test
  image: gekkofs/testing:0.9.4-dev
  interruptible: true
  needs: ['gkfs']
  needs: ['gkfs']  # we need to remove gkfs dependencies on manual
  parallel:
    matrix:
      - SUBTEST: [ data, status, syscalls, directories, operations, position, shell, rename ]

  rules:
    - if: '$CI_MERGE_REQUEST_EVENT_TYPE == "detached"'
      when: never
    - if: '$CI_MERGE_REQUEST_ID != ""'
      when: manual
      allow_failure: true
  script:
    ## run tests
    - export PATH=${PATH}:/usr/local/bin
@@ -135,7 +187,7 @@ gkfs:integration:
  # fix relative paths so that GitLab can find the correct files
  after_script:
    - perl -i.orig
          -pe 's%file="(.*?)"%file="tests/integration/$1"%;'
          -pe 's%file="(.*?)"%file="tests/integration/$1"%g;'
          -pe 's%(../)+install/share/gkfs/%%g;'
          ${BUILD_PATH}/tests/integration/report.xml

@@ -157,8 +209,12 @@ gkfwd:integration:
  parallel:
    matrix:
      - SUBTEST: [ forwarding ]
 # rules:
 #   - when: never
  rules:
    - if: '$CI_MERGE_REQUEST_EVENT_TYPE == "detached"'
      when: never
    - if: '$CI_MERGE_REQUEST_ID != ""'
      when: manual
      allow_failure: true

  script:
    ## run tests
@@ -188,7 +244,7 @@ gkfwd:integration:
  # fix relative paths so that GitLab can find the correct files
  after_script:
    - perl -i.orig
          -pe 's%file="(.*?)"%file="tests/integration/$1"%;'
          -pe 's%file="(.*?)"%file="tests/integration/$1"%g;'
          -pe 's%(../)+install/share/gkfs/%%g;'
          ${BUILD_PATH}/tests/integration/report.xml

@@ -309,9 +365,8 @@ coverage:baseline:
coverage:
  stage: report
  image: gekkofs/testing:0.9.4-dev
#  needs: [ 'coverage:baseline', 'gkfs:integration', 'gkfwd:integration',
#           'gkfs:unit' ]
  needs: [ 'coverage:baseline', 'gkfs:integration', 'gkfs:unit', 'gkfwd:integration']
  #needs: [ 'coverage:baseline', 'gkfs:integration', 'gkfs:unit', 'gkfwd:integration']
  needs: [ 'coverage:baseline', 'gkfs:allintegration', 'gkfs:unit']
  script:
      # use ccache
    - ccache --zero-stats
+10 −9
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ from harness.logger import logger

nonexisting = "nonexisting"

# tests can be run in parallel, so it is not safe to have the same file name

def test_two_io_nodes(gkfwd_daemon_factory, gkfwd_client_factory):
    """Write files from two clients using two daemons"""
@@ -143,10 +144,10 @@ def test_two_io_nodes_remap(gkfwd_daemon_factory, gkfwd_client_factory):
    d00 = gkfwd_daemon_factory.create()
    d01 = gkfwd_daemon_factory.create()

    c00 = gkfwd_client_factory.create('c-0')
    c01 = gkfwd_client_factory.create('c-1')
    c00 = gkfwd_client_factory.create('rc-0')
    c01 = gkfwd_client_factory.create('rc-1')

    file = d00.mountdir / "file-c00-1"
    file = d00.mountdir / "file-rc00-1"

    # create a file in gekkofs
    ret = c00.open(file,
@@ -176,7 +177,7 @@ def test_two_io_nodes_remap(gkfwd_daemon_factory, gkfwd_client_factory):
    # we need to wait for at least the number of seconds between remap calls
    time.sleep(10)

    file = d00.mountdir / "file-c00-2"
    file = d00.mountdir / "file-rc00-2"

    # open the file to write
    ret = c00.open(file,
@@ -207,10 +208,10 @@ def test_two_io_nodes_operations(gkfwd_daemon_factory, gkfwd_client_factory):
    d00 = gkfwd_daemon_factory.create()
    d01 = gkfwd_daemon_factory.create()

    c00 = gkfwd_client_factory.create('c-0')
    c01 = gkfwd_client_factory.create('c-1')
    c00 = gkfwd_client_factory.create('oc-0')
    c01 = gkfwd_client_factory.create('oc-1')

    file = d00.mountdir / "file-c00"
    file = d00.mountdir / "file-oc00"

    # create a file in gekkofs
    ret = c00.open(file,
@@ -256,7 +257,7 @@ def test_two_io_nodes_operations(gkfwd_daemon_factory, gkfwd_client_factory):

    assert len(ret.dirents) == 1

    assert ret.dirents[0].d_name == 'file-c00'
    assert ret.dirents[0].d_name == 'file-oc00'
    assert ret.dirents[0].d_type == 8 # DT_REG

    # the file should be there and accessible by the two clients
@@ -264,7 +265,7 @@ def test_two_io_nodes_operations(gkfwd_daemon_factory, gkfwd_client_factory):

    assert len(ret.dirents) == 1

    assert ret.dirents[0].d_name == 'file-c00'
    assert ret.dirents[0].d_name == 'file-oc00'
    assert ret.dirents[0].d_type == 8 # DT_REG

    with open(c00.log) as f:
+2 −2
Original line number Diff line number Diff line
@@ -99,10 +99,10 @@ def test_statx(gkfs_daemon, gkfs_client):

    # if greater zero, it is activated in config.hpp
    if ret.statbuf.stx_mtime.tv_sec > 0:
        assert (ret.statbuf.stx_mtime.tv_sec > ts)
        assert (ret.statbuf.stx_mtime.tv_sec >= ts)

    if ret.statbuf.stx_ctime.tv_sec > 0:
        assert (ret.statbuf.stx_ctime.tv_sec > ts)
        assert (ret.statbuf.stx_ctime.tv_sec >= ts)


    return