From: Sergey Bronnikov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Artem <artemreyt@tarantool.org>,
Alexander Turenko <alexander.turenko@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCHv2 1/2] core: add setting error injections via env
Date: Thu, 25 Feb 2021 17:36:59 +0300 [thread overview]
Message-ID: <c4423f8b-a9ba-d706-8416-1014e06c3e38@tarantool.org> (raw)
In-Reply-To: <1abcc665-11af-ca37-989b-b244cdaef4d5@tarantool.org>
Hello,
thanks for patch!
small nit: with patch below alignment looks more accurately.
--- a/test/box-tap/errinj_set_with_enviroment_vars.test.lua
+++ b/test/box-tap/errinj_set_with_enviroment_vars.test.lua
@@ -4,8 +4,8 @@ local fio = require('fio')
-- Execute errinj_set_with_enviroment_vars_script.lua
-- via tarantool with presetted environment variables.
local TARANTOOL_PATH = arg[-1]
-local bool_env = 'ERRINJ_TESTING=true ERRINJ_WAL_IO=True
ERRINJ_WAL_SYNC=TRUE' ..
- ' ERRINJ_WAL_WRITE=false ERRINJ_INDEX_ALLOC=False
ERRINJ_WAL_WRITE_DISK=FALSE'
+local bool_env = 'ERRINJ_TESTING=true ERRINJ_WAL_IO=True
ERRINJ_WAL_SYNC=TRUE ' ..
+ 'ERRINJ_WAL_WRITE=false ERRINJ_INDEX_ALLOC=False
ERRINJ_WAL_WRITE_DISK=FALSE'
local integer_env = 'ERRINJ_WAL_WRITE_PARTIAL=2
ERRINJ_WAL_FALLOCATE=+2 ERRINJ_WAL_WRITE_COUNT=-2'
local double_env = 'ERRINJ_VY_READ_PAGE_TIMEOUT=2.5
ERRINJ_VY_SCHED_TIMEOUT=+2.5 ERRINJ_RELAY_TIMEOUT=-2.5'
local set_env_str = ('%s %s %s'):format(bool_env, integer_env, double_env)
On 24.02.2021 12:38, Artem wrote:
> Hi,
>
> 20.02.2021 17:27, Sergey Bronnikov пишет:
>> Hi,
>>
>> On 20.02.2021 14:21, Artem wrote:
>>> Hello,
>>>
>>> thanks for the review!
>>>
>>>>> +
>>>>> +void errinj_set_with_environment_vars() {
>>>>> + for (enum errinj_id i = 0; i < errinj_id_MAX; i++) {
>>>>> + struct errinj *inj = &errinjs[i];
>>>>> + const char *env_value = getenv(inj->name);
>>>>> + if (!env_value || *env_value == '\0')
>>>>> + continue;
>>>>> +
>>>>> + if (inj->type == ERRINJ_INT) {
>>>>> + char *end;
>>>>> + int64_t int_value = strtoll(env_value, &end, 10);
>>>>> + if (*end == '\0')
>>>>> + inj->iparam = int_value;
>>>>> + } else if (inj->type == ERRINJ_BOOL) {
>>>>> + if (strcmp(env_value, "false") == 0 ||
>>>>> strcmp(env_value, "FALSE") == 0)
>>>>
>>>> 1. What happen if someone set boolean value to "False"?
>>>>
>>>> May be it's worth to convert env_value to lowercase and then
>>>> compare? The same question for "true".
>>>
>>> 1. Done. Case-insensetive value can be set to env variable now.
>>
>> Thanks!
>>
>> It's worth to add different values for 'true'/'false' to test
>>
>> for documentation and regression purposes.
>
> Done, added tests for "true", "True", "TRUE" (same for false) and
> tests for numeric injections with plus and minus signs.
>
> Updates you can see on the branch.
>
next prev parent reply other threads:[~2021-02-25 14:37 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-18 19:30 [Tarantool-patches] [PATCHv2 0/2] lua: fix tarantool -e always enters interactive mode Artem Starshov via Tarantool-patches
2021-02-18 19:30 ` [Tarantool-patches] [PATCHv2 1/2] core: add setting error injections via env Artem Starshov via Tarantool-patches
2021-02-20 9:03 ` Sergey Bronnikov via Tarantool-patches
2021-02-20 11:21 ` Artem via Tarantool-patches
2021-02-20 14:27 ` Sergey Bronnikov via Tarantool-patches
2021-02-24 9:38 ` Artem via Tarantool-patches
2021-02-25 14:36 ` Sergey Bronnikov via Tarantool-patches [this message]
2021-03-01 14:47 ` Leonid Vasiliev via Tarantool-patches
2021-03-02 17:00 ` Artem via Tarantool-patches
2021-02-18 19:30 ` [Tarantool-patches] [PATCHv2 2/2] lua: fix tarantool -e always enters interactive mode Artem Starshov via Tarantool-patches
2021-02-19 9:15 ` Konstantin Osipov via Tarantool-patches
2021-02-19 14:33 ` Artem via Tarantool-patches
2021-02-20 10:05 ` Sergey Bronnikov via Tarantool-patches
2021-02-20 11:27 ` Artem via Tarantool-patches
2021-03-01 15:10 ` Leonid Vasiliev via Tarantool-patches
2021-03-02 17:05 ` Artem via Tarantool-patches
2021-03-03 12:55 ` Leonid Vasiliev via Tarantool-patches
2021-02-25 14:37 ` [Tarantool-patches] [PATCHv2 0/2] " Sergey Bronnikov via Tarantool-patches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c4423f8b-a9ba-d706-8416-1014e06c3e38@tarantool.org \
--to=tarantool-patches@dev.tarantool.org \
--cc=alexander.turenko@tarantool.org \
--cc=artemreyt@tarantool.org \
--cc=sergeyb@tarantool.org \
--subject='Re: [Tarantool-patches] [PATCHv2 1/2] core: add setting error injections via env' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox