From 732258ad62c6e17e219857970b27da7c2780ab5b Mon Sep 17 00:00:00 2001 From: Jean-Francois Smigielski Date: Mon, 15 Oct 2018 11:26:43 +0200 Subject: [PATCH] ci: Test the JSON output --- .travis.yml | 12 ++++++++++-- tools/cycle.sh | 17 +++++++++++++++++ tools/gridinit-genconf.sh | 32 ++++++++++++++++++++++---------- 3 files changed, 49 insertions(+), 12 deletions(-) create mode 100755 tools/cycle.sh diff --git a/.travis.yml b/.travis.yml index fded9ac..64b0ee6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,14 +4,22 @@ language: c install: - sudo apt-get install -y --force-yes gcc make cmake libglib2.0-dev - sudo apt-get install -y --force-yes autoconf automake libtool xutils-dev + - sudo apt-get install -y --force-yes jq env: matrix: - BUILD_TYPE=Debug - BUILD_TYPE=Release -script: +before_script: - set -e - mkdir /tmp/oio - - export CMAKE_OPTS='-DCMAKE_INSTALL_PREFIX=/tmp/oio -DLD_LIBDIR=lib' + - export CMAKE_OPTS='-DCMAKE_INSTALL_PREFIX=/tmp/ROOT' - cmake ${CMAKE_OPTS} -DCMAKE_BUILD_TYPE=$BUILD_TYPE . - make all - make install +script: + - set -e + - export PATH="$PATH:/tmp/ROOT/bin" TMPDIR=/tmp + - ./tools/gridinit-genconf.sh 15 + - gridinit -d -s gridinit /tmp/gridinit/gridinit.conf + - ./tools/cycle.sh + - pkill gridinit diff --git a/tools/cycle.sh b/tools/cycle.sh new file mode 100755 index 0000000..44b2181 --- /dev/null +++ b/tools/cycle.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +set -e +set -x + +CMD="gridinit_cmd -S /tmp/gridinit/gridinit.sock" + +$CMD -f json status | jq + +for G in @test-0 @test-1 '' '@test-0 @test-1' ; do + $CMD status $G + $CMD stop $G + $CMD start $G + $CMD status $G +done + +$CMD -f json status | jq + diff --git a/tools/gridinit-genconf.sh b/tools/gridinit-genconf.sh index f81a5f1..65fe75d 100755 --- a/tools/gridinit-genconf.sh +++ b/tools/gridinit-genconf.sh @@ -1,30 +1,42 @@ #!/usr/bin/env bash set -e -MAX=$1 -shift +set -x +MAX=$1 ; shift [[ -n "$MAX" ]] -cat > /tmp/gridinit.conf < "$BASEDIR/gridinit.conf" <> /tmp/gridinit.conf <> $BASEDIR/$sub/service-${i}.conf <