fail_over-tests.c revision 89caf5edcc99f5731e89bd51e6ffaad3ec11c304
/*
SSSD
Fail over tests.
Authors:
Martin Nagy <mnagy@redhat.com>
Copyright (C) Red Hat, Inc 2009
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <check.h>
#include <popt.h>
#include <stdlib.h>
#include <stdio.h>
#include <talloc.h>
#include <tevent.h>
#include "resolv/async_resolv.h"
/* Interface under test */
#include "providers/fail_over.h"
int use_net_test;
struct test_ctx {
struct tevent_context *ev;
struct resolv_ctx *resolv;
int tasks;
};
struct task {
const char *location;
int recv;
int port;
int new_server_status;
int new_port_status;
};
static struct test_ctx *
setup_test(void)
{
struct fo_options fopts;
int ret;
fail("Could not init tevent context");
}
fail("Could not init resolv context");
}
fail("Could not init fail over context");
}
return ctx;
}
static void
{
}
{
int i;
int ret;
struct fo_service *service;
ctx = setup_test();
for (i = 0; i < 10; i++) {
char buf[16];
}
for (i = 9; i >= 0; i--) {
char buf[16];
}
}
static void
{
int port;
struct resolv_hostent *he;
int i;
if (recv_status != EOK)
return;
if (task->new_port_status >= 0)
if (task->new_server_status >= 0)
char buf[256];
}
}
}
#define get_request(a, b, c, d, e, f) \
_get_request(a, b, c, d, e, f, __location__)
static void
int new_server_status, const char *location)
{
struct tevent_req *req;
}
{
ctx = setup_test();
/* Add service. */
/* Add servers. */
/* Make requests. */
}
Suite *
create_suite(void)
{
/* Do some testing */
if (use_net_test) {
}
/* Add all test cases to the test suite */
suite_add_tcase(s, tc);
return s;
}
int
{
int opt;
int failure_count;
int debug = 0;
struct poptOption long_options[] = {
{ "use-net-test", 'n', POPT_ARG_NONE, 0, 'n', "Run tests that need an active internet connection", NULL },
};
/* Set debug level to invalid value so we can deside if -d 0 was used. */
switch(opt) {
case 'n':
use_net_test = 1;
break;
default:
return 1;
}
}
suite = create_suite();
/* If CK_VERBOSITY is set, use that, otherwise it defaults to CK_NORMAL */
}