|
| 1 | +local t = require('luatest') |
| 2 | +local justrun = require('test.justrun') |
| 3 | + |
| 4 | +local g = t.group() |
| 5 | + |
| 6 | +g.test_help_env_list = function() |
| 7 | + local res = justrun.tarantool('.', {}, {'--help-env-list'}, {nojson = true}) |
| 8 | + t.assert_equals(res.exit_code, 0) |
| 9 | + |
| 10 | + -- Pick up several well-known env variables to verify the idea |
| 11 | + -- of the listing, but at the same time, don't list all the |
| 12 | + -- options in the test case. |
| 13 | + local cases = { |
| 14 | + -- Verify that the env variables that duplicates CLI |
| 15 | + -- options are present. |
| 16 | + { |
| 17 | + name = 'TT_INSTANCE_NAME', |
| 18 | + type = 'string', |
| 19 | + default = 'N/A', |
| 20 | + availability = 'Community Edition', |
| 21 | + }, |
| 22 | + { |
| 23 | + name = 'TT_CONFIG', |
| 24 | + type = 'string', |
| 25 | + default = 'nil', |
| 26 | + availability = 'Community Edition', |
| 27 | + }, |
| 28 | + -- An env variable that accepts a numeric value and has |
| 29 | + -- explicit default value. |
| 30 | + { |
| 31 | + name = 'TT_MEMTX_MEMORY', |
| 32 | + type = 'integer', |
| 33 | + default = '268435456', |
| 34 | + availability = 'Community Edition', |
| 35 | + }, |
| 36 | + -- An env variable that has box.NULL default. |
| 37 | + { |
| 38 | + name = 'TT_DATABASE_MODE', |
| 39 | + type = 'string', |
| 40 | + default = 'box.NULL', |
| 41 | + availability = 'Community Edition', |
| 42 | + }, |
| 43 | + -- An option with a template default. |
| 44 | + { |
| 45 | + name = 'TT_CONSOLE_SOCKET', |
| 46 | + type = 'string', |
| 47 | + default = '{{ instance_name }}.control', |
| 48 | + availability = 'Community Edition', |
| 49 | + }, |
| 50 | + -- An Enterprise Edition option and, at the same time, |
| 51 | + -- an option with non-string type. |
| 52 | + { |
| 53 | + name = 'TT_CONFIG_ETCD_ENDPOINTS', |
| 54 | + type = 'array', |
| 55 | + default = 'nil', |
| 56 | + availability = 'Enterprise Edition', |
| 57 | + }, |
| 58 | + -- Yet another Enterprise Edition option. |
| 59 | + { |
| 60 | + name = 'TT_WAL_EXT_NEW', |
| 61 | + type = 'boolean', |
| 62 | + default = 'nil', |
| 63 | + availability = 'Enterprise Edition', |
| 64 | + }, |
| 65 | + } |
| 66 | + |
| 67 | + for _, case in ipairs(cases) do |
| 68 | + local needle = ('%s.*%s.*%s.*%s'):format(case.name, case.type, |
| 69 | + case.default, case.availability) |
| 70 | + t.assert(res.stdout:find(needle), case.name) |
| 71 | + end |
| 72 | +end |
0 commit comments