Skip to content
Snippets Groups Projects
Select Git revision
  • 351dbb1ded66be91a863ab34c752b2a19f6bd807
  • 2.11.5-picodata default protected
  • ipotemin/trigger-binding
  • picodata-25.4
  • astrochuk/fiber-stack-addr
  • mlaletin/ci-tarantool-module protected
  • astrochuk/remove-rows
  • artshmelev/try-remove-condition-replicaset_connect_quorum
  • kusancho/fiber_stack_report
  • e.dmitriev/osx-arm-build-fix
  • nnk/warning-limit-and-iproto-executor
  • kdy/ci_build_with_tag protected
  • nnk/iproto-emergency-executor
  • nnk/add-vdbe-soft-limit
  • origin/picodata-25.3
  • artshmelev/debug-tls
  • v.klimenko/box_index_iterator_with_offset
  • picodata-25.3
  • funbringer/2.11.5-fix-select-param-having
  • max/new-cache2
  • nnk/expose-actual-vdbe-opcode-count
  • 2.11.5.283 protected
  • 2.11.5.266 protected
  • 2.11.5.265 protected
  • 2.11.5.254 protected
  • 2.11.5.253 protected
  • 2.11.5.233 protected
  • 2.11.5.230 protected
  • 2.11.5.228 protected
  • 2.11.5.226 protected
  • 2.11.5.225 protected
  • 2.11.5.223 protected
  • 2.11.5.221 protected
  • 2.11.5.220 protected
  • 2.11.5.219 protected
  • 2.11.5.218 protected
  • 2.11.5.217 protected
  • 2.11.5 protected
  • 2.11.2.159 protected
  • 2.11.4 protected
  • 2.11.2.155 protected
41 results

alter_with_compression_test.lua

Blame
  • user avatar
    Oleg Chaplashkin authored and Yaroslav Lobankov committed
    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
    History
    alter_with_compression_test.lua 3.08 KiB
    local server = require('luatest.server')
    local t = require('luatest')
    
    local g = t.group("invalid compression type", t.helpers.matrix({
        engine = {'memtx', 'vinyl'},
        compression = {'zstd', 'lz4'}
    }))
    
    g.before_all(function(cg)
        cg.server = server:new({alias = 'master'})
        cg.server:start()
    end)
    
    g.after_all(function(cg)
        cg.server:stop()
    end)
    
    g.test_invalid_compression_type_during_space_creation = function(cg)
        t.tarantool.skip_if_enterprise()
        cg.server:exec(function(engine, compression)
            local format = {{
                name = 'x', type = 'unsigned', compression = compression
            }}
            t.assert_error_msg_content_equals(
                "Wrong space format field 1: unknown compression type",
                box.schema.space.create, 'T', {engine = engine, format = format})
        end, {cg.params.engine, cg.params.compression})
    end
    
    g.before_test('test_invalid_compression_type_during_setting_format', function(cg)
        cg.server:exec(function(engine)
            box.schema.space.create('space', {engine = engine})
        end, {cg.params.engine})
    end)
    
    g.test_invalid_compression_type_during_setting_format = function(cg)
        t.tarantool.skip_if_enterprise()
        cg.server:exec(function(compression)
            local format = {{
                name = 'x', type = 'unsigned', compression = compression
            }}
            t.assert_error_msg_content_equals(
                "Wrong space format field 1: unknown compression type",
                box.space.space.format, box.space.space, format)
            t.assert_error_msg_content_equals(
                "Wrong space format field 1: unknown compression type",
                box.space.space.alter, box.space.space, {format = format})
        end, {cg.params.compression})
    end
    
    g.after_test('test_invalid_compression_type_during_setting_format', function(cg)
        cg.server:exec(function()
            box.space.space:drop()
        end)
    end)
    
    g = t.group("none compression", t.helpers.matrix({
        engine = {'memtx', 'vinyl'},
    }))
    
    g.before_all(function(cg)
        cg.server = server:new({alias = 'master'})
        cg.server:start()
    end)
    
    g.after_all(function(cg)
        cg.server:stop()
    end)
    
    g.test_none_compression_during_space_creation = function(cg)
        cg.server:exec(function(engine)
            local format = {{
                name = 'x', type = 'unsigned', compression = 'none'
            }}
            t.assert(box.schema.space.create('T', {
                engine = engine, format = format
            }))
        end, {cg.params.engine})
    end
    
    g.before_test('test_none_compression_during_setting_format', function(cg)
        cg.server:exec(function(engine)
            box.schema.space.create('space', {engine = engine})
        end, {cg.params.engine})
    end)
    
    g.test_none_compression_during_setting_format = function(cg)
        cg.server:exec(function()
            local format = {{
                name = 'x', type = 'unsigned', compression = 'none'
            }}
            t.assert_equals(box.space.space:format(format), nil)
            t.assert_equals(box.space.space:alter({format = format}), nil)
        end)
    end
    
    g.after_test('test_none_compression_during_setting_format', function(cg)
        cg.server:exec(function()
            box.space.space:drop()
        end)
    end)