Skip to content

PBM. Add PBM CLI validation#424

Draft
sandraromanchenko wants to merge 1 commit into
mainfrom
pbm_cli
Draft

PBM. Add PBM CLI validation#424
sandraromanchenko wants to merge 1 commit into
mainfrom
pbm_cli

Conversation

@sandraromanchenko
Copy link
Copy Markdown
Collaborator

No description provided.

This comment was marked as outdated.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive CLI validation tests for the PBM (Percona Backup for MongoDB) tool. The changes introduce a new test file that validates various PBM command-line interface commands and their error handling.

  • Adds CLI validation tests for all major PBM commands (backup, restore, config, list, etc.)
  • Implements Docker-based test environment setup with MongoDB replica set initialization
  • Tests both valid and invalid parameter combinations with proper error message validation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread pbm-functional/pytest/test_cli_validation.py Outdated
Comment thread pbm-functional/pytest/test_cli_validation.py Outdated

result = n.run("pbm delete-backup -y --older-than=2025-01-01")
try:
assert result.rc == 0, "Delete-backup with --older-than should fail"
Copy link

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assertion message says the command 'should fail' but the assertion checks for success (rc == 0). This is contradictory and indicates either the assertion or the message is incorrect.

Suggested change
assert result.rc == 0, "Delete-backup with --older-than should fail"
assert result.rc != 0, "Delete-backup with --older-than should fail"

Copilot uses AI. Check for mistakes.
result = n.run("pbm restore")
try:
assert result.rc != 0, "Restore without arguments should fail"
assert "specify a backup name, --time, or --external" in result.stderr
Copy link

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assertion checks for an exact error message string without using .lower() like other similar assertions in the file. For consistency and robustness, consider using .lower() to make the check case-insensitive.

Suggested change
assert "specify a backup name, --time, or --external" in result.stderr
assert "specify a backup name, --time, or --external" in result.stderr.lower()

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants