Skip to content
Snippets Groups Projects
Commit 7dc64b7a authored by Kurdakov Alexander's avatar Kurdakov Alexander Committed by Alexander Kurdakov
Browse files

feat: new argument for `picodata expel`

New argument `--timeout` for `picodata expel`.
parent 4e0abeae
No related branches found
No related tags found
Loading
Pipeline #52182 failed
......@@ -21,6 +21,9 @@ with the `YY.MINOR.MICRO` scheme.
- Default authentication method changed from `CHAP-SHA1` to `MD5` both for user creation and in connect CLI. This change affects new user creation and all system users (except the `pico_service` user), as a command-line interface of `picodata connect` and `picodata expel`. Also, default schema version at cluster boot is now `1`, not `0` as it was previously.
Connection via `Pgproto` no longer requires additional manual step to change the authentication method. However if you use `iproto` the admin will have to manually change the authentication type.
- New `picodata connect` and `picodata expel` argument `--timeout` for specifying
the timeout for address resolving operation.
- Support human numbers to configure memtx.memory.
Supported suffixes: K, M, G, T, 1K = 1024
(e.g picodata run --memtx-memory 10G)
......
......@@ -378,6 +378,16 @@ pub struct Expel {
)]
/// The preferred authentication method.
pub auth_method: AuthMethod,
#[clap(
short = 't',
long = "timeout",
value_name = "TIMEOUT",
default_value = "5",
env = "PICODATA_CONNECT_TIMEOUT"
)]
/// Connection timeout in seconds.
pub timeout: u64,
}
impl Expel {
......
......@@ -13,6 +13,7 @@ pub async fn tt_expel(args: args::Expel) -> Result<(), Error> {
Some("admin"),
args.password_file.as_deref(),
args.auth_method,
args.timeout,
)?;
let req = ExpelRequest {
......
import pytest
import sys
import pexpect # type: ignore
from conftest import Cluster, Instance, Retriable, log_crawler
......@@ -108,3 +110,31 @@ def test_raft_id_after_expel(cluster: Cluster):
i4 = cluster.add_instance()
assert i4.raft_id == 4
def test_expel_timeout(cluster: Cluster):
cluster.deploy(instance_count=1)
[i1] = cluster.instances
timeout = 1
# If the peer is not resolving, by default we hang on
# for 5 seconds. We can change it by specifying `timeout`.
cli = pexpect.spawn(
cwd=i1.data_dir,
command=i1.binary_path,
args=[
"expel",
"random_instance_id",
f"--timeout={timeout}",
"--peer=10001",
],
encoding="utf-8",
timeout=10,
)
cli.logfile = sys.stdout
cli.expect_exact("Enter password for admin:")
cli.sendline("wrong_password")
cli.expect_exact("CRITICAL: connect timeout")
cli.expect_exact(pexpect.EOF)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment