44
/* The structure we use for the test system */
45
struct libmemcached_test_container_st
47
libtest::server_startup_st& construct;
51
libmemcached_test_container_st(libtest::server_startup_st &construct_arg) :
52
construct(construct_arg),
44
#include "tests/libmemcached_test_container.h"
58
46
static void *world_create(libtest::server_startup_st& servers, test_return_t& error)
80
68
return global_container;
83
static test_return_t world_container_startup(libmemcached_test_container_st *container)
87
test_compare_got(MEMCACHED_SUCCESS,
88
libmemcached_check_configuration(container->construct.option_string().c_str(), container->construct.option_string().size(),
89
buffer, sizeof(buffer)),
90
container->construct.option_string().c_str());
92
test_null(container->parent);
93
container->parent= memcached(container->construct.option_string().c_str(), container->construct.option_string().size());
94
test_true(container->parent);
95
test_compare(MEMCACHED_SUCCESS, memcached_version(container->parent));
97
if (container->construct.sasl())
99
if (memcached_failed(memcached_behavior_set(container->parent, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1)))
101
memcached_free(container->parent);
105
if (memcached_failed(memcached_set_sasl_auth_data(container->parent, container->construct.username().c_str(), container->construct.password().c_str())))
107
memcached_free(container->parent);
115
static test_return_t world_container_shutdown(libmemcached_test_container_st *container)
117
memcached_free(container->parent);
118
container->parent= NULL;
123
static test_return_t world_test_startup(libmemcached_test_container_st *container)
125
test_true(container);
126
test_null(container->memc);
127
test_true(container->parent);
128
container->memc= memcached_clone(NULL, container->parent);
129
test_true(container->memc);
134
test_return_t world_flush(libmemcached_test_container_st *container);
135
test_return_t world_flush(libmemcached_test_container_st *container)
137
test_true(container->memc);
138
memcached_flush(container->memc, 0);
139
memcached_quit(container->memc);
144
static test_return_t world_on_error(test_return_t , libmemcached_test_container_st *container)
146
test_true(container->memc);
147
memcached_free(container->memc);
148
container->memc= NULL;
153
71
static bool world_destroy(void *object)
155
73
libmemcached_test_container_st *container= (libmemcached_test_container_st *)object;