Skip to content

Commit d6a1753

Browse files
committed
Admin/XMover: Forward process output to user when CLI tests fail
1 parent a48d9fc commit d6a1753

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

tests/admin/test_problematic_translogs.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def test_no_problematic_shards(self):
2424
with patch("cratedb_toolkit.admin.xmover.util.database.CrateDBClient", return_value=self.mock_client):
2525
result = self.runner.invoke(cli, ["problematic-translogs", "--size-mb", "300"])
2626

27-
assert result.exit_code == 0
27+
assert result.exit_code == 0, result.output
2828
assert "No replica shards found" in result.output
2929
assert "300MB" in result.output
3030

@@ -40,7 +40,7 @@ def test_non_partitioned_table_command_generation(self):
4040
with patch("cratedb_toolkit.admin.xmover.util.database.CrateDBClient", return_value=self.mock_client):
4141
result = self.runner.invoke(cli, ["problematic-translogs", "--size-mb", "300"])
4242

43-
assert result.exit_code == 0
43+
assert result.exit_code == 0, result.output
4444
assert "Found 2 shards with problematic translogs" in result.output
4545
# Check that the query results table is shown
4646
assert "Problematic Replica Shards" in result.output
@@ -65,7 +65,7 @@ def test_partitioned_table_command_generation(self):
6565
with patch("cratedb_toolkit.admin.xmover.util.database.CrateDBClient", return_value=self.mock_client):
6666
result = self.runner.invoke(cli, ["problematic-translogs", "--size-mb", "400"])
6767

68-
assert result.exit_code == 0
68+
assert result.exit_code == 0, result.output
6969
assert "Found 1 shards with problematic translogs" in result.output
7070
# Check that the query results table is shown
7171
assert "Problematic Replica Shards" in result.output
@@ -89,7 +89,7 @@ def test_mixed_partitioned_non_partitioned(self):
8989
with patch("cratedb_toolkit.admin.xmover.util.database.CrateDBClient", return_value=self.mock_client):
9090
result = self.runner.invoke(cli, ["problematic-translogs", "--size-mb", "200"])
9191

92-
assert result.exit_code == 0
92+
assert result.exit_code == 0, result.output
9393
assert "Found 3 shards with problematic translogs" in result.output
9494
# Check that the query results table is shown
9595
assert "Problematic Replica Shards" in result.output
@@ -141,7 +141,7 @@ def test_cancel_flag_user_confirmation_no(self):
141141
):
142142
result = self.runner.invoke(cli, ["problematic-translogs", "--cancel"])
143143

144-
assert result.exit_code == 0
144+
assert result.exit_code == 0, result.output
145145
assert "Operation cancelled by user" in result.output
146146
# Should only be called once for the initial query, not for execution
147147
assert self.mock_client.execute_query.call_count == 1
@@ -157,7 +157,7 @@ def test_cancel_flag_user_confirmation_yes(self):
157157
), patch("time.sleep"): # Mock sleep to speed up test
158158
result = self.runner.invoke(cli, ["problematic-translogs", "--cancel"])
159159

160-
assert result.exit_code == 0
160+
assert result.exit_code == 0, result.output
161161
assert "Executing ALTER commands" in result.output
162162
assert "Command 1 executed successfully" in result.output
163163
assert "Successful: 1" in result.output
@@ -178,7 +178,7 @@ def test_execution_failure_handling(self):
178178
), patch("time.sleep"):
179179
result = self.runner.invoke(cli, ["problematic-translogs", "--cancel"])
180180

181-
assert result.exit_code == 0
181+
assert result.exit_code == 0, result.output
182182
assert "Command 1 failed: Shard not found" in result.output
183183
assert "Failed: 1" in result.output
184184
assert "Successful: 0" in result.output
@@ -191,7 +191,7 @@ def test_database_error_handling(self):
191191
with patch("cratedb_toolkit.admin.xmover.util.database.CrateDBClient", return_value=self.mock_client):
192192
result = self.runner.invoke(cli, ["problematic-translogs"])
193193

194-
assert result.exit_code == 0
194+
assert result.exit_code == 0, result.output
195195
assert "Error analyzing problematic translogs" in result.output
196196
assert "Connection failed" in result.output
197197

@@ -203,7 +203,7 @@ def test_default_size_mb(self):
203203
with patch("cratedb_toolkit.admin.xmover.util.database.CrateDBClient", return_value=self.mock_client):
204204
result = self.runner.invoke(cli, ["problematic-translogs"])
205205

206-
assert result.exit_code == 0
206+
assert result.exit_code == 0, result.output
207207
assert "300MB" in result.output
208208

209209
# Verify query was called with default value

0 commit comments

Comments
 (0)