Skip to content
Snippets Groups Projects
  1. Feb 06, 2023
    • Oleg Chaplashkin's avatar
      test: fix import and usage luatest module · 98dd8e69
      Oleg Chaplashkin authored
      After adding the autorequiring luatest [1,2], there is no need to use
      the following approach now:
      
      ```
      local t = require('luatest')
      local g = t.group()
      
      server:exec(function()
          local t = require('luatest') -- duplicate
          t.assert(...)
      end)
      ```
      
      Modern approach looks like:
      
      ```
      local t = require('luatest')
      local g = t.group()
      
      -- `t` already available in the remote server
      server:exec(function() t.assert(...) end)
      
      -- also it works with any variable
      local my_custom_t = require('luatest')
      
      server:exec(function()
          my_custom_t.assert(...) -- already available
      end)
      ```
      
      [1] tarantool/luatest#277
      [2] tarantool/luatest#289
      
      Part of tarantool/luatest#233
      
      NO_DOC=test fix
      NO_TEST=test fix
      NO_CHANGELOG=test fix
      98dd8e69
  2. Jan 26, 2023
    • Oleg Chaplashkin's avatar
      test: fix the use of `before_all/after_all` hooks · ed136255
      Oleg Chaplashkin authored
      Changed the work with hooks in the part of tests.
      
      Legacy approach:
      
      ```
      g.before_all = function() ... end
      g.after_all = function() ... end
      ```
      
      The logic of executing hooks will be expected and
      more controlled if use following approach:
      
      ```
      g.before_all(function() ... end)
      g.after_all(function() ... end)
      ```
      
      Resolve #8066
      
      NO_DOC=test fix
      NO_TEST=test fix
      NO_CHANGELOG=test fix
      ed136255
  3. Dec 05, 2022
    • Yaroslav Lobankov's avatar
      test: use luatest modules instead of internal ones · 21fc0770
      Yaroslav Lobankov authored
      Some internal modules have been recently copied to luatest repo [1,2]
      and now they can be safely removed, and the corresponding functionality
      from luatest can be used instead.
      
      Affected modules:
      
      - test/luatest_helpers/server.lua
      
      [1] tarantool/luatest#258
      [2] tarantool/luatest#266
      
      Closes tarantool/luatest#239
      
      NO_DOC=testing stuff
      NO_TEST=testing stuff
      NO_CHANGELOG=testing stuff
      21fc0770
  4. Oct 19, 2022
    • Mergen Imeev's avatar
      box: fix format of _vfunc · 707da125
      Mergen Imeev authored
      The _vfunc system space is the sysview for the _func system space.
      However, the _vfunc format is different from the _func format. This
      patch makes the _vfunc format the same as the _func format.
      
      Closes #7822
      
      NO_DOC=bugfix
      707da125
  5. Dec 20, 2021
    • Vladimir Davydov's avatar
      box: add takes_raw_args lua function option · d2a01245
      Vladimir Davydov authored
      Closes #3349
      
      @TarantoolBot document
      Title: Document that takes_raw_args function option
      
      A new function option was added - `takes_raw_args`:
      
      ```lua
      box.schema.func.create('my_func', {takes_raw_args = true})
      ```
      
      If set for a Lua function, the functions arguments will be passed
      wrapped in a msgpack object (see `msgpack.object()`) when the function
      is called over IPROTO or by `box.func.NAME:call()`:
      
      ```lua
      local msgpack = require('msgpack')
      local my_func = function(mp)
          assert(msgpack.is_object(mp))
          local args = mp:decode() -- array of arguments
      end
      ```
      
      Using this option might improve performance in case a function forwards
      most of its arguments to another instance or writes them to a database,
      because it eliminates msgpack decoding in Lua.
      d2a01245
    • Vladimir Davydov's avatar
      schema: allow to pass is_multikey func opt without sub-table · 66f5368b
      Vladimir Davydov authored
      Currently, `is_multikey` function option must be wrapped in `opts`
      sub-table, which looks ugly:
      
      ```lua
      box.schema.func.create('my_func', {
          is_deterministic = true,
          opts = {is_multikey = true}
      })
      ```
      
      Let's allow to pass the option directly.
      
      Note, the `is_multikey` option is reported by `box.func` at the same
      level as `is_deterministic` so this would only be consistent:
      
      ```lua
      box.func.my_func.is_deterministic
      box.func.my_func.is_multikey
      ```
      
      @TarantoolBot document
      Title: Document that is_multikey func opt may be passed without sub-table
      
      It's not necessary anymore to wrap `is_multikey` in `opts` table when
      creating a function:
      
      ```lua
      box.schema.func.create('my_func', {is_multikey = true})
      ```
      
      is equivalent to
      
      ```lua
      box.schema.func.create('my_func', {opts = {is_multikey = true}})
      ```
      
      which still works, but deprecated.
      
      Pease update [this][func-index] documentation entry.
      
      [func-index]: https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_space/create_index/#creating-a-functional-index
      66f5368b
Loading