fix: avoid None.strip() error in TCP mode by checking server_socket #633
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What problem were solved in this pull request?
Issue Number: close #xxx
Problem:
When
server_socketparameter isNone(which is valid when using TCP port mode only), the code callsserver_socket.strip()which raises anAttributeErrorbecauseNonehas nostrip()method. This prevents the test framework from initializing properly when Unix socket is not configured.What is changed and how it works?
Modified all occurrences of
server_socket.strip()toserver_socket.strip() if server_socket else ''in the following test files:test/integration_test/miniob/miniob_client.py- Line 36test/integration_test/miniob/miniob_server.py- Line 57test/integration_test/miniob_test_util.py- Lines 129 and 391test/case/miniob_test.py- Lines 113 and 277This change ensures that when
server_socketisNone, it is safely converted to an empty string, allowing the code to fall back to TCP port mode. The existing logic already handles empty strings correctly by checkingif len(self.__server_socket) > 0before attempting to use Unix socket.Other information
This is a minimal fix that improves the robustness of the test framework by handling the case where Unix socket is not configured.