~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_create.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
 
 
4
#include <sys/socket.h>
 
5
#include "libmongo-private.h"
 
6
 
 
7
void
 
8
test_mongo_sync_cmd_create_net (void)
 
9
{
 
10
  mongo_sync_connection *conn;
 
11
  gchar *cc;
 
12
 
 
13
  begin_network_tests (5);
 
14
 
 
15
  conn = mongo_sync_connect (config.primary_host, config.primary_port, FALSE);
 
16
 
 
17
  cc = g_strconcat (config.coll, ".capped", NULL);
 
18
 
 
19
  mongo_sync_cmd_drop (conn, config.db, config.coll);
 
20
  mongo_sync_cmd_drop (conn, config.db, cc);
 
21
 
 
22
  ok (mongo_sync_cmd_create (conn, config.db, config.coll,
 
23
                             MONGO_COLLECTION_DEFAULTS) == TRUE,
 
24
      "mongo_sync_cmd_create() can create normal collections");
 
25
  mongo_sync_cmd_drop (conn, config.db, config.coll);
 
26
 
 
27
  ok (mongo_sync_cmd_create (conn, config.db, config.coll,
 
28
                             MONGO_COLLECTION_SIZED,
 
29
                             (gint64) 64 * 1024 * 10) == TRUE,
 
30
      "mongo_sync_cmd_create() can create pre-allocated collections");
 
31
 
 
32
  ok (mongo_sync_cmd_create (conn, config.db, cc,
 
33
                             MONGO_COLLECTION_CAPPED, (gint64) -1) == FALSE,
 
34
      "mongo_sync_cmd_create() fails when trying to create a capped "
 
35
      "collection with an invalid size");
 
36
  ok (mongo_sync_cmd_create (conn, config.db, cc,
 
37
                             MONGO_COLLECTION_CAPPED_MAX,
 
38
                             (gint64) (64 * 1024 * 10), (gint64) -1) == FALSE,
 
39
      "mongo_sync_cmd_create() fails when trying to create a capped "
 
40
      "collection with invalid max.");
 
41
  ok (mongo_sync_cmd_create (conn, config.db, cc,
 
42
                             MONGO_COLLECTION_CAPPED_MAX |
 
43
                             MONGO_COLLECTION_AUTO_INDEX_ID,
 
44
                             (gint64)(64 * 1024 * 10), (gint64) 10) == TRUE,
 
45
      "mongo_sync_cmd_create() can create capped collections");
 
46
 
 
47
  mongo_sync_cmd_drop (conn, config.db, cc);
 
48
 
 
49
  g_free (cc);
 
50
  mongo_sync_disconnect (conn);
 
51
 
 
52
  end_network_tests ();
 
53
}
 
54
 
 
55
void
 
56
test_mongo_sync_cmd_create (void)
 
57
{
 
58
  mongo_sync_connection *c;
 
59
 
 
60
  c = test_make_fake_sync_conn (-1, FALSE);
 
61
 
 
62
  ok (mongo_sync_cmd_create (NULL, "test", "db",
 
63
                             MONGO_COLLECTION_DEFAULTS) == FALSE,
 
64
      "mongo_sync_cmd_create() fails with a NULL connection");
 
65
 
 
66
  ok (mongo_sync_cmd_create (c, NULL, "db",
 
67
                             MONGO_COLLECTION_DEFAULTS) == FALSE,
 
68
      "mongo_sync_cmd_create() fails with a NULL db");
 
69
  ok (mongo_sync_cmd_create (c, "test", NULL,
 
70
                             MONGO_COLLECTION_DEFAULTS) == FALSE,
 
71
      "mongo_sync_cmd_create() fails with a NULL collection");
 
72
 
 
73
  mongo_sync_disconnect (c);
 
74
 
 
75
  test_mongo_sync_cmd_create_net ();
 
76
}
 
77
 
 
78
RUN_TEST (8, mongo_sync_cmd_create);