123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704 |
- /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Cycle the Gearmand server
- *
- * Copyright (C) 2011 Data Differential, http://datadifferential.com/
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *
- * * The names of its contributors may not be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
- /*
- Test that we are cycling the servers we are creating during testing.
- */
- #include "gear_config.h"
- #include <libtest/test.hpp>
- #include "libgearman/client.hpp"
- #include "libgearman/worker.hpp"
- using namespace org::gearmand;
- #include <fstream>
- using namespace libtest;
- #ifndef __INTEL_COMPILER
- #pragma GCC diagnostic ignored "-Wstrict-aliasing"
- #endif
- static std::string executable;
- static test_return_t postion_TEST(void *)
- {
- const char *args[]= { "foo", 0 };
- ASSERT_EQ(EXIT_FAILURE, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t partial_TEST(void *)
- {
- const char *args[]= { "--log", 0 };
- ASSERT_EQ(EXIT_FAILURE, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t check_args_test(void *)
- {
- const char *args[]= { "--check-args", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t long_backlog_test(void *)
- {
- const char *args[]= { "--check-args", "--backlog=10", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t short_backlog_test(void *)
- {
- const char *args[]= { "--check-args", "-b", "10", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t long_daemon_test(void *)
- {
- const char *args[]= { "--check-args", "--daemon", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t long_coredump_TEST(void *)
- {
- const char *args[]= { "--check-args", "--coredump", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t short_daemon_test(void *)
- {
- const char *args[]= { "--check-args", "-d", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t long_file_descriptors_test(void *)
- {
- const char *args[]= { "--check-args", "--file-descriptors=10", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t short_file_descriptors_test(void *)
- {
- const char *args[]= { "--check-args", "-f", "10", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t long_help_test(void *)
- {
- const char *args[]= { "--check-args", "--help", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t short_help_test(void *)
- {
- const char *args[]= { "--check-args", "-h", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t long_keepalive_TEST(void *)
- {
- const char *args[]= { "--check-args", "--keepalive", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t long_keepalive_idle_TEST(void *)
- {
- const char *args[]= { "--check-args", "--keepalive-idle=10", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t long_keepalive_interval_TEST(void *)
- {
- const char *args[]= { "--check-args", "--keepalive-interval=3", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t long_keepalive_count_TEST(void *)
- {
- const char *args[]= { "--check-args", "--keepalive-count=10", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t long_keepalive_start_TEST(void *)
- {
- in_port_t port= libtest::get_free_port();
- char port_str[1024];
- ASSERT_TRUE(snprintf(port_str, sizeof(port_str), "--port=%d", int32_t(port)) > 0);
- const char *args[]= {
- port_str,
- "--check-args",
- "--log-file=stderr",
- "--keepalive-count=10",
- "--keepalive-interval=3",
- "--keepalive-idle=10", 0 };
- Application app(gearmand_binary(), true);
- Application::error_t ret= app.run(args);
- ASSERT_EQ(Application::SUCCESS, ret);
- ret= app.join();
- ASSERT_EQ_(Application::SUCCESS, ret, "ret: %s stderr: '%s' stdout: `%s'",
- Application::toString(ret),
- app.stderr_c_str(), app.stdout_c_str());
- return TEST_SUCCESS;
- }
- static test_return_t long_log_file_test(void *)
- {
- const char *args[]= { "--check-args", "--log-file=\"tmp/foo\"", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t long_log_file_stderr_TEST(void *)
- {
- const char *args[]= { "--check-args", "--log-file=stderr", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t short_log_file_test(void *)
- {
- const char *args[]= { "--check-args", "-l", "\"tmp/foo\"", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t long_listen_test(void *)
- {
- const char *args[]= { "--check-args", "--listen=10", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t short_listen_test(void *)
- {
- const char *args[]= { "--check-args", "-L", "10", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t long_port_test(void *)
- {
- const char *args[]= { "--check-args", "--port=10", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t short_port_test(void *)
- {
- const char *args[]= { "--check-args", "-p", "10", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t long_pid_file_test(void *)
- {
- const char *args[]= { "--check-args", "--pid-file=\"tmp/gearmand.pid\"", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t short_pid_file_test(void *)
- {
- const char *args[]= { "--check-args", "-P", "\"tmp/gearmand.pid\"", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t long_round_robin_test(void *)
- {
- const char *args[]= { "--check-args", "--round-robin", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t short_round_robin_test(void *)
- {
- const char *args[]= { "--check-args", "-R", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t long_syslog_test(void *)
- {
- const char *args[]= { "--check-args", "--syslog", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t SSL_TEST(void *)
- {
- const char *args[]= { "--check-args", "--ssl", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t long_threads_test(void *)
- {
- const char *args[]= { "--check-args", "--threads=10", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t short_threads_test(void *)
- {
- const char *args[]= { "--check-args", "-t", "8", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t long_user_test(void *)
- {
- const char *args[]= { "--check-args", "--user=nobody", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t short_user_test(void *)
- {
- const char *args[]= { "--check-args", "-u", "nobody", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t long_version_test(void *)
- {
- const char *args[]= { "--check-args", "--version", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t short_version_test(void *)
- {
- const char *args[]= { "--check-args", "-V", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t verbose_bad_option_TEST(void *)
- {
- const char *args[]= { "--check-args", "--verbose=BAD", 0 };
- ASSERT_EQ(EXIT_FAILURE, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t verbose_DEBUG_TEST(void *)
- {
- const char *args[]= { "--check-args", "--verbose=DEBUG", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t verbose_ERROR_TEST(void *)
- {
- const char *args[]= { "--check-args", "--verbose=ERROR", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t verbose_ALERT_TEST(void *)
- {
- const char *args[]= { "--check-args", "--verbose=ALERT", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t verbose_INFO_TEST(void *)
- {
- const char *args[]= { "--check-args", "--verbose=INFO", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t verbose_WARNING_TEST(void *)
- {
- const char *args[]= { "--check-args", "--verbose=WARNING", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t verbose_NOTICE_TEST(void *)
- {
- const char *args[]= { "--check-args", "--verbose=NOTICE", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t verbose_FATAL_TEST(void *)
- {
- const char *args[]= { "--check-args", "--verbose=FATAL", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t verbose_CRITICAL_TEST(void *)
- {
- const char *args[]= { "--check-args", "--verbose=CRITICAL", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t verbose_deprecated_TEST(void *)
- {
- const char *args[]= { "--check-args", "-vvv", 0 };
- ASSERT_EQ(EXIT_FAILURE, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t long_worker_wakeup_test(void *)
- {
- const char *args[]= { "--check-args", "--worker-wakeup=4", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t short_worker_wakeup_test(void *)
- {
- const char *args[]= { "--check-args", "-V", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t protocol_test(void *)
- {
- const char *args[]= { "--check-args", "--protocol=http", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t queue_test(void *)
- {
- const char *args[]= { "--check-args", "--queue-type=builtin", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t long_job_retries_test(void *)
- {
- const char *args[]= { "--check-args", "--job-retries=4", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t job_handle_prefix_TEST(void *)
- {
- const char *args[]= { "--check-args", "--job-handle-prefix=my_own_private_handle", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t hashtable_buckets_TEST(void *)
- {
- const char *args[]= { "--check-args", "--hashtable-buckets=2000", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t short_job_retries_test(void *)
- {
- const char *args[]= { "--check-args", "-j", "6", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t http_port_test(void *)
- {
- const char *args[]= { "--check-args", "--protocol=http", "--http-port=8090", 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t config_file_TEST(void *)
- {
- ASSERT_EQ(-1, access("etc/gearmand.conf", R_OK));
- const char *args[]= { "--check-args", "--config-file=etc/gearmand.conf", 0 };
- ASSERT_EQ(EXIT_FAILURE, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t config_file_DEFAULT_TEST(void *)
- {
- const char *args[]= { "--check-args", "--config-file", 0 };
- ASSERT_EQ(EXIT_FAILURE, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t config_file_FAIL_TEST(void *)
- {
- const char *args[]= { "--check-args", "--config-file=etc/grmandfoo.conf", 0 };
- ASSERT_EQ(EXIT_FAILURE, exec_cmdline(gearmand_binary(), args, true));
- return TEST_SUCCESS;
- }
- static test_return_t config_file_SIMPLE_TEST(void *)
- {
- in_port_t port= libtest::get_free_port();
- char port_str[1024];
- ASSERT_TRUE(snprintf(port_str, sizeof(port_str), "%d", int32_t(port)) > 0);
- std::string config_file= "etc/gearmand.conf";
- {
- char current_directory_buffer[1024];
- char *current_directory= getcwd(current_directory_buffer, sizeof(current_directory_buffer));
- std::string config_path;
- config_path+= current_directory;
- config_path+= "/";
- config_path+= config_file;
- std::fstream file_stream;
- file_stream.open(config_path.c_str(), std::fstream::out | std::fstream::trunc);
- ASSERT_TRUE(file_stream.good());
- file_stream << "--port " << port_str << std::endl;
- ASSERT_TRUE(file_stream.good());
- file_stream.close();
- }
- test_zero(access(config_file.c_str(), R_OK));
- char args_buffer[1024];
- snprintf(args_buffer, sizeof(args_buffer), "--config-file=%s", config_file.c_str());
- const char *args[]= { "--check-args", args_buffer, 0 };
- ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
- unlink(config_file.c_str());
- return TEST_SUCCESS;
- }
- static test_return_t maxqueue_TEST(void *)
- {
- return TEST_SKIPPED;
- #if 0
- in_port_t port= libtest::get_free_port();
- Application gearmand(gearmand_binary(), true);
- char buffer[1024];
- test_true(snprintf(buffer, sizeof(buffer), "%d", int32_t(port)) > 0);
- gearmand.add_long_option("--port=", buffer);
- ASSERT_EQ(Application::SUCCESS, gearmand.run());
- test::Worker worker(port);
- ASSERT_EQ(GEARMAN_SUCCESS, gearman_worker_register(&worker, __func__, 0));
- ASSERT_EQ(GEARMAN_SUCCESS, gearman_worker_unregister(&worker, __func__));
- ASSERT_EQ(Application::SUCCESS, gearmand.join());
- return TEST_SUCCESS;
- #endif
- }
- test_st bad_option_TESTS[] ={
- {"position argument", 0, postion_TEST },
- {"partial argument", 0, partial_TEST },
- {0, 0, 0}
- };
- test_st gearmand_option_tests[] ={
- {"--check-args", 0, check_args_test},
- {"--backlog=", 0, long_backlog_test},
- {"-b", 0, short_backlog_test},
- {"--coredump", 0, long_coredump_TEST},
- {"--daemon", 0, long_daemon_test},
- {"-d", 0, short_daemon_test},
- {"--file-descriptors=", 0, long_file_descriptors_test},
- {"-f", 0, short_file_descriptors_test},
- {"--help", 0, long_help_test},
- {"-h", 0, short_help_test},
- {"--keepalive", 0, long_keepalive_TEST},
- {"--keepalive-idle", 0, long_keepalive_idle_TEST},
- {"--keepalive-interval", 0, long_keepalive_interval_TEST},
- {"--keepalive-count", 0, long_keepalive_count_TEST},
- {"--log-file=", 0, long_log_file_test},
- {"--log-file=stderr", 0, long_log_file_stderr_TEST},
- {"-l", 0, short_log_file_test},
- {"--listen=", 0, long_listen_test},
- {"-L", 0, short_listen_test},
- {"--port=", 0, long_port_test},
- {"-p", 0, short_port_test},
- {"--pid-file=", 0, long_pid_file_test},
- {"-P", 0, short_pid_file_test},
- {"--round-robin", 0, long_round_robin_test},
- {"-R", 0, short_round_robin_test},
- {"--ssl", 0, SSL_TEST},
- {"--syslog=", 0, long_syslog_test},
- {"--threads=", 0, long_threads_test},
- {"-T", 0, short_threads_test},
- {"--user=", 0, long_user_test},
- {"-u", 0, short_user_test},
- {"--user=", 0, long_user_test},
- {"-u", 0, short_user_test},
- {"-vvv", 0, verbose_deprecated_TEST},
- {"--verbose=FATAL", 0, verbose_FATAL_TEST},
- {"--verbose=ALERT", 0, verbose_ALERT_TEST},
- {"--verbose=CRITICAL", 0, verbose_CRITICAL_TEST},
- {"--verbose=ERROR", 0, verbose_ERROR_TEST},
- {"--verbose=WARNING", 0, verbose_WARNING_TEST},
- {"--verbose=NOTICE", 0, verbose_NOTICE_TEST},
- {"--verbose=INFO", 0, verbose_INFO_TEST},
- {"--verbose=DEBUG", 0, verbose_DEBUG_TEST},
- {"--verbose=BAD", 0, verbose_bad_option_TEST},
- {"--version", 0, long_version_test},
- {"-V", 0, short_version_test},
- {"--worker_wakeup=", 0, long_worker_wakeup_test},
- {"-w", 0, short_worker_wakeup_test},
- {"--protocol=", 0, protocol_test},
- {"--queue-type=", 0, queue_test},
- {"--job-retries=", 0, long_job_retries_test},
- {"-hashtable-buckets", 0, hashtable_buckets_TEST},
- {"--job-handle-prefix=", 0, job_handle_prefix_TEST},
- {"-j", 0, short_job_retries_test},
- {"--config-file=etc/gearmand.conf no file present", 0, config_file_TEST },
- {"--config-file", 0, config_file_DEFAULT_TEST },
- {"--config-file=etc/grmandfoo.conf", 0, config_file_FAIL_TEST },
- {"--config-file=etc/gearmand.conf", 0, config_file_SIMPLE_TEST },
- {"start server with all --keepalive options", 0, long_keepalive_start_TEST},
- {0, 0, 0}
- };
- test_st gearmand_httpd_option_tests[] ={
- {"--http-port=", 0, http_port_test},
- {0, 0, 0}
- };
- test_st maxqueue_TESTS[] ={
- { "maxqueue=", 0, maxqueue_TEST },
- {0, 0, 0}
- };
- static test_return_t option_SETUP(void*)
- {
- unlink("etc/gearmand.conf");
- return TEST_SUCCESS;
- }
- collection_st collection[] ={
- { "bad options", 0, 0, bad_option_TESTS },
- { "basic options", option_SETUP, 0, gearmand_option_tests },
- { "httpd options", 0, 0, gearmand_httpd_option_tests },
- { "maxqueue", 0, 0, maxqueue_TESTS },
- {0, 0, 0, 0}
- };
- void get_world(libtest::Framework *world)
- {
- world->collections(collection);
- }
|