aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/test_namestore_api_lookup_nick.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-05-09 17:33:04 +0200
committerChristian Grothoff <christian@grothoff.org>2018-05-09 17:33:04 +0200
commit8bb475af99260f1d107dbc8908268ae93960aa83 (patch)
tree1a7a1fc03424df841a6f977b137482439b09bc9f /src/namestore/test_namestore_api_lookup_nick.c
parent1f80a11e90ee982bffaae4685e281f75ee1c225d (diff)
downloadgnunet-8bb475af99260f1d107dbc8908268ae93960aa83.tar.gz
gnunet-8bb475af99260f1d107dbc8908268ae93960aa83.zip
implement new functions in libgnunetsq, clean up sqlite namestore plugin, implement flow control in namestore API and tests
Diffstat (limited to 'src/namestore/test_namestore_api_lookup_nick.c')
-rw-r--r--src/namestore/test_namestore_api_lookup_nick.c37
1 files changed, 14 insertions, 23 deletions
diff --git a/src/namestore/test_namestore_api_lookup_nick.c b/src/namestore/test_namestore_api_lookup_nick.c
index 50d1fd9a9..b9ae93bf2 100644
--- a/src/namestore/test_namestore_api_lookup_nick.c
+++ b/src/namestore/test_namestore_api_lookup_nick.c
@@ -52,7 +52,6 @@ static struct GNUNET_NAMESTORE_QueueEntry *nsqe;
52//static const char * name = "dummy.dummy.gnunet"; 52//static const char * name = "dummy.dummy.gnunet";
53static const char * name = "d"; 53static const char * name = "d";
54 54
55static char *directory;
56 55
57static void 56static void
58cleanup () 57cleanup ()
@@ -283,29 +282,22 @@ run (void *cls,
283 const struct GNUNET_CONFIGURATION_Handle *cfg, 282 const struct GNUNET_CONFIGURATION_Handle *cfg,
284 struct GNUNET_TESTING_Peer *peer) 283 struct GNUNET_TESTING_Peer *peer)
285{ 284{
286 char *hostkey_file;
287
288 directory = NULL;
289 GNUNET_assert (GNUNET_OK ==
290 GNUNET_CONFIGURATION_get_value_string(cfg, "PATHS", "GNUNET_TEST_HOME", &directory));
291 GNUNET_DISK_directory_remove (directory);
292
293 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 285 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
294 &endbadly, NULL); 286 &endbadly,
295 GNUNET_asprintf (&hostkey_file, 287 NULL);
296 "zonefiles%s%s", 288 privkey = GNUNET_CRYPTO_ecdsa_key_create ();
297 DIR_SEPARATOR_STR,
298 "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey");
299 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file);
300 privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file);
301 GNUNET_free (hostkey_file);
302 GNUNET_assert (privkey != NULL); 289 GNUNET_assert (privkey != NULL);
303 GNUNET_CRYPTO_ecdsa_key_get_public (privkey, &pubkey); 290 GNUNET_CRYPTO_ecdsa_key_get_public (privkey,
291 &pubkey);
304 292
305 nsh = GNUNET_NAMESTORE_connect (cfg); 293 nsh = GNUNET_NAMESTORE_connect (cfg);
306 GNUNET_break (NULL != nsh); 294 GNUNET_break (NULL != nsh);
307 295
308 nsqe = GNUNET_NAMESTORE_set_nick (nsh, privkey, TEST_NICK, &nick_cont, (void *) name); 296 nsqe = GNUNET_NAMESTORE_set_nick (nsh,
297 privkey,
298 TEST_NICK,
299 &nick_cont,
300 (void *) name);
309 if (NULL == nsqe) 301 if (NULL == nsqe)
310 { 302 {
311 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 303 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -324,6 +316,8 @@ main (int argc, char *argv[])
324 GNUNET_asprintf (&cfg_name, 316 GNUNET_asprintf (&cfg_name,
325 "test_namestore_api_%s.conf", 317 "test_namestore_api_%s.conf",
326 plugin_name); 318 plugin_name);
319 GNUNET_DISK_purge_cfg_dir (cfg_name,
320 "GNUNET_TEST_HOME");
327 res = 1; 321 res = 1;
328 if (0 != 322 if (0 !=
329 GNUNET_TESTING_peer_run ("test-namestore-api-lookup-nick", 323 GNUNET_TESTING_peer_run ("test-namestore-api-lookup-nick",
@@ -333,12 +327,9 @@ main (int argc, char *argv[])
333 { 327 {
334 res = 1; 328 res = 1;
335 } 329 }
330 GNUNET_DISK_purge_cfg_dir (cfg_name,
331 "GNUNET_TEST_HOME");
336 GNUNET_free (cfg_name); 332 GNUNET_free (cfg_name);
337 if (NULL != directory)
338 {
339 GNUNET_DISK_directory_remove (directory);
340 GNUNET_free (directory);
341 }
342 return res; 333 return res;
343} 334}
344 335