diff --git a/src/luamod.rs b/src/luamod.rs index f841f3b42338b812a6cfb3d770be8009c86c4882..8458bbf6e4c1aa39f39199d746b6339107d0d063 100644 --- a/src/luamod.rs +++ b/src/luamod.rs @@ -1510,24 +1510,24 @@ pub(crate) fn setup() { 2. version - plugin version 3. opts (optional table) - timeout (optional number), in seconds, default: 10 - - if_not_exist (optional bool), in seconds, default: false + - if_not_exists (optional bool), in seconds, default: false "}, { #[derive(::tarantool::tlua::LuaRead)] struct Opts { timeout: Option<f64>, - if_not_exist: Option<bool>, + if_not_exists: Option<bool>, } tlua::function3(|name: String, version: String, opts: Option<Opts>| -> traft::Result<()> { let mut timeout = Duration::from_secs(10); - let mut if_not_exist = false; + let mut if_not_exists = false; if let Some(opts) = opts { - if_not_exist = opts.if_not_exist.unwrap_or_default(); + if_not_exists = opts.if_not_exists.unwrap_or_default(); if let Some(t) = opts.timeout { timeout = duration_from_secs_f64_clamped(t); } } - plugin::install_plugin(PluginIdentifier::new(name, version), timeout, if_not_exist) + plugin::install_plugin(PluginIdentifier::new(name, version), timeout, if_not_exists) }) }, ); diff --git a/test/int/test_plugin.py b/test/int/test_plugin.py index da3cd19df860a30f21b184cb64b3b205921b612c..c926b466c608e77af0c4e83c7e81352e0ab5578b 100644 --- a/test/int/test_plugin.py +++ b/test/int/test_plugin.py @@ -266,13 +266,13 @@ def install_and_enable_plugin( migrate=False, timeout=3, default_config=None, - if_not_exist=False, + if_not_exists=False, ): instance.call( "pico.install_plugin", plugin, version, - {"if_not_exist": if_not_exist}, + {"if_not_exists": if_not_exists}, timeout=timeout, ) if migrate: @@ -363,12 +363,12 @@ def test_plugin_install(cluster: Cluster): expected_state = expected_state.install(True) expected_state.assert_synced() - # check install already disabled plugin without if_not_exist opt + # check install already disabled plugin without if_not_exists opt with pytest.raises(ReturnError, match="Plugin `.*` already exists"): i1.call("pico.install_plugin", _PLUGIN, "0.1.0") - # check install already disabled plugin with if_not_exist opt - i1.call("pico.install_plugin", _PLUGIN, "0.1.0", {"if_not_exist": True}) + # check install already disabled plugin with if_not_exists opt + i1.call("pico.install_plugin", _PLUGIN, "0.1.0", {"if_not_exists": True}) expected_state.assert_synced() # enable plugin and check installation of already enabled plugin @@ -392,7 +392,7 @@ def test_plugin_install(cluster: Cluster): ).enable(True) expected_state.assert_synced() - i1.call("pico.install_plugin", _PLUGIN, _PLUGIN_VERSION_1, {"if_not_exist": True}) + i1.call("pico.install_plugin", _PLUGIN, "0.1.0", {"if_not_exists": True}) expected_state.assert_synced() # check that installation of another plugin version is ok @@ -678,7 +678,7 @@ def test_plugin_not_enable_if_error_on_start(cluster: Cluster): # assert that plugin not loaded and on_stop called on both instances with pytest.raises(ReturnError, match="Error while enable the plugin"): - install_and_enable_plugin(i1, _PLUGIN, _PLUGIN_SERVICES, if_not_exist=True) + install_and_enable_plugin(i1, _PLUGIN, _PLUGIN_SERVICES, if_not_exists=True) # plugin installed but disabled Retriable(timeout=3, rps=5).call(lambda: plugin_ref.assert_synced()) @@ -689,7 +689,7 @@ def test_plugin_not_enable_if_error_on_start(cluster: Cluster): plugin_ref.inject_error("testservice_1", "on_start", False, i2) # assert plugin loaded now - install_and_enable_plugin(i1, _PLUGIN, _PLUGIN_SERVICES, if_not_exist=True) + install_and_enable_plugin(i1, _PLUGIN, _PLUGIN_SERVICES, if_not_exists=True) plugin_ref = plugin_ref.enable(True).set_topology( {i1: _PLUGIN_SERVICES, i2: _PLUGIN_SERVICES} )