Add more tests around invalid input; esp. after the first row

This commit is contained in:
Brett Hazen 2015-12-23 20:00:03 +00:00
parent f0065b2262
commit 0ccd2b0e34
2 changed files with 38 additions and 4 deletions

View File

@ -33,10 +33,28 @@
confirm() ->
DDL = ts_util:get_ddl(),
Obj = [ts_util:get_invalid_obj()],
ValidObj = ts_util:get_valid_obj(),
InvalidObj = ts_util:get_invalid_obj(),
ShortObj = ts_util:get_short_obj(),
LongObj = ts_util:get_long_obj(),
Bucket = ts_util:get_default_bucket(),
{_Cluster, Conn} = ClusterConn = ts_util:cluster_and_connect(single),
Expected = {error, {1003, <<"Invalid data">>}},
Got = ts_util:ts_put(
ts_util:cluster_and_connect(single), normal, DDL, Obj),
Got = ts_util:ts_put(ClusterConn, normal, DDL, [InvalidObj]),
?assertEqual(Expected, Got),
pass.
Got2 = riakc_ts:put(Conn, Bucket, [ShortObj]),
?assertEqual(Expected, Got2),
Got3 = riakc_ts:put(Conn, Bucket, [LongObj]),
?assertEqual(Expected, Got3),
Got4 = riakc_ts:put(Conn, Bucket, [ValidObj, InvalidObj]),
?assertEqual(Expected, Got4),
Got5 = riakc_ts:put(Conn, Bucket, [ValidObj, ShortObj]),
?assertEqual(Expected, Got5),
Got6 = riakc_ts:put(Conn, Bucket, [ValidObj, LongObj]),
?assertEqual(Expected, Got6),
pass.

View File

@ -42,8 +42,10 @@
get_integer/0,
get_invalid_obj/0,
get_invalid_qry/1,
get_long_obj/0,
get_map/1,
get_optional/2,
get_short_obj/0,
get_string/1,
get_timestamp/0,
get_valid_aggregation_data/1,
@ -397,6 +399,20 @@ get_invalid_obj() ->
get_varchar(),
get_float()].
get_short_obj() ->
[get_varchar(),
get_varchar(),
get_timestamp(),
get_varchar()].
get_long_obj() ->
[get_varchar(),
get_varchar(),
get_timestamp(),
get_varchar(),
get_float(),
get_float()].
get_varchar() ->
Len = random:uniform(?MAXVARCHARLEN),
String = get_string(Len),