#373 add test for yaml syntax
Merged 5 years ago by astepano. Opened 5 years ago by bgoncalv.
bgoncalv/standard-test-roles fix-yaml-syntax  into  master

file modified
+1 -1
@@ -2,7 +2,7 @@ 

  LABEL maintainer "Andrei Stepanov <astepano@redhat.com>"

  RUN yum install -y which copr-cli nss_wrapper fedora-packager wget rpmdevtools \

      gcc python3-devel redhat-rpm-config python3 python3-virtualenv python3-pip \

-     ansible python3-fmf; \

+     ansible python3-fmf yamllint; \

      yum clean all; \

      rm -rf /var/cache/yum

  ENV PARAM_WDIR="/work" \

file added
+31
@@ -0,0 +1,31 @@ 

+ #!/usr/bin/bash

+ 

+ function run() {

+     # Function to show the command line it will execute,

+     # otherwise it only shows command output

+     if [[ -z $1 ]]; then

+         echo "run() requires command as argument"

+         return 1

+     fi

+     echo "Running: $1"

+     eval $1

+     return $?

+ }

+ 

+ test_path=$(readlink -f $0)

+ tests_dir=$(dirname $test_path)

+ # Use the directory above tests to search for yaml files

+ source_dir=$(dirname $tests_dir)

+ 

+ # We can make it more strict later, like yamllint -d '{extends: default, rules: {line-length: {max: 120}, indentation: disable, document-start: {level: error}}}'

+ cmd="yamllint -d '{extends: default, rules: {line-length: {max: 120}, indentation: disable}}'  ${source_dir}"

+ 

+ run "${cmd}"

+ error=$?

+ 

+ if [[ ${error} -ne 0 ]]; then

+     echo "FAIL: problem with yaml syntax"

+     exit 1

+ fi

+ 

+ exit 0

no initial comment

@astepano how can we update the docker image before running the test?

I think so. The image runs with root priv.

Commit e596b87 fixes this pull-request

Pull-Request has been merged by astepano

5 years ago

Pull-Request has been merged by astepano

5 years ago