Skip to content

play: extend error message #1171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- `pack` with modules include only under root `tt` environment directory.
Modules outside of the directory with `tt.yaml` will be ignored.
- `tt connect|replicaset|cluster|aeon|play`: fixed using of IPv6 in instance URI.
- `play`: extend error message if space to play is unavailable or user
does not have permission to work with it, because the `net.box` module does not
have means to distinguish between these errors.

## [2.9.1] - 2025-04-15

Expand Down
4 changes: 2 additions & 2 deletions cli/checkpoint/lua/play.lua
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ local function play(positional_arguments, keyword_arguments, opts)
if sid ~= nil then
local args, so = {}, remote.space[sid]
if so == nil then
log.error('Fatal error: no space #%s, stopping work', sid)
os.exit(1)
log.error('Fatal error: no space #%s or permissions to work with it, stopping', sid)
os.exit(1)
end
table.insert(args, so)
table.insert(args, record.BODY.key)
Expand Down
51 changes: 42 additions & 9 deletions test/integration/play/test_play.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,33 @@ def test_play_remote_instance_timestamp_valid(tt_cmd, test_instance, input, expe
assert cmd_output == expected


def test_play_remote_instance_space_error(tt_cmd, test_instance):
test_dir = os.path.join(
os.path.dirname(__file__),
"test_file",
)

# Create space and primary index.
cmd_space = [tt_cmd, "connect", f"test_user:[email protected]:{test_instance.port}"]
rc, _ = run_command_and_get_output(cmd_space, cwd=test_instance._tmpdir)
assert rc == 0

# Play .xlog file to the instance.
cmd_play = [
tt_cmd,
"play",
f"127.0.0.1:{test_instance.port}",
"-u",
"test_user",
"-p",
"secret",
f"{test_dir}/timestamp/timestamp.xlog",
]
rc, output = run_command_and_get_output(cmd_play, cwd=test_instance._tmpdir)
assert rc == 1
assert "Fatal error: no space #512 or permissions to work with it, stopping" in output


@pytest.mark.parametrize(
"input, expected",
[
Expand Down Expand Up @@ -425,15 +452,21 @@ def test_play_to_ssl_app(tt_cmd, tmpdir_with_cfg):
app_path="test_simple_cluster_app",
instances=["master"],
)
@pytest.mark.parametrize("with_scheme", [
pytest.param(True, id="with-scheme"),
pytest.param(False, id="no-scheme"),
])
@pytest.mark.parametrize("uri", [
pytest.param("localhost:3013", id="hostname"),
pytest.param("127.0.0.1:3013", id="ipv4"),
pytest.param("[::1]:3013", id="ipv6"),
])
@pytest.mark.parametrize(
"with_scheme",
[
pytest.param(True, id="with-scheme"),
pytest.param(False, id="no-scheme"),
],
)
@pytest.mark.parametrize(
"uri",
[
pytest.param("localhost:3013", id="hostname"),
pytest.param("127.0.0.1:3013", id="ipv4"),
pytest.param("[::1]:3013", id="ipv6"),
],
)
def test_play_to_cluster_app_by_uri(tt, with_scheme, uri):
skip_if_cluster_app_unsupported()

Expand Down
Loading