aboutsummaryrefslogtreecommitdiff
path: root/src/datastore/test_datastore_api_management.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-08-07 16:55:16 +0000
committerChristian Grothoff <christian@grothoff.org>2010-08-07 16:55:16 +0000
commitb9de10a83f130b2c0a4513a1f713d778fbb4ecc1 (patch)
tree0dcfa912e2eea217d494ba56f1373e2c0cbb7e26 /src/datastore/test_datastore_api_management.c
parentd4115af6385dcab2433b27796e777819e297dae7 (diff)
do not fail if datastore unavailable
Diffstat (limited to 'src/datastore/test_datastore_api_management.c')
-rw-r--r--src/datastore/test_datastore_api_management.c41
1 files changed, 36 insertions, 5 deletions
diff --git a/src/datastore/test_datastore_api_management.c b/src/datastore/test_datastore_api_management.c
index d0278094f8..3de1544f32 100644
--- a/src/datastore/test_datastore_api_management.c
+++ b/src/datastore/test_datastore_api_management.c
@@ -293,6 +293,28 @@ run_continuation (void *cls,
static void
+run_tests (void *cls,
+ int success,
+ const char *msg)
+{
+ struct CpsRunContext *crc = cls;
+
+ if (success != GNUNET_YES)
+ {
+ fprintf (stderr,
+ "Test 'put' operation failed with error `%s' database likely not setup, skipping test.",
+ msg);
+ GNUNET_free (crc);
+ return;
+ }
+ GNUNET_SCHEDULER_add_continuation (crc->sched,
+ &run_continuation,
+ crc,
+ GNUNET_SCHEDULER_REASON_PREREQ_DONE);
+}
+
+
+static void
run (void *cls,
struct GNUNET_SCHEDULER_Handle *sched,
char *const *args,
@@ -300,6 +322,7 @@ run (void *cls,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct CpsRunContext *crc;
+ static GNUNET_HashCode zkey;
crc = GNUNET_malloc(sizeof(struct CpsRunContext));
crc->sched = sched;
@@ -307,11 +330,19 @@ run (void *cls,
crc->phase = RP_PUT;
now = GNUNET_TIME_absolute_get ();
datastore = GNUNET_DATASTORE_connect (cfg, sched);
- GNUNET_SCHEDULER_add_continuation (crc->sched,
- &run_continuation,
- crc,
- GNUNET_SCHEDULER_REASON_PREREQ_DONE);
-
+ if (NULL ==
+ GNUNET_DATASTORE_put (datastore, 0,
+ &zkey, 4, "TEST",
+ GNUNET_BLOCK_TYPE_TEST,
+ 0, 0, GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS),
+ 0, 1, GNUNET_TIME_UNIT_MINUTES,
+ &run_tests, crc))
+ {
+ fprintf (stderr,
+ "Test 'put' operation failed.\n");
+ GNUNET_free (crc);
+ ok = 1;
+ }
}