1
/* Gearman server and library
2
* Copyright (C) 2008 Brian Aker, Eric Day
5
* Use and distribution licensed under the BSD license. See
6
* the COPYING file in the parent directory for full text.
10
#include <libtest/test.hpp>
12
using namespace libtest;
20
#include <libgearman/gearman.h>
22
#include <tests/basic.h>
23
#include <tests/context.h>
25
#include <tests/ports.h>
27
#define WORKER_FUNCTION "drizzle_queue_test"
29
#if defined(HAVE_LIBDRIZZLE) && HAVE_LIBDRIZZLE
30
#include <libdrizzle-1.0/drizzle_client.h>
33
static bool ping_drizzled(void)
35
#if defined(HAVE_LIBDRIZZLE) && HAVE_LIBDRIZZLE
38
drizzle_st *drizzle= drizzle_create(NULL);
47
if ((con= drizzle_con_create(drizzle, NULL)) == NULL)
49
drizzle_free(drizzle);
53
drizzle_con_set_tcp(con, NULL, 0);
54
drizzle_con_set_auth(con, "root", 0);
56
drizzle_result_st *result= drizzle_ping(con, NULL, &rc);
58
bool success= bool(result);
60
drizzle_result_free(result);
61
drizzle_con_free(con);
62
drizzle_free(drizzle);
71
#ifndef __INTEL_COMPILER
72
#pragma GCC diagnostic ignored "-Wold-style-cast"
75
static test_return_t gearmand_basic_option_test(void *)
77
const char *args[]= { "--check-args",
78
"--libdrizzle-host=127.0.0.1",
79
"--libdrizzle-port=90",
80
"--libdrizzle-uds=tmp/foo.socket",
81
"--libdrizzle-user=root",
82
"--libdrizzle-password=test",
83
"--libdrizzle-db=gearman",
84
"--libdrizzle-table=gearman",
88
test_compare(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
92
static test_return_t collection_init(void *object)
94
Context *test= (Context *)object;
97
const char *argv[]= { "test_gearmand", "--queue-type=libdrizzle", 0 };
99
test->initialize(2, argv);
104
static test_return_t collection_cleanup(void *object)
106
Context *test= (Context *)object;
113
static void *world_create(server_startup_st& servers, test_return_t& error)
115
if (has_drizzle_support() == false)
123
if (ping_drizzled() == false)
130
Context *test= new Context(DRIZZLE_TEST_PORT, servers);
133
error= TEST_MEMORY_ALLOCATION_FAILURE;
142
static bool world_destroy(void *object)
144
Context *test= (Context *)object;
151
test_st gearmand_basic_option_tests[] ={
152
{"all options", 0, gearmand_basic_option_test },
157
{"gearman_client_echo()", 0, client_echo_test },
158
{"gearman_client_echo() fail", 0, client_echo_fail_test },
159
{"gearman_worker_echo()", 0, worker_echo_test },
160
{"clean", 0, queue_clean },
161
{"add", 0, queue_add },
162
{"worker", 0, queue_worker },
166
test_st regressions[] ={
167
{"lp:734663", 0, lp_734663 },
171
collection_st collection[] ={
172
{"drizzle queue", collection_init, collection_cleanup, tests},
173
{"regressions", collection_init, collection_cleanup, regressions},
177
void get_world(Framework *world)
179
world->collections= collection;
180
world->_create= world_create;
181
world->_destroy= world_destroy;