Skip to content

Commit

Permalink
fix(tests): accept range for lua thread env test
Browse files Browse the repository at this point in the history
  • Loading branch information
dfranusic committed Oct 12, 2023
1 parent 848e377 commit 2d86906
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 6 additions & 3 deletions test/check_umlua.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,20 +382,23 @@ umlua_test_env_01(void **state)
// get pm
test_t *data = *state;

// sleep for 2 seconds (counters value should be at 4)
// sleep for 2 seconds (counters value should be at 4 || 5)
sleep(2);

// get custom counter
umc_t *c = umc_get(NULL, "test_env_counter", true);
assert_null(c);
c = umc_get(data->umd->perf, "test_env_counter", true);
assert_non_null(c);
assert_int_equal(c->values.last.value, 4);
if (c->values.last.value < 4 || c->values.last.value > 5) {
fail_msg("test counter should be >= 4 (freq/duration = 500msec/2s)");
}
int expc = c->values.last.value;

// check runtime counters (execution count)
c = umc_get(data->umd->perf, "lua.environment.TEST_ENV.count", true);
assert_non_null(c);
assert_int_equal(c->values.last.value, 4);
assert_int_equal(c->values.last.value, expc);

// check runtime counters (rate, should be around 2 per second for
// a 500msec frequency)
Expand Down
1 change: 0 additions & 1 deletion test/mqtt_test_03.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ local r2 = M.mqtt.publish("mqtt_local", "mink/DEBUG_UUID/1/cmd", false)
local r3 = M.mqtt.publish("mqtt_local_XX", "mink/DEBUG_UUID/1/AAA", "XX")

if r1 or r2 or r3 then
print("ERR")
return "ERR"
else
r1 = M.mqtt.publish("mqtt_local", "mink/DEBUG_UUID/1/cmd", "test_dummy_data_02")
Expand Down

0 comments on commit 2d86906

Please sign in to comment.