Browse Source

gestion des tests privés/public

David Sniperovitch 8 years ago
parent
commit
34b47ebee4
6 changed files with 66 additions and 20 deletions
  1. 1 1
      .gitignore
  2. 2 9
      cocktail
  3. 19 2
      test_cocktail_01
  4. 22 4
      test_cocktail_02
  5. 20 4
      test_cocktail_03
  6. 2 0
      url_test.pub.txt

+ 1 - 1
.gitignore

@@ -1,2 +1,2 @@
 *.conf
-
+url_test.priv.txt

+ 2 - 9
cocktail

@@ -113,15 +113,8 @@ mirror_pad() {
   local filename=$2
   verbose "[$FUNCNAME] url=$url filename=$filename"
 
-  if test "$TRAVIS" = "true";
-  then
-    # test only public pads (with curl) if building in travis
-    RESPONSE=$(curl --silent --show-error $url --output $filename 2>&1)
-    RC=$?
-  else
-    RESPONSE=$(perl $base/mirror_pad.pl $url > "$filename")
-    RC=$?
-  fi
+  RESPONSE=$(perl $base/mirror_pad.pl $url > "$filename")
+  RC=$?
 
   local errstr="[$FUNCNAME] RC=[$RC] $RESPONSE"
   if test "$RC" -eq 0;

+ 19 - 2
test_cocktail_01

@@ -1,7 +1,24 @@
 #!/bin/bash
+
+if test "$TRAVIS" = "true";
+then
+  URL_FILE=url_test.pub.txt
+else
+  URL_FILE=url_test.priv.txt
+fi
+
+if test -r "$URL_FILE";
+then
+  URL_BASE=$(head -n1 "$URL_FILE")
+  URL_GARDE=$(tail -n1 "$URL_FILE")
+else
+  echo "'$URL_FILE' introuvable"
+  exit 1
+fi
+
 ./cocktail -v \
            -d MonDossier \
            -p Abro2 \
-           -b 'https%3A%2F%2Fpad.exegetes.eu.org%2Fp%2Fg.DSXI1kGFT1gjor66%24Abro-REP-Tele2-Principal%2Fexport%2Ftxt' \
-           -g 'https%3A%2F%2Fpad.exegetes.eu.org%2Fp%2Fg.DSXI1kGFT1gjor66%24Abro-REP-Tele2-Garde%2Fexport%2Ftxt'
+           -b "$URL_BASE" \
+           -g "$URL_GARDE"
 

+ 22 - 4
test_cocktail_02

@@ -3,6 +3,24 @@
 echo "Test 02: 2 compilations dans le même dossier, projets différents"
 echo "Les deux doivent correctement se dérouler"
 
+if test "$TRAVIS" = "true";
+then
+  URL_FILE=url_test.pub.txt
+else
+  URL_FILE=url_test.priv.txt
+fi
+
+if test -r "$URL_FILE";
+then
+  URL_BASE=$(head -n1 "$URL_FILE")
+  URL_GARDE=$(tail -n1 "$URL_FILE")
+else
+  echo "'$URL_FILE' introuvable"
+  exit 1
+fi
+
+
+
 # pids conserve la liste des pids
 # retcode conserve le code retour de chaque pid une fois terminé
 handle_child() {
@@ -28,15 +46,15 @@ trap "handle_child" CHLD
 ./cocktail -v \
            -d MonDossier \
            -p Abro2 \
-           -b 'https%3A%2F%2Fpad.exegetes.eu.org%2Fp%2Fg.DSXI1kGFT1gjor66%24Abro-REP-Tele2-Principal%2Fexport%2Ftxt' \
-           -g 'https%3A%2F%2Fpad.exegetes.eu.org%2Fp%2Fg.DSXI1kGFT1gjor66%24Abro-REP-Tele2-Garde%2Fexport%2Ftxt' &
+           -b "$URL_BASE" \
+           -g "$URL_GARDE" &
 pids+=($!)
 
 ./cocktail -v \
            -d MonDossier \
            -p Abro3 \
-           -b 'https%3A%2F%2Fpad.exegetes.eu.org%2Fp%2Fg.DSXI1kGFT1gjor66%24Abro-REP-Tele2-Principal%2Fexport%2Ftxt' \
-           -g 'https%3A%2F%2Fpad.exegetes.eu.org%2Fp%2Fg.DSXI1kGFT1gjor66%24Abro-REP-Tele2-Garde%2Fexport%2Ftxt' &
+           -b "$URL_BASE" \
+           -g "$URL_GARDE" &
 pids+=($!)
 
 # Wait until all background processes are stopped

+ 20 - 4
test_cocktail_03

@@ -3,6 +3,22 @@
 echo "Test 03: 2 compilations dans le même dossier, même projet."
 echo "Un des deux doit tomber en erreur"
 
+if test "$TRAVIS" = "true";
+then
+  URL_FILE=url_test.pub.txt
+else
+  URL_FILE=url_test.priv.txt
+fi
+
+if test -r "$URL_FILE";
+then
+  URL_BASE=$(head -n1 "$URL_FILE")
+  URL_GARDE=$(tail -n1 "$URL_FILE")
+else
+  echo "'$URL_FILE' introuvable"
+  exit 1
+fi
+
 # pids conserve la liste des pids
 # retcode conserve le code retour de chaque pid une fois terminé
 handle_child() {
@@ -28,15 +44,15 @@ trap "handle_child" CHLD
 ./cocktail -v \
            -d MonDossier \
            -p Abro2 \
-           -b 'https%3A%2F%2Fpad.exegetes.eu.org%2Fp%2Fg.DSXI1kGFT1gjor66%24Abro-REP-Tele2-Principal%2Fexport%2Ftxt' \
-           -g 'https%3A%2F%2Fpad.exegetes.eu.org%2Fp%2Fg.DSXI1kGFT1gjor66%24Abro-REP-Tele2-Garde%2Fexport%2Ftxt' &
+           -b "$URL_BASE" \
+           -g "$URL_GARDE" &
 pids+=($!)
 
 ./cocktail -v \
            -d MonDossier \
            -p Abro2 \
-           -b 'https%3A%2F%2Fpad.exegetes.eu.org%2Fp%2Fg.DSXI1kGFT1gjor66%24Abro-REP-Tele2-Principal%2Fexport%2Ftxt' \
-           -g 'https%3A%2F%2Fpad.exegetes.eu.org%2Fp%2Fg.DSXI1kGFT1gjor66%24Abro-REP-Tele2-Garde%2Fexport%2Ftxt' &
+           -b "$URL_BASE" \
+           -g "$URL_GARDE" &
 pids+=($!)
 
 # Wait until all background processes are stopped

+ 2 - 0
url_test.pub.txt

@@ -0,0 +1,2 @@
+https%3A%2F%2Fpad.exegetes.eu.org%2Fp%2Fg.DSXI1kGFT1gjor66%24Abro-REP-Tele2-Principal%2Fexport%2Ftxt
+https%3A%2F%2Fpad.exegetes.eu.org%2Fp%2Fg.DSXI1kGFT1gjor66%24Abro-REP-Tele2-Garde%2Fexport%2Ftxt