~ubuntu-branches/ubuntu/trusty/syslog-ng/trusty-proposed

« back to all changes in this revision

Viewing changes to modules/afmongodb/libmongo-client/tests/unit/mongo/sync/sync_cmd_user_remove.c

  • Committer: Package Import Robot
  • Author(s): Laszlo Boszormenyi (GCS), Gergely Nagy
  • Date: 2011-10-11 14:30:48 UTC
  • mfrom: (1.3.7)
  • Revision ID: package-import@ubuntu.com-20111011143048-r1iljux9xbvj3lwh
Tags: 3.3.1.dfsg-1
* New upstream release with important fixes from upstream git tree with
  non-free manpages removed.
* Drop syslog-ng.conf(5) (closes: #496521).
* syslog-ng(8) is generated, and does not mention -Q anymore
  (closes: #616069).
* Supports CAP_SYSLOG on recent kernels (closes: #630172).
* Does not use g_timeout_add_seconds anymore (closes: #609154).

[ Gergely Nagy <algernon@madhouse-project.org> ]
* Update debian/copyright to DEP-5 format.
* Simplified the logrotate file by merging identical entries.
* Include local configuration files from /etc/syslog-ng/conf.d/ (Closes:
  #609050).
* Update syslog-ng.conf to be fully 3.3 compliant.
* Compress both source and binaries (except the syslog-ng meta
  package) with xz, instead of gzip.
* Use dpkg triggers to restart syslog-ng when appropriate.
* Include DFSG-free manual pages for all binaries.
* Build with Hardening enabled.
* Mention syslog(3) in /etc/default/syslog-ng, instead of
  <linux/kernel.h> (Closes: #608605)
* Support 'status' in the init script.
  Patch from Peter Eisentraut <petere@debian.org> (Closes: #644458)
* Build-Depend on libevtlog-dev (>= 0.2.12-5~) for correct shlibs.
* Use [linux-any] in Build-Depends instead of hardcoded links.
  (Closes: #634715)
* Use $SYSLOGNG_OPTS in the init script when reloading syslog-ng.
  (Closes: #589081)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "test.h"
 
2
#include "mongo.h"
 
3
#include "config.h"
 
4
 
 
5
#include <errno.h>
 
6
#include <sys/socket.h>
 
7
#include "libmongo-private.h"
 
8
 
 
9
void
 
10
test_mongo_sync_cmd_user_remove_net_secondary (void)
 
11
{
 
12
  mongo_sync_connection *c;
 
13
  gboolean ret;
 
14
 
 
15
  skip (!config.secondary_host, 1,
 
16
        "Secondary server not configured");
 
17
 
 
18
  c = mongo_sync_connect (config.secondary_host, config.secondary_port, TRUE);
 
19
  mongo_sync_conn_set_auto_reconnect (c, TRUE);
 
20
 
 
21
  mongo_sync_cmd_user_add (c, config.db, "test", "s3kr1+");
 
22
  ret = mongo_sync_cmd_user_remove (c, config.db, "test");
 
23
  ok (ret && mongo_sync_cmd_is_master (c),
 
24
      "mongo_sync_cmd_user_remove() automatically reconnects to master");
 
25
 
 
26
  mongo_sync_disconnect (c);
 
27
 
 
28
  endskip;
 
29
}
 
30
 
 
31
void
 
32
test_mongo_sync_cmd_user_remove_net (void)
 
33
{
 
34
  mongo_sync_connection *c;
 
35
 
 
36
  begin_network_tests (3);
 
37
 
 
38
  c = mongo_sync_connect (config.primary_host, config.primary_port, TRUE);
 
39
  mongo_sync_conn_set_auto_reconnect (c, TRUE);
 
40
 
 
41
  mongo_sync_cmd_user_add (c, config.db, "test", "s3kr1+");
 
42
  ok (mongo_sync_cmd_user_remove (c, config.db, "test") == TRUE,
 
43
      "mongo_sync_cmd_user_remove() works");
 
44
 
 
45
  mongo_sync_cmd_user_add (c, config.db, "test", "s3kr1+");
 
46
  shutdown (c->super.fd, SHUT_RDWR);
 
47
  sleep (3);
 
48
 
 
49
  ok (mongo_sync_cmd_user_remove (c, config.db, "test") == TRUE,
 
50
      "mongo_sync_cmd_user_remove() automatically reconnects");
 
51
 
 
52
  mongo_sync_disconnect (c);
 
53
 
 
54
  test_mongo_sync_cmd_user_remove_net_secondary ();
 
55
 
 
56
  end_network_tests ();
 
57
}
 
58
 
 
59
void
 
60
test_mongo_sync_cmd_user_remove (void)
 
61
{
 
62
  mongo_sync_connection *c;
 
63
 
 
64
  c = test_make_fake_sync_conn (-1, FALSE);
 
65
 
 
66
  errno = 0;
 
67
  ok (mongo_sync_cmd_user_remove (NULL, "test", "test") == FALSE,
 
68
      "mongo_sync_cmd_user_remove() fails with a NULL connection");
 
69
  cmp_ok (errno, "==", ENOTCONN,
 
70
          "errno is set to ENOTCONN");
 
71
 
 
72
  errno = 0;
 
73
  ok (mongo_sync_cmd_user_remove (c, NULL, "test") == FALSE,
 
74
      "mongo_sync_cmd_user_remove() fails with a NULL db");
 
75
  cmp_ok (errno, "==", EINVAL,
 
76
          "errno is set to EINVAL");
 
77
 
 
78
  errno = 0;
 
79
  ok (mongo_sync_cmd_user_remove (c, "test", NULL) == FALSE,
 
80
      "mongo_sync_cmd_user_remove() fails with a NULL user");
 
81
  cmp_ok (errno, "==", EINVAL,
 
82
          "errno is set to EINVAL");
 
83
 
 
84
  ok (mongo_sync_cmd_user_remove (c, "test", "test") == FALSE,
 
85
      "mongo_sync_cmd_user_remove() fails with a bogus FD");
 
86
 
 
87
  mongo_sync_disconnect (c);
 
88
 
 
89
  test_mongo_sync_cmd_user_remove_net ();
 
90
}
 
91
 
 
92
RUN_TEST (10, mongo_sync_cmd_user_remove);