Skip to content
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

Merged
merged 4 commits into from
Jul 20, 2023

Conversation

Mixficsol
Copy link
Collaborator

@Mixficsol Mixficsol commented Jul 20, 2023

Fixed some issues with the syntax specification of the master-slave synchronization test script
fix: #1758

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}}
Copy link

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:

  1. The changes made to the code seem fine. The only modification is the addition of the -DUSE_PIKA_TOOLS=ON flag in the cmake command, which sets a CMake variable.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

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}}
Copy link

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:

  1. In the run step for the Test 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.

  2. 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.

  3. The working-directory key is correctly set for the Test 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.

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}}
Copy link

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:

  1. Line 158: The change in this line looks fine. It sets the build directory path explicitly to $github.workspace/build.

  2. 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.

  3. Lines 176-182: The changes made for the "Unit Test" step look fine. It sets the working directory to $github.workspace and runs the ctest command.

Overall, the code patch seems to be mostly fine. The only improvement suggestion is to ensure proper indentation and consistency throughout the file.

@Mixficsol Mixficsol changed the title 【WIF】Test Macos CTest Fixed some issues with the syntax specification of the master-slave synchronization test script Jul 20, 2023
working-directory: ${{github.workspace}}/build
run: |
python3 ../tests/integration/pika_replication_test.py
python3 ../tests/unit/Blpop_Brpop_test.py

Copy link

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:

  1. Use consistent indentation: Ensure that the indentation is consistent throughout the code to improve readability.

  2. 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 let cd ${{github.workspace}} take care of setting the correct working directory.

  3. Add error handling: Consider adding error handling and checks for success/failure after each command execution to handle any potential failures gracefully.

  4. 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.

  5. Clarify script dependencies: It's unclear if the Python scripts referenced (pika_replication_test.py and Blpop_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.

@Mixficsol Mixficsol changed the title Fixed some issues with the syntax specification of the master-slave synchronization test script fix: some issues with the syntax specification of the master-slave synchronization test script Jul 20, 2023
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
Copy link
Contributor

Choose a reason for hiding this comment

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

应该也可以用''吧?

working-directory: ${{github.workspace}}/build
run: |
python3 ../tests/integration/pika_replication_test.py
python3 ../tests/unit/Blpop_Brpop_test.py

Copy link

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:

  1. 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.

  2. 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.

  3. 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.

  4. 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.

Copy link
Contributor

@yaoyinnan yaoyinnan left a comment

Choose a reason for hiding this comment

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

lgtm

@Mixficsol Mixficsol requested a review from chejinge July 20, 2023 14:08
@chejinge chejinge merged commit 514d7ab into OpenAtomFoundation:unstable Jul 20, 2023
9 checks passed
@Mixficsol Mixficsol deleted the atomme branch July 20, 2023 15:23
bigdaronlee163 pushed a commit to bigdaronlee163/pika that referenced this pull request Jun 8, 2024
…nchronization test script (OpenAtomFoundation#1776)

* Fixed some issues with the syntax specification of the master-slave synchronization test script
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.

支持在 macos 上跑 CI
3 participants