Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Updating of CI-tests #197

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
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
7d8302f
Test dockerfile for ubuntu 24.04 is added
dmitry-lipetsk Feb 26, 2025
2df2fd4
Cleanup (Dockerfile--ubuntu-24_04)
dmitry-lipetsk Feb 26, 2025
e8bf7d6
Cleanup.
dmitry-lipetsk Feb 27, 2025
103bcd2
[run_tests.sh] A right way for obtaining of BINDIR and PG_CONFIG is …
dmitry-lipetsk Feb 27, 2025
d0eb414
Merge remote-tracking branch 'origin/D20250227_001--pg_config-bindir'…
dmitry-lipetsk Feb 27, 2025
579d20e
Dockerfile--ubuntu-24_04 is updated
dmitry-lipetsk Feb 27, 2025
e87c402
Dockerfile--ubuntu-24_04 is updated (cleanup)
dmitry-lipetsk Feb 27, 2025
b88327d
Merge commit '9911ed0c928b602c17a3b0845b24910bf291925a' into D2025022…
dmitry-lipetsk Feb 27, 2025
126b5a8
Merge commit '6d67da2170becb944fc768ff4938f88b37e0f2a4' into D2025022…
dmitry-lipetsk Feb 27, 2025
96227f5
Dockerfile--ubuntu-24_04 is updated (cleanup)
dmitry-lipetsk Feb 27, 2025
b7bf713
Dockerfile--ubuntu-24_04 is formatted
dmitry-lipetsk Feb 27, 2025
bcb7771
CI-test on Ubuntu 24.04 is added.
dmitry-lipetsk Feb 27, 2025
7d871a2
Dockerfile--std.tmpl is updated (refactoring)
dmitry-lipetsk Feb 27, 2025
381d64d
Dockerfile--ubuntu-24_04.tmpl is updated
dmitry-lipetsk Feb 27, 2025
b5c4d7b
PostgresNode::pid is improved
dmitry-lipetsk Feb 27, 2025
fce595a
PostgresNode::pid is updated
dmitry-lipetsk Feb 27, 2025
a92a6e7
Merge remote-tracking branch 'origin/D20250227_001--node-pid' into D2…
dmitry-lipetsk Feb 27, 2025
0aebc00
Merge branch 'master' into D20250227_001--node-pid
dmitry-lipetsk Feb 28, 2025
ebd6208
Merge branch 'master' into D20250226_001--ci_and_ssh
dmitry-lipetsk Feb 28, 2025
0863cf5
execute_utility2 is updated (ignore_errors)
dmitry-lipetsk Feb 28, 2025
a4e65bf
Merge branch 'D20250228_001--execute_utility2' into D20250227_001--no…
dmitry-lipetsk Feb 28, 2025
09976ae
PostgresNode::_try_shutdown is rewrited (normalization)
dmitry-lipetsk Feb 28, 2025
ab28c2e
Merge branch '20250228_002--try_shutdown' into D20250227_001--node-pid
dmitry-lipetsk Feb 28, 2025
0402c4a
PostgresNode::pid uses the data from "pg_ctl status" output.
dmitry-lipetsk Feb 28, 2025
c288af8
Merge remote-tracking branch 'origin/D20250227_001--node-pid' into D2…
dmitry-lipetsk Feb 28, 2025
45d2b17
PostgresNode::_try_shutdown is correct (return None)
dmitry-lipetsk Feb 28, 2025
a960ac7
Merge branch '20250228_002--try_shutdown' into D20250227_001--node-pid
dmitry-lipetsk Feb 28, 2025
5c6548f
Merge remote-tracking branch 'origin/D20250227_001--node-pid' into D2…
dmitry-lipetsk Feb 28, 2025
619fefa
[RemoteOperations] A call of mktemp is fixed
dmitry-lipetsk Feb 28, 2025
015b766
Merge remote-tracking branch 'origin/D20250228_001--remote-mktemp' in…
dmitry-lipetsk Feb 28, 2025
82981f5
Merge branch 'master' into D20250227_001--node-pid
dmitry-lipetsk Mar 1, 2025
61d8929
Merge remote-tracking branch 'origin/D20250227_001--node-pid' into D2…
dmitry-lipetsk Mar 1, 2025
3c2b51f
Merge branch 'master' into D20250226_001--ci_and_ssh
dmitry-lipetsk Mar 1, 2025
76e9c53
Merge branch 'master' into D20250226_001--ci_and_ssh
dmitry-lipetsk Mar 1, 2025
1309442
Total refactoring of os_ops::execute_command
dmitry-lipetsk Mar 1, 2025
9b7c10e
Merge remote-tracking branch 'origin/D20250301_01--os_ops-exec_comman…
dmitry-lipetsk Mar 1, 2025
e245e23
Dockerfile--ubuntu-24_04.tmpl is updated
dmitry-lipetsk Mar 1, 2025
d843df6
The old behaviour of RaiseError.UtilityExitedWithNonZeroCode is restored
dmitry-lipetsk Mar 1, 2025
afb4a3d
Merge remote-tracking branch 'origin/D20250301_01--os_ops-exec_comman…
dmitry-lipetsk Mar 1, 2025
25c7c0f
TestRemoteOperations::test_is_executable_true is corrected
dmitry-lipetsk Mar 1, 2025
c4cbaf3
Merge branch 'D20250301_002--remote_ops_tests-test_is_executable_true…
dmitry-lipetsk Mar 1, 2025
491b693
Merge branch 'master' into D20250226_001--ci_and_ssh
dmitry-lipetsk Mar 1, 2025
5cec260
xxx::test_logging is corrected (local, remote)
dmitry-lipetsk Mar 2, 2025
6a70944
Merge remote-tracking branch 'origin/D20250302_001--test_logging' int…
dmitry-lipetsk Mar 2, 2025
d15e29c
TEST_FILTER is added
dmitry-lipetsk Mar 2, 2025
9329f22
CI on Ubuntu 24.04 runs all the tests
dmitry-lipetsk Mar 2, 2025
62ae15c
Merge branch 'master' into D20250226_001--ci_and_ssh
dmitry-lipetsk Mar 2, 2025
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
1 change: 1 addition & 0 deletions testgres/operations/local_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ def exec_command(self, cmd, wait_exit=False, verbose=False, expect_error=False,
RaiseError.UtilityExitedWithNonZeroCode(
cmd=cmd,
exit_code=process.returncode,
msg_arg=error or output,
error=error,
out=output)

Expand Down
34 changes: 32 additions & 2 deletions testgres/operations/raise_error.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
from ..exceptions import ExecUtilException
from .helpers import Helpers


class RaiseError:
@staticmethod
def UtilityExitedWithNonZeroCode(cmd, exit_code, error, out):
def UtilityExitedWithNonZeroCode(cmd, exit_code, msg_arg, error, out):
assert type(exit_code) == int # noqa: E721

msg_arg_s = __class__._TranslateDataIntoString(msg_arg)
assert type(msg_arg_s) == str # noqa: E721

msg_arg_s = msg_arg_s.strip()
if msg_arg_s == "":
msg_arg_s = "#no_error_message"

message = "Utility exited with non-zero code (" + str(exit_code) + "). Error: `" + msg_arg_s + "`"
raise ExecUtilException(
message="Utility exited with non-zero code.",
message=message,
command=cmd,
exit_code=exit_code,
out=out,
Expand All @@ -25,3 +34,24 @@ def CommandExecutionError(cmd, exit_code, message, error, out):
exit_code=exit_code,
out=out,
error=error)

@staticmethod
def _TranslateDataIntoString(data):
if data is None:
return ""

if type(data) == bytes: # noqa: E721
return __class__._TranslateDataIntoString__FromBinary(data)

return str(data)

@staticmethod
def _TranslateDataIntoString__FromBinary(data):
assert type(data) == bytes # noqa: E721

try:
return data.decode(Helpers.GetDefaultEncoding())
except UnicodeDecodeError:
pass

return "#cannot_decode_text"
3 changes: 2 additions & 1 deletion testgres/operations/remote_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def exec_command(self, cmd, wait_exit=False, verbose=False, expect_error=False,
RaiseError.UtilityExitedWithNonZeroCode(
cmd=cmd,
exit_code=process.returncode,
msg_arg=error,
error=error,
out=output)

Expand Down Expand Up @@ -180,7 +181,7 @@ def is_executable(self, file):
exit_status,
file)

RaiseError.UtilityExitedWithNonZeroCode(
RaiseError.CommandExecutionError(
cmd=command,
exit_code=exit_status,
msg_arg=errMsg,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_exec_command_failure(self):
try:
self.operations.exec_command(cmd, wait_exit=True, shell=True)
except ExecUtilException as e:
assert e.message == "Utility exited with non-zero code."
assert e.message == "Utility exited with non-zero code (127). Error: `/bin/sh: 1: nonexistent_command: not found`"
assert type(e.error) == bytes # noqa: E721
assert e.error.strip() == b"/bin/sh: 1: nonexistent_command: not found"
break
Expand Down
4 changes: 2 additions & 2 deletions tests/test_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_exec_command_failure(self):
try:
self.operations.exec_command(cmd, verbose=True, wait_exit=True)
except ExecUtilException as e:
assert e.message == "Utility exited with non-zero code."
assert e.message == "Utility exited with non-zero code (127). Error: `bash: line 1: nonexistent_command: command not found`"
assert type(e.error) == bytes # noqa: E721
assert e.error.strip() == b"bash: line 1: nonexistent_command: command not found"
break
Expand Down Expand Up @@ -109,7 +109,7 @@ def test_makedirs_and_rmdirs_failure(self):
try:
self.operations.rmdirs(path, verbose=True)
except ExecUtilException as e:
assert e.message == "Utility exited with non-zero code."
assert e.message == "Utility exited with non-zero code (1). Error: `rm: cannot remove '/root/test_dir': Permission denied`"
assert type(e.error) == bytes # noqa: E721
assert e.error.strip() == b"rm: cannot remove '/root/test_dir': Permission denied"
break
Expand Down