Skip to content

Commit

Permalink
[test] add more info on what we are testing
Browse files Browse the repository at this point in the history
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
  • Loading branch information
fabbione committed Jul 25, 2021
1 parent b7c3d06 commit 306db44
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions libknet/tests/fun_acl_check.c
Expand Up @@ -231,6 +231,7 @@ static void test(int transport)
*/

// No ACL
printf("Testing No ACL - this should get through\n");
FAIL_ON_ERR(knet_send_str(knet_h[2], "1No ACL - this should get through"));
wait_for_cond(knet_h, logfds);

Expand All @@ -245,13 +246,15 @@ static void test(int transport)
// This needs to go after the first ACLs are added
FAIL_ON_ERR(knet_handle_enable_access_lists(knet_h[1], 1));

printf("Testing Address blocked - this should NOT get through\n");
FAIL_ON_ERR(knet_send_str(knet_h[2], "0Address blocked - this should NOT get through"));

// Unblock and check again
FAIL_ON_ERR(wait_for_nodes_state(knet_h[1], TESTNODES, 0, 60, logfds[0], stdout));
FAIL_ON_ERR(knet_link_rm_acl(knet_h[1], 2, 0, &ss1, NULL, CHECK_TYPE_ADDRESS, CHECK_REJECT));
FAIL_ON_ERR(wait_for_nodes_state(knet_h[1], TESTNODES, 1, 60, logfds[0], stdout));

printf("Testing Address unblocked - this should get through\n");
FAIL_ON_ERR(knet_send_str(knet_h[2], "1Address unblocked - this should get through"));
wait_for_cond(knet_h, logfds);

Expand All @@ -260,13 +263,15 @@ static void test(int transport)
knet_strtoaddr("255.0.0.1","0", &ss2, sizeof(ss2));
FAIL_ON_ERR(knet_link_insert_acl(knet_h[1], 2, 0, 0, &ss1, &ss2, CHECK_TYPE_MASK, CHECK_REJECT));

printf("Testing Netmask blocked - this should NOT get through\n");
FAIL_ON_ERR(knet_send_str(knet_h[2], "0Netmask blocked - this should NOT get through"));

// Unblock and check again
FAIL_ON_ERR(wait_for_nodes_state(knet_h[1], TESTNODES, 0, 60, logfds[0], stdout));
FAIL_ON_ERR(knet_link_rm_acl(knet_h[1], 2, 0, &ss1, &ss2, CHECK_TYPE_MASK, CHECK_REJECT));
FAIL_ON_ERR(wait_for_nodes_state(knet_h[1], TESTNODES, 1, 60, logfds[0], stdout));

printf("Testing Netmask unblocked - this should get through\n");
FAIL_ON_ERR(knet_send_str(knet_h[2], "1Netmask unblocked - this should get through"));
wait_for_cond(knet_h, logfds);

Expand All @@ -275,13 +280,15 @@ static void test(int transport)
knet_strtoaddr("127.0.0.9", "0", &ss2, sizeof(ss2));
FAIL_ON_ERR(knet_link_insert_acl(knet_h[1], 2, 0, 0, &ss1, &ss2, CHECK_TYPE_RANGE, CHECK_REJECT));

printf("Testing Range blocked - this should NOT get through\n");
FAIL_ON_ERR(knet_send_str(knet_h[2], "0Range blocked - this should NOT get through"));

// Unblock and check again
FAIL_ON_ERR(wait_for_nodes_state(knet_h[1], TESTNODES, 0, 60, logfds[0], stdout));
FAIL_ON_ERR(knet_link_rm_acl(knet_h[1], 2, 0, &ss1, &ss2, CHECK_TYPE_RANGE, CHECK_REJECT));
FAIL_ON_ERR(wait_for_nodes_state(knet_h[1], TESTNODES, 1, 60, logfds[0], stdout));

printf("Testing Range unblocked - this should get through\n");
FAIL_ON_ERR(knet_send_str(knet_h[2], "1Range unblocked - this should get through"));
wait_for_cond(knet_h, logfds);

Expand Down

0 comments on commit 306db44

Please sign in to comment.