Skip to content

Commit

Permalink
Merge pull request elastic#55 from balabit/merge/h/control-cmd-test-fix
Browse files Browse the repository at this point in the history
control: Fix the test_control_cmds test to be deterministic
  • Loading branch information
bazsi committed Jan 2, 2014
2 parents 018b831 + 5460c95 commit 502686d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/control/tests/test_control_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ test_stats()
GString *reply = NULL;
GString *command = g_string_sized_new(128);
StatsCounterItem *counter = NULL;
gchar **stats_result;

stats_lock();
stats_register_counter(0, SCS_CENTER, "id", "received", SC_TYPE_PROCESSED, &counter);
Expand All @@ -75,10 +76,10 @@ test_stats()
g_string_assign(command,"STATS");

reply = control_connection_send_stats(command);
assert_string(reply->str, "SourceName;SourceId;SourceInstance;State;Type;Number\n"
"center;id;received;a;processed;0\nglobal;payload_reallocs;;a;processed;0\n"
"global;msg_clones;;a;processed;0\n"
"global;sdata_updates;;a;processed;0\n", "Bad reply");
stats_result = g_strsplit(reply->str, "\n", 2);
assert_string(stats_result[0], "SourceName;SourceId;SourceInstance;State;Type;Number",
"Bad reply");
g_strfreev(stats_result);
g_string_free(reply, TRUE);

g_string_free(command, TRUE);
Expand Down

0 comments on commit 502686d

Please sign in to comment.