Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Drew Kerrigan committed Dec 5, 2013
1 parent 074edc6 commit e92ea7a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 37 deletions.
61 changes: 32 additions & 29 deletions examples/http.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,51 +10,47 @@
{key_generator, {int_to_str, {sequential_int, 50000}}}.
{value_generator, {fixed_bin, 10000}}.

%% {Name, KeyGen | ValGen}

%% Name: atom()
%% KeyGen: User or Basho Bench defined key generator
%% ValGen: User or Basho Bench defined value generator
%%% Generators: {Name, KeyGen | ValGen}
% Name: atom()
% KeyGen: User or Basho Bench defined key generator
% ValGen: User or Basho Bench defined value generator
{generators, [
{string_g, {key_generator, {int_to_str, {uniform_int, 50000}}}},
{binstring_g, {value_generator, {fixed_bin, 100}}},
{binstring_g, {value_generator, {fixed_bin, 100}}}
]}.

%% {Name, Value}
%% {Name, {FormattedValue, Generators}}

%% Name: atom()
%% Value: string() | atom() - named generator, can be key_generator or value_generator for default
%% FormattedValue: string() - formatted with io_lib:format
%% Generators: list() - list of generators, can be key_generator or value_generator for default
%%% Values: {Name, Value}
%%% {Name, {FormattedValue, Generators}}
% Name: atom()
% Value: string() | atom() - named generator, can be key_generator or value_generator for default
% FormattedValue: string() - formatted with io_lib:format
% Generators: list() - list of generators, can be key_generator or value_generator for default
{values, [
{json_v, {"{\"this\":\"is_json_~p\"}", [string_g]}},
{xml_v, {"<?xml version=\"1.0\"?><catalog><book><author>~p</author></book></catalog>", [binstring_g]}},
{json_v, {"{\"this\":\"is_json_~s\"}", [string_g]}},
{xml_v, {"<?xml version=\"1.0\"?><catalog><book><author>~s</author></book></catalog>", [binstring_g]}},
{plainstring_v, "hello"},
{smallbin_v, binstring_g},
{largebin_v, value_generator}
]}.

%% {Name, Headers}
%% Name: atom()

%% Headers: proplist()
%%% Headers: {Name, Headers}
% Name: atom()
% Headers: proplist()
{headers, [
{json_h, [{'Content-Type', 'application/json'}, {'Accept', 'application/json'}]},
{xml_h, [{'Content-Type', 'application/xml'}]},
{binary_h, [{'Content-Type', 'application/octet-stream'}]},
{empty_h, []}
]}.

%% {Name, {Host, Port, Path}}
%% {Name, {Host, Port, {FormattedPath, Generators}}}

%% Name: atom()
%% Host: string()
%% Port: integer()
%% Path: string()
%% FormattedPath: string() - formatted with io_lib:format
%% Generators: list() - list of generators, can be key_generator or value_generator for default
%%% Targets: {Name, {Host, Port, Path}}
%%% {Name, {Host, Port, {FormattedPath, Generators}}}
% Name: atom()
% Host: string()
% Port: integer()
% Path: string()
% FormattedPath: string() - formatted with io_lib:format
% Generators: list() - list of generators, can be key_generator or value_generator for default
{targets, [
{base_uri_t, {"localhost", 4567, "/"}},
{with_key_t, {"localhost", 4567, {"/~p", key_generator}}},
Expand All @@ -63,7 +59,14 @@
{upload_t, {"localhost", 4567, {"upload/~p", key_generator}}}
]}.

%% {{Operation,
%%% Operations: {{get|delete, Target}, Weight}
%%% {{get|delete, Target, Header}, Weight}
%%% {{put|post, Target, Value}, Weight}
%%% {{put|post, Target, Value, Header}, Weight}
% Target: atom() - defined target
% Header: atom() - defined header
% Value: atom() - defined value
% Weight: integer() - ratio of this operation to the rest (ThisWeight / TotalWeightSum = % of this Operation)

{operations, [
%% Get without a key
Expand Down
8 changes: 0 additions & 8 deletions src/basho_bench_driver_http.erl
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ build_value(ValueName, KeyGen, ValueGen, State) ->
end.

do_get(Url, Headers) ->
%%case send_request(Url, [], get, [], [{response_format, binary}]) of
case send_request(Url, Headers, get, [], [{response_format, binary}]) of
{ok, "404", _Header, _Body} ->
{not_found, Url};
Expand Down Expand Up @@ -364,10 +363,3 @@ should_retry(_) -> false.
normalize_error(Method, {'EXIT', {timeout, _}}) -> {error, {Method, timeout}};
normalize_error(Method, {'EXIT', Reason}) -> {error, {Method, 'EXIT', Reason}};
normalize_error(Method, {error, Reason}) -> {error, {Method, Reason}}.

any_to_str(Val) when is_binary(Val) ->
binary_to_list(Val);
any_to_str(Val) when is_integer(Val) ->
integer_to_list(Val);
any_to_str(Val) ->
Val.

0 comments on commit e92ea7a

Please sign in to comment.