github.com/criteo/command-launcher@v0.0.0-20230407142452-fb616f546e98/test/integration/test-manifest.sh (about) 1 #!/bin/bash 2 3 # required environment varibale 4 # CL_PATH 5 # CL_HOME 6 # OUTPUT_DIR 7 SCRIPT_DIR=${1:-$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )} 8 9 ## 10 # test yaml format manifest 11 ## 12 rm -rf $CL_HOME/dropins 13 mkdir -p $CL_HOME/dropins 14 cp -R $SCRIPT_DIR/../packages-src/yaml-manifest $CL_HOME/dropins 15 16 echo "> test YAML manifest without arguments in manifest" 17 RESULT=$($OUTPUT_DIR/cl bonjour1 world) 18 echo "$RESULT" | grep -q "bonjour! world" 19 if [ $? -eq 0 ]; then 20 echo "OK" 21 else 22 echo "KO - wrong output of bonjour command: $RESULT" 23 exit 1 24 fi 25 26 echo "> test YAML manifest with arguments in manifest" 27 RESULT=$($OUTPUT_DIR/cl bonjour2) 28 echo "$RESULT" | grep -q "bonjour! monde" 29 if [ $? -eq 0 ]; then 30 echo "OK" 31 else 32 echo "KO - wrong output of bonjour command: $RESULT" 33 exit 1 34 fi 35 36 echo "> test YAML manifest with long description" 37 RESULT=$($OUTPUT_DIR/cl help bonjour1) 38 echo "$RESULT" 39 echo "$RESULT" | grep -q "This is another line" 40 if [ $? -eq 0 ]; then 41 echo "OK" 42 else 43 echo "KO - wrong format of the long description" 44 exit 1 45 fi 46 47 echo "> test argsUsage and examples, when checkFlags=true, should have custom help message" 48 RESULT=$($OUTPUT_DIR/cl bonjour2 -h) 49 echo "$RESULT" 50 echo "$RESULT" | grep -q "bonjour2 name" 51 if [ $? -eq 0 ]; then 52 echo "OK" 53 else 54 echo "KO - wrong format of custom help message" 55 exit 1 56 fi 57 58 echo "$RESULT" | grep -q "# Print greeting message" 59 if [ $? -eq 0 ]; then 60 echo "OK" 61 else 62 echo "KO - wrong format of example message" 63 exit 1 64 fi 65 66