summaryrefslogtreecommitdiff
path: root/tests/func/mongo/sync/f_sync_invalid_getlasterror.c
blob: 6af227b17ea4de101cfdc75eee749261fe9c7a56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "test.h"
#include <mongo.h>
#include <errno.h>

void
test_func_mongo_sync_invalid_getlasterror (void)
{
  mongo_sync_connection *conn;
  gchar *error = NULL;
  gboolean res;

  conn = mongo_sync_connect (config.primary_host, config.primary_port,
                             TRUE);

  res = mongo_sync_cmd_get_last_error
    (conn, "1234567890123456789012345678901234567890123456789012345678901234567890",
     &error);

  ok (res == FALSE,
      "Trying to get the last error from an invalid DB results in an error.");
  ok (error == NULL,
      "When getLastError() fails, error remains NULL");

  mongo_sync_disconnect (conn);
}

RUN_NET_TEST (2, func_mongo_sync_invalid_getlasterror);