-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
fix: some issues with the syntax specification of the master-slave synchronization test script #1776
Conversation
.github/workflows/pika.yml
Outdated
working-directory: ${{github.workspace}}/build | ||
run: | | ||
export CC=/usr/local/opt/gcc@10/bin/gcc-10 | ||
ctest -C ${{env.BUILD_TYPE}} | ||
|
||
- name: Unit Test | ||
working-directory: ${{github.workspace}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the provided code patch, here are some observations and suggestions for improvement:
-
The changes made to the code seem fine. The only modification is the addition of the
-DUSE_PIKA_TOOLS=ON
flag in thecmake
command, which sets a CMake variable. -
The commented out section related to the "Test" step suggests that it was previously disabled. If you decide to uncomment and enable it, make sure it is still relevant and functioning correctly.
-
In the "Test" step, the
export CC=/usr/local/opt/gcc@10/bin/gcc-10
line is duplicated from the previous step. Consider removing duplication and placing it in the environment section at the job level so that it applies to all steps within the job. -
It's generally a good practice to add error handling and logging to the script or commands for better troubleshooting and debugging. This can help identify any potential issues during the execution of the CI/CD pipeline.
-
Make sure the paths and dependencies (
/usr/local/opt/gcc@10/bin/gcc-10
) mentioned in the code patch are valid and accessible in the build environment.
Overall, the code looks fine, but it's hard to provide an in-depth review without further context about the specific requirements and purpose of the code.
.github/workflows/pika.yml
Outdated
working-directory: ${{github.workspace}}/build | ||
run: | | ||
export CC=/usr/local/opt/gcc@10/bin/gcc-10 | ||
ctest -C ${{env.BUILD_TYPE}} | ||
|
||
- name: Unit Test | ||
working-directory: ${{github.workspace}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the provided code patch, here's a brief code review:
-
In the
run
step for theTest
job, there are commented out lines regarding exporting CC and running ctest. If these lines are intentionally commented out, that's fine. Otherwise, you can remove those comments to enable the code. -
It's generally recommended to specify the version of GCC using an environment variable rather than hardcoding the path. This allows for more flexibility in case the GCC version changes or if different environments require different versions. You can consider modifying the line
export CC=/usr/local/opt/gcc@10/bin/gcc-10
to use an environment variable instead. -
The
working-directory
key is correctly set for theTest
job when running ctest in the build directory.
Overall, the code patch appears to be in good shape, with no evident bug risks. The improvements mentioned above are more related to best practices and flexibility.
.github/workflows/pika.yml
Outdated
working-directory: ${{github.workspace}}/build | ||
run: | | ||
export CC=/usr/local/opt/gcc@10/bin/gcc-10 | ||
ctest -C ${{env.BUILD_TYPE}} | ||
|
||
- name: Unit Test | ||
working-directory: ${{github.workspace}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the given code patch, here is a brief code review:
-
Line 158: The change in this line looks fine. It sets the build directory path explicitly to
$github.workspace/build
. -
Lines 165-173: It appears that the block of code related to the "Test" step was commented out by prefixing each line with
#
. If you want to enable this step, you can remove the comment prefix (#
) from these lines. -
Lines 176-182: The changes made for the "Unit Test" step look fine. It sets the working directory to
$github.workspace
and runs thectest
command.
Overall, the code patch seems to be mostly fine. The only improvement suggestion is to ensure proper indentation and consistency throughout the file.
working-directory: ${{github.workspace}}/build | ||
run: | | ||
python3 ../tests/integration/pika_replication_test.py | ||
python3 ../tests/unit/Blpop_Brpop_test.py | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, the code patch seems fine with no significant bug risks. Here are a few suggestions for improvement:
-
Use consistent indentation: Ensure that the indentation is consistent throughout the code to improve readability.
-
Use relative paths consistently: The
cmake -B
command specifies an absolute path (${{github.workspace}}/build
) in one instance but uses a relative path (build
) in another instance. It's recommended to use relative paths consistently for better portability. You can remove${{github.workspace}}
from both instances and letcd ${{github.workspace}}
take care of setting the correct working directory. -
Add error handling: Consider adding error handling and checks for success/failure after each command execution to handle any potential failures gracefully.
-
Remove commented-out code: In the provided code snippet, there is a commented-out section for the "Test" job. If it's not needed anymore, it's good practice to remove such commented-out code to keep the codebase clean.
-
Clarify script dependencies: It's unclear if the Python scripts referenced (
pika_replication_test.py
andBlpop_Brpop_test.py
) have any additional dependencies or need specific versions of Python. Ensuring clear documentation or specifying version requirements would be helpful for anyone else working on the code.
sed -i -e 's|databases : 1|databases : 2|' -e 's|#daemonize : yes|daemonize : yes|' ./pika_master.conf | ||
sed -i -e 's|databases : 1|databases : 2|' -e 's|port : 9221|port : 9231|' -e 's|log-path : ./log/|log-path : ./slave_data/log/|' -e 's|db-path : ./db/|db-path : ./slave_data/db/|' -e 's|dump-path : ./dump/|dump-path : ./slave_data/dump/|' -e 's|pidfile : ./pika.pid|pidfile : ./slave_data/pika.pid|' -e 's|db-sync-path : ./dbsync/|db-sync-path : ./slave_data/dbsync/|' -e 's|#daemonize : yes|daemonize : yes|' ./pika_slave.conf | ||
sed -i ' ' -e 's|databases : 1|databases : 2|' -e 's|#daemonize : yes|daemonize : yes|' ./pika_master.conf | ||
sed -i ' ' -e 's|databases : 1|databases : 2|' -e 's|port : 9221|port : 9231|' -e 's|log-path : ./log/|log-path : ./slave_data/log/|' -e 's|db-path : ./db/|db-path : ./slave_data/db/|' -e 's|dump-path : ./dump/|dump-path : ./slave_data/dump/|' -e 's|pidfile : ./pika.pid|pidfile : ./slave_data/pika.pid|' -e 's|db-sync-path : ./dbsync/|db-sync-path : ./slave_data/dbsync/|' -e 's|#daemonize : yes|daemonize : yes|' ./pika_slave.conf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
应该也可以用''吧?
…ynchronization test script
working-directory: ${{github.workspace}}/build | ||
run: | | ||
python3 ../tests/integration/pika_replication_test.py | ||
python3 ../tests/unit/Blpop_Brpop_test.py | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are some observations and suggestions for your code review:
-
It seems that the change made in line 158 is a simple modification of the
cmake
command to use the$github.workspace
variable instead of manually specifying the directory path. -
In the new step "Run Python E2E Tests," you are specifying the working directory explicitly using the
working-directory
field. This is a good practice as it ensures that the subsequent commands run in the correct context. -
It's generally recommended to use consistent formatting and style throughout your codebase. In this case, there are differences in indentation and spacing, but it might just be due to pasting the code here.
-
It would be beneficial to have more information about the overall context of the code, such as the purpose and structure of the repository and any specific requirements or constraints you need to consider for the code review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
…nchronization test script (OpenAtomFoundation#1776) * Fixed some issues with the syntax specification of the master-slave synchronization test script
…nchronization test script (OpenAtomFoundation#1776) * Fixed some issues with the syntax specification of the master-slave synchronization test script
Fixed some issues with the syntax specification of the master-slave synchronization test script
fix: #1758