From d66cfa0a08124edf4e3179a2765c75d2a327eb21 Mon Sep 17 00:00:00 2001 From: Nick Marino Date: Tue, 26 Jul 2016 16:52:57 -0400 Subject: [PATCH] Add tests for 2i feature flags --- tests/verify_feature_enable_flags.erl | 30 ++++++++++++++++++++------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/tests/verify_feature_enable_flags.erl b/tests/verify_feature_enable_flags.erl index c5dc026d..05e8f605 100644 --- a/tests/verify_feature_enable_flags.erl +++ b/tests/verify_feature_enable_flags.erl @@ -33,7 +33,8 @@ confirm() -> lager:info("Deploying 1 node"), - [Node] = rt:deploy_nodes(1, ?CFG), + rt:set_backend(eleveldb), + [Node] = rt:build_cluster(1, ?CFG), HttpClient = rt:httpc(Node), PbClient = rt:pbc(Node), @@ -79,7 +80,8 @@ make_objs(Bucket) -> verify_features_disabled_http(Client) -> verify_list_buckets_disabled_http(Client), - verify_list_keys_disabled_http(Client). + verify_list_keys_disabled_http(Client), + verify_secondary_index_disabled_http(Client). verify_features_disabled_pb(Client) -> verify_list_buckets_disabled_pd(Client), @@ -89,12 +91,13 @@ verify_features_disabled_pb(Client) -> verify_features_enabled_http(Client) -> verify_list_buckets_enabled_http(Client), - verify_list_keys_enabled_http(Client). + verify_list_keys_enabled_http(Client), + verify_secondary_index_enabled_http(Client). verify_features_enabled_pb(Client) -> verify_list_buckets_enabled_pb(Client), - verify_list_keys_enabled_pb(Client). - %%verify_secondary_index_enabled_pb(), + verify_list_keys_enabled_pb(Client), + verify_secondary_index_enabled_pb(Client). %%verify_map_reduce_enabled_pb(). verify_list_buckets_disabled_pd(Client) -> @@ -107,9 +110,8 @@ verify_list_keys_disabled_pd(Client) -> verify_secondary_index_disabled_pd(Client) -> Expected = {error, <<"Secondary index queries have been disabled in the configuration">>}, - ?assertEqual(Expected, riakc_pb_socket:get_index(Client, - <<"2i_test">>, - {integer_index, "test_idx"}, 40, 50)). + ?assertEqual(Expected, riakc_pb_socket:get_index(Client, <<"2i_test">>, + {integer_index, "test_idx"}, 42)). verify_list_buckets_enabled_pb(Client) -> {ok, Buckets} = riakc_pb_socket:list_buckets(Client), @@ -121,6 +123,10 @@ verify_list_keys_enabled_pb(Client) -> SortedKeys = lists:sort(Keys), ?assertEqual(SortedKeys, ?BASIC_TEST_KEYS). +verify_secondary_index_enabled_pb(Client) -> + Result = riakc_pb_socket:get_index_eq(Client, <<"2i_test">>, {integer_index, "test_idx"}, 42), + ?assertMatch({ok, {index_results_v1, [<<"2">>], _, _}}, Result). + verify_list_buckets_disabled_http(Client) -> Result = rhc:list_buckets(Client), ?assertMatch({error, {"403", _}}, Result). @@ -129,6 +135,10 @@ verify_list_keys_disabled_http(Client) -> Result = rhc:list_keys(Client, <<"basic_test">>), ?assertMatch({error, {"403", _}}, Result). +verify_secondary_index_disabled_http(Client) -> + Result = rhc:get_index(Client, <<"2i_test">>, {integer_index, "test_idx"}, 42), + ?assertMatch({error, {"403", _}}, Result). + verify_list_buckets_enabled_http(Client) -> {ok, Buckets} = rhc:list_buckets(Client), SortedBuckets = lists:sort(Buckets), @@ -138,3 +148,7 @@ verify_list_keys_enabled_http(Client) -> {ok, Keys} = rhc:list_keys(Client, <<"basic_test">>), SortedKeys = lists:sort(Keys), ?assertEqual(SortedKeys, ?BASIC_TEST_KEYS). + +verify_secondary_index_enabled_http(Client) -> + Result = rhc:get_index(Client, <<"2i_test">>, {integer_index, "test_idx"}, 42), + ?assertMatch({ok, {index_results_v1, [<<"2">>], _, _}}, Result).