Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Proposal to fix #154 (v2) #161

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

Merged
merged 13 commits into from
Dec 10, 2024

Conversation

dmitry-lipetsk
Copy link
Collaborator

This patch is normalizing an usage of ExecUtilException in exec_command methods - ExecUtilException::message now contains an only string data.

I also added ExecUtilException::error property to transfer an original error data to client.

PostgresNode::psql uses only OsOperations::exec_command. Usage of subprocess.Popen is deleted.

Failed tests those wait an binary error message in ExecUtilException::message are corrected.

This patch was tested with internal tests for probackup v2 - all is OK. Change of this tests is not required.

Summary of changes

  • The one way to generate ExecUtilException - RaiseError.UtilityExitedWithNonZeroCode
  • RaiseError is added
  • ExecUtilException::error is added (it contains the error data)
  • ExecUtilException::str is updated
  • PostgresNode::psql and PostgresNode::safe_psql are updated
  • TestLocalOperations::test_exec_command_failure is updated
  • TestRemoteOperations::test_exec_command_failure is updated
  • TestRemoteOperations::test_makedirs_and_rmdirs_failure is updated

- The one way to generate ExecUtilException - RaiseError.UtilityExitedWithNonZeroCode
- RaiseError is added
- ExecUtilException::error is added (it contains the error data)
- ExecUtilException::__str__ is updated
- PostgresNode::psql and PostgresNode::safe_psql are updated
- TestLocalOperations::test_exec_command_failure is updated
- TestRemoteOperations::test_exec_command_failure is updated
- TestRemoteOperations::test_makedirs_and_rmdirs_failure is updated
…al_op]

Both LocalOperations::exec_command and RemoteOperations::exec_command were updated.
If expect_error is True and no error is detected, safe_psql raises InvalidOperationException exception.

Tests (local, remote) are added.
…e_returns

It fixes a problem with this test on Windows.
The previous order of imports is restored for minimization number of changes.
Let's store our things on one place.

We use RaiseError only in testgres/operations structures currently.
This function is equal to os_ops.get_default_encoding and is used in:
 - Helpers.PrepareProcessInput
 - RaiseError._TranslateDataIntoString__FromBinary
- New debug checks
- Normalization
Copy link
Collaborator Author

@dmitry-lipetsk dmitry-lipetsk left a comment

Choose a reason for hiding this comment

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

I hope this new code make testgres better :)

@dmitry-lipetsk dmitry-lipetsk merged commit b949eb8 into postgrespro:master Dec 10, 2024
1 check passed
@dmitry-lipetsk dmitry-lipetsk mentioned this pull request Dec 10, 2024
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