From 257c5b0879cf782f0c6bb109d5d341f18b8e7e7b Mon Sep 17 00:00:00 2001 From: Konstantin Osipov Date: Fri, 4 Dec 2020 17:56:54 +0300 Subject: [PATCH] test: add a test case for append/prepend limit --- test/boost/cql_query_test.cc | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/test/boost/cql_query_test.cc b/test/boost/cql_query_test.cc index 9e474d7744..7ca73df035 100644 --- a/test/boost/cql_query_test.cc +++ b/test/boost/cql_query_test.cc @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 ScyllaDB + * Copyright (C) 2015-2020 ScyllaDB */ /* @@ -371,6 +371,30 @@ SEASTAR_TEST_CASE(test_list_of_tuples_with_bound_var) { }); } +/// The nubmer of distinct values in a list is limited. Test the +// limit. +SEASTAR_TEST_CASE(test_list_append_limit) { + return do_with_cql_env_thread([](cql_test_env& e) { + e.execute_cql("CREATE TABLE t (pk int PRIMARY KEY, l list);").get(); + std::string value_list = "0"; + for (int i = 0; i < utils::UUID_gen::SUBMICRO_LIMIT; i++) { + value_list.append(",0"); + } + // Use a local copy of query_options to avoid impact on + // adjacent tests: that's where Scylla stores the list + // append sequence, which will be exceeded it in this + // test. + auto qo = std::make_unique(db::consistency_level::LOCAL_ONE, + infinite_timeout_config, + std::vector{}, + cql3::query_options::specific_options{1, nullptr, {}, api::new_timestamp()}); + auto cql = fmt::format("UPDATE t SET l = l + [{}] WHERE pk = 0;", value_list); + BOOST_REQUIRE_THROW(e.execute_cql(cql, std::move(qo)).get0(), exceptions::invalid_request_exception); + e.execute_cql("DROP TABLE t;").get(); + }); +} + + SEASTAR_TEST_CASE(test_insert_statement) { return do_with_cql_env([] (cql_test_env& e) { return e.execute_cql("create table cf (p1 varchar, c1 int, r1 int, PRIMARY KEY (p1, c1));").discard_result().then([&e] {