gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-anastasis] branch master updated: tests: also sync providers in b


From: gnunet
Subject: [taler-anastasis] branch master updated: tests: also sync providers in backup
Date: Fri, 15 Apr 2022 12:56:04 +0200

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository anastasis.

The following commit(s) were added to refs/heads/master by this push:
     new cc56b73  tests: also sync providers in backup
cc56b73 is described below

commit cc56b7357a2531300b08ed6f3732cefca1ce878a
Author: Florian Dold <florian@dold.me>
AuthorDate: Fri Apr 15 12:55:47 2022 +0200

    tests: also sync providers in backup
---
 ...tasis_reducer_recovery_enter_user_attributes.sh | 50 ++++++++++++++-------
 src/cli/test_anastasis_reducer_recovery_no_pay.sh  | 52 +++++++++++++++-------
 2 files changed, 70 insertions(+), 32 deletions(-)

diff --git a/src/cli/test_anastasis_reducer_recovery_enter_user_attributes.sh 
b/src/cli/test_anastasis_reducer_recovery_enter_user_attributes.sh
index 24cddc3..49814cd 100755
--- a/src/cli/test_anastasis_reducer_recovery_enter_user_attributes.sh
+++ b/src/cli/test_anastasis_reducer_recovery_enter_user_attributes.sh
@@ -26,6 +26,36 @@ function cleanup()
     wait
 }
 
+function sync_providers() {
+  infile=$1
+  outfile=$2
+  echo "Synchronizing providers"
+  # Sync with providers (up to 3 providers aren't synced here)
+  for x in 1 2 3; do
+    echo "Synchronizing providers (round $x)"
+    anastasis-reducer sync_providers < $infile > $outfile 2> /dev/null || true
+    CODE=$(jq -r -e ".code // 0" < $outfile)
+    # ANASTASIS_REDUCER_PROVIDERS_ALREADY_SYNCED
+    # FIXME: Temporary workaround for C reducer. See #7227.
+    if test "$CODE" = "8420"; then
+      # restore previous non-error state
+      cat $infile > $outfile
+      break
+    fi
+    # ANASTASIS_REDUCER_ACTION_INVALID
+    if test "$CODE" = "8400"; then
+      # restore previous non-error state
+      cat $infile > $outfile
+      break
+    fi
+    if test "$CODE" != "0"; then
+      exit_fail "Expected no error or 8420/8400, got $CODE"
+    fi
+    cat $outfile > $infile
+  done
+  echo "Providers synced."
+}
+
 
 CONF_1="test_anastasis_reducer_1.conf"
 CONF_2="test_anastasis_reducer_2.conf"
@@ -287,6 +317,9 @@ anastasis-reducer -a \
     "sq_number": "4",
     "birthdate": "2000-01-01"}}' \
   enter_user_attributes < $B1FILE > $B2FILE
+cat $B2FILE > $B1FILE
+echo -n ","
+sync_providers $B1FILE $B2FILE
 echo -n ","
 # "91GPWWR" encodes "Hans"
 anastasis-reducer -a \
@@ -435,22 +468,9 @@ then
 fi
 echo " OK"
 
-# Sync with providers (up to 3 providers aren't synced here)
-for x in 1 2 3; do
-  echo "Synchronizing providers (round $x)"
-  anastasis-reducer sync_providers < $R2FILE > $R1FILE 2> /dev/null || true
-  CODE=$(jq -r -e ".code // 0" < $R1FILE)
-  if test "$CODE" = "8420"; then
-    break
-  fi
-  if test "$CODE" != "0"; then
-    exit_fail "Expected no error or 8420, got $CODE"
-  fi
-  cat $R1FILE > $R2FILE
-done
-
-echo "Providers synced."
+cat $R2FILE > $R1FILE
 
+sync_providers $R1FILE $R2FILE
 
 echo -n "Running challenge logic ..."
 
diff --git a/src/cli/test_anastasis_reducer_recovery_no_pay.sh 
b/src/cli/test_anastasis_reducer_recovery_no_pay.sh
index e65c526..f58980d 100755
--- a/src/cli/test_anastasis_reducer_recovery_no_pay.sh
+++ b/src/cli/test_anastasis_reducer_recovery_no_pay.sh
@@ -26,6 +26,36 @@ function cleanup()
     wait
 }
 
+function sync_providers() {
+  infile=$1
+  outfile=$2
+  echo "Synchronizing providers"
+  # Sync with providers (up to 3 providers aren't synced here)
+  for x in 1 2 3; do
+    echo "Synchronizing providers (round $x)"
+    anastasis-reducer sync_providers < $infile > $outfile 2> /dev/null || true
+    CODE=$(jq -r -e ".code // 0" < $outfile)
+    # ANASTASIS_REDUCER_PROVIDERS_ALREADY_SYNCED
+    # FIXME: Temporary workaround for C reducer. See #7227.
+    if test "$CODE" = "8420"; then
+      # restore previous non-error state
+      cat $infile > $outfile
+      break
+    fi
+    # ANASTASIS_REDUCER_ACTION_INVALID
+    if test "$CODE" = "8400"; then
+      # restore previous non-error state
+      cat $infile > $outfile
+      break
+    fi
+    if test "$CODE" != "0"; then
+      exit_fail "Expected no error or 8420/8400, got $CODE"
+    fi
+    cat $outfile > $infile
+  done
+  echo "Providers synced."
+}
+
 
 CONF_1="test_anastasis_reducer_free_1.conf"
 CONF_2="test_anastasis_reducer_free_2.conf"
@@ -137,6 +167,9 @@ anastasis-reducer -a \
     "sq_number": "4",
     "birthdate": "2000-01-01"}}' \
   enter_user_attributes < $B1FILE > $B2FILE
+cat $B2FILE > $B1FILE
+echo -n ","
+sync_providers $B1FILE $B2FILE
 echo -n ","
 # "91GPWWR" encodes "Hans"
 anastasis-reducer -a \
@@ -227,23 +260,8 @@ then
 fi
 echo " OK"
 
-echo -n "Synchronizing providers"
-# Sync with providers (up to 3 providers aren't synced here)
-for x in 1 2 3; do
-  echo "Synchronizing providers (round $x)"
-  anastasis-reducer sync_providers < $R2FILE > $R1FILE 2> /dev/null || true
-  CODE=$(jq -r -e ".code // 0" < $R1FILE)
-  if test "$CODE" = "8420"; then
-    break
-  fi
-  if test "$CODE" != "0"; then
-    exit_fail "Expected no error or 8420, got $CODE"
-  fi
-  cat $R1FILE > $R2FILE
-done
-
-echo "Providers synced."
-
+cat $R2FILE > $R1FILE
+sync_providers $R1FILE $R2FILE
 
 echo -n "Running challenge logic ..."
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]