#3 logic moved to supporting mtf script - merge carefully, see comment
Merged 6 years ago by jscotka. Opened 6 years ago by jscotka.

file modified
+18 -32
@@ -19,6 +19,8 @@ 

  WORKDIR="$2"

  ARTIFACTSDIR="$3"

  

+ # stored raw output

+ RAW_LOG_NAME="raw.log"

  

  # MTF exit codes

  MTF_EXIT_FAIL='125'
@@ -63,42 +65,24 @@ 

      cp -r /root/avocado/job-results/latest/test-results "$OUTDIR"/html/

  }

  

+ ## return the first artifact path that exists, or the last one otherwise

  function check_artifact {

-     # return the artifact if it exists, otherwise the fallback

-     local ARTIFACT="$1"

-     local FALLBACK="$2"

-     if [ -e "$ARTIFACT" ]; then

-         echo -n "$ARTIFACT"

-     else

-         echo -n "$FALLBACK"

-     fi

+     for ARTIFACT in "$@"; do

+         if [ -e "$ARTIFACT" ]; then

+             echo -n "$ARTIFACT"

+             return

+         fi

+     done

+     # no artifact exists, return the last path

+     echo -n "${@: -1}"

  }

  

  echo 'Running container tests'

  pushd "$WORKDIR"

- 

- # Install test dependencies if DEPS file exist, otherwise it means that there are no

- # additional depenedencies

- DEPS="requirements.sh"

- TOOLSRC="0"

- if [ -e $DEPS ]; then

-     sh $DEPS

-     TOOLSRC="$?"

- fi

- 

- # If dependencies isntallation didn't fail, run tests via

- # make test target (what is expected to exist in each container)

- if [ "$TOOLSRC" -eq "0" ]; then

-     make test

-     CHECKRC="$?"

-     if [ "$CHECKRC" -eq "0" ]; then

-         EXITCODE=0

-     else

-         EXITCODE=$MTF_EXIT_FAIL

-     fi

- else

-     EXITCODE=2

- fi

+ /usr/share/moduleframework/tools/run_them_containers_taskotron.sh   \

+     2>&1 | tee "$RAW_LOG_NAME"

+ EXITCODE="${PIPESTATUS[0]}"

+ cp "$WORKDIR/$RAW_LOG_NAME" "$ARTIFACTSDIR/$RAW_LOG_NAME"

  popd

  

  echo 'Saving container tests results...'
@@ -113,5 +97,7 @@ 

      --checkname "mtf-containers" \

      --outcome "$(sed -n 1p "$WORKDIR/outcome.tests")" \

      --note "$(sed -n 2p "$WORKDIR/outcome.tests")" \

-     --artifact "$(check_artifact "$ARTIFACTSDIR/avocado-result.tests/html/results.html" "$ARTIFACTSDIR/html/index.html")" \

+     --artifact "$(check_artifact "$ARTIFACTSDIR/avocado-result.tests/html/results.html" \

+                                  "$ARTIFACTSDIR/$RAW_LOG_NAME" \

+                                  .)" \

      --file "$WORKDIR/results.yaml"

after PR will be merged https://github.com/fedora-modularity/meta-test-family/pull/176
and package in copr will be regenerated.

this can be merged too
NOT BEFORE

So how will EXITCODE variable get populated?

1 new commit added

  • add raw log output and store them to artifacts
6 years ago

you are right. I've fixed it and also added raw log mapping similar to second taskotron task

1 new commit added

  • if raw log doesn't exist, use artifacts basedir as artifact
6 years ago

I added a fallback if raw log doesn't exist. Looks good to me, can be merged.

Pull-Request has been merged by jscotka

6 years ago
Metadata