2015-12-18 03:44:58 +00:00
|
|
|
%% -------------------------------------------------------------------
|
|
|
|
%%
|
2016-11-01 14:03:48 +00:00
|
|
|
%% Copyright (c) 2015-2016 Basho Technologies, Inc.
|
2015-12-18 03:44:58 +00:00
|
|
|
%%
|
|
|
|
%% This file is provided to you under the Apache License,
|
|
|
|
%% Version 2.0 (the "License"); you may not use this file
|
|
|
|
%% except in compliance with the License. You may obtain
|
|
|
|
%% a copy of the License at
|
|
|
|
%%
|
|
|
|
%% http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
%%
|
|
|
|
%% Unless required by applicable law or agreed to in writing,
|
|
|
|
%% software distributed under the License is distributed on an
|
|
|
|
%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
%% KIND, either express or implied. See the License for the
|
|
|
|
%% specific language governing permissions and limitations
|
|
|
|
%% under the License.
|
|
|
|
%%
|
|
|
|
%% -------------------------------------------------------------------
|
|
|
|
|
2016-01-11 17:40:38 +00:00
|
|
|
-module(ts_simple_describe_table).
|
2015-12-18 03:44:58 +00:00
|
|
|
|
|
|
|
-behavior(riak_test).
|
|
|
|
|
|
|
|
-export([confirm/0]).
|
|
|
|
|
|
|
|
-include_lib("eunit/include/eunit.hrl").
|
|
|
|
|
2015-12-21 16:53:49 +00:00
|
|
|
%% Test basic table description
|
2015-12-18 03:44:58 +00:00
|
|
|
|
|
|
|
confirm() ->
|
2016-11-01 14:03:48 +00:00
|
|
|
Table = ts_data:get_default_bucket(),
|
|
|
|
DDL = ts_data:get_ddl(),
|
|
|
|
Qry = "DESCRIBE " ++ Table,
|
2015-12-21 16:53:49 +00:00
|
|
|
Expected =
|
2016-07-14 16:37:07 +00:00
|
|
|
{ok, {[<<"Column">>,<<"Type">>,<<"Is Null">>,<<"Primary Key">>, <<"Local Key">>, <<"Interval">>, <<"Unit">>],
|
2016-11-01 14:03:48 +00:00
|
|
|
[{<<"myfamily">>, <<"varchar">>, false, 1, 1, [], []},
|
|
|
|
{<<"myseries">>, <<"varchar">>, false, 2, 2, [], []},
|
|
|
|
{<<"time">>, <<"timestamp">>, false, 3, 3, 15, <<"m">>},
|
|
|
|
{<<"weather">>, <<"varchar">>, false, [], [], [], []},
|
|
|
|
{<<"temperature">>,<<"double">>, true, [], [], [], []}]}},
|
|
|
|
|
|
|
|
Cluster = ts_setup:start_cluster(1),
|
|
|
|
ts_setup:create_bucket_type(Cluster, DDL, Table),
|
|
|
|
ts_setup:activate_bucket_type(Cluster, Table),
|
|
|
|
Got = ts_ops:query(Cluster, Qry),
|
|
|
|
|
2015-12-18 03:44:58 +00:00
|
|
|
?assertEqual(Expected, Got),
|
|
|
|
pass.
|