Conversation
| if: github.base_ref == 'develop' && github.event.pull_request.merged == false | ||
| uses: kbase/.github/.github/workflows/reusable_build.yml@main | ||
| secrets: inherit | ||
| build-develop-merge: |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
| if: github.base_ref == 'develop' && github.event.pull_request.merged == true | ||
| uses: kbase/.github/.github/workflows/reusable_build-push.yml@main | ||
| with: | ||
| name: '${{ github.event.repository.name }}-develop' | ||
| tags: pr-${{ github.event.number }},latest | ||
| secrets: inherit | ||
| build-main-open: |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
| if: (github.base_ref == 'main' || github.base_ref == 'master') && github.event.pull_request.merged == false | ||
| uses: kbase/.github/.github/workflows/reusable_build-push.yml@main | ||
| with: | ||
| name: '${{ github.event.repository.name }}' | ||
| tags: pr-${{ github.event.number }} | ||
| secrets: inherit | ||
| build-main-merge: |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
| if: (github.base_ref == 'main' || github.base_ref == 'master') && github.event.pull_request.merged == true | ||
| uses: kbase/.github/.github/workflows/reusable_build-push.yml@main | ||
| with: | ||
| name: '${{ github.event.repository.name }}' | ||
| tags: pr-${{ github.event.number }},latest-rc | ||
| secrets: inherit | ||
| trivy-scans: |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
| if: (github.base_ref == 'develop' || github.base_ref == 'main' || github.base_ref == 'master' ) && github.event.pull_request.merged == false | ||
| uses: kbase/.github/.github/workflows/reusable_trivy-scans.yml@main | ||
| secrets: inherit |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
| uses: kbase/.github/.github/workflows/reusable_validate-branch.yml@main | ||
| with: | ||
| build_branch: '${{ github.event.release.target_commitish }}' | ||
| validate-release-tag: |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
| needs: check-source-branch | ||
| uses: kbase/.github/.github/workflows/reusable_validate-release-tag.yml@main | ||
| with: | ||
| release_tag: '${{ github.event.release.tag_name }}' | ||
| build-push: |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
| needs: validate-release-tag | ||
| uses: kbase/.github/.github/workflows/reusable_build-push.yml@main | ||
| with: | ||
| name: '${{ github.event.repository.name }}' | ||
| tags: '${{ github.event.release.tag_name }},latest' | ||
| secrets: inherit |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
|
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #63 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 20 21 +1
Lines 658 660 +2
=========================================
+ Hits 658 660 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
self note:
|
There was a problem hiding this comment.
Standard question about boilerplate GHA yamls
There was a problem hiding this comment.
standard boilerplate GHA yamls
There was a problem hiding this comment.
not reviewing the vendored code here, assuming it's an exact C&P. If that's not true LMK
There was a problem hiding this comment.
not reviewing the vendored code here, assuming it's an exact C&P. If that's not true LMK
There was a problem hiding this comment.
I did add one line to fix the failing unit test; otherwise, it would raise a KeyError.
search_api2/jsonrpcbase/main.py
Line 59 in 4fd352a
There was a problem hiding this comment.
That suggests we're using the wrong version of this library, if there's a missing handler for an internal exception
There was a problem hiding this comment.
yeah, so the last commit for jsonrpcbase is alpha5: https://github.com/kbaseincubator/jsonrpcbase/commits/master/
But this codebase is using alpha6
There was a problem hiding this comment.
... never mind the fact that the codebase is using something labeled with an alpha at all
| container_process.send_signal(signal.SIGTERM) | ||
|
|
||
| # Stop and remove containers | ||
| cwd = 'tests/integration/docker' | ||
| subprocess.run("docker-compose --ansi never down", shell=True, check=True, cwd=cwd) |
There was a problem hiding this comment.
What changed such that the container no longer shuts down correctly?
There was a problem hiding this comment.
I'm not sure what you're asking. I didn't change anything that would cause the container to stop shutting down. It simply doesn't shut down when I start running the integration tests.
There was a problem hiding this comment.
Presumably the integration tests worked at some point in the past. That means that something changed so that the prior method of shutting down the container stopped working. I'm wondering what that change was.
There was a problem hiding this comment.
Yes, it needs to be logger.warning; otherwise, the unit test would not pass either.
We need to switch to docker-compose down approach. It was designed for this.
There was a problem hiding this comment.
The reason I'm continuing to ask questions is that the service should respond to a sigterm. What we're seeing is that it's not, and (I assume) the reason docker compose down is working is that it's sending a sigterm, waiting 10 seconds, and then sending a sigkill.
All that being said, this is pretty good evidence that I was wrong, and the devs did allow the tests to pass without the service responding to a sigterm: 728b712
As such, can you make an issue noting that the service / container needs to be updated to respond to sigterm correctly, and then go ahead with the docker compose down fix for now
There was a problem hiding this comment.
Without the or change, does it time out and print the warning?
If I change logger.warning to Exception in the unit tests, it will raise a timeout error. Now it kind of justifies why logger.warning is used in the unit tests.
There was a problem hiding this comment.
Oh great, there's a commit to verify my comment!
#63 (comment)
There was a problem hiding this comment.
fixed by docker compose to shut down the container/service
issue created: #64
| if not common.wait_for_line("container.err", | ||
| lambda line: 'Stopping' in line and 'done' in line, | ||
| if not common.wait_for_line("container.out", | ||
| lambda line: "exited with code 0" in line, |
There was a problem hiding this comment.
Same question - why the change?
There was a problem hiding this comment.
Running docker-compose down shuts the containers down gracefully, as confirmed by the presence of the "exited with code 0" message in the container.out file.
There was a problem hiding this comment.
Sending a sigterm also shuts the containers down gracefully. If a sigterm isn't enough, then docker is sending a sigkill which isn't a graceful shutdown
There was a problem hiding this comment.
When using container_process.send_signal(signal.SIGTERM), Docker will not automatically send a SIGKILL if the container does not stop. The behavior you described applies to docker stop and docker-compose.
There was a problem hiding this comment.
Right, what I'm saying is that the container shouldn't require a sigkill to stop - it should respond to just a sigterm
| assert res['error'] | ||
| assert res['error']['code'] == -32003 | ||
| assert res['error']['message'] == 'Server error' | ||
| assert res['error']['message'] == 'Elasticsearch response error' |
There was a problem hiding this comment.
Why did this change? This seems like a bug that should be fixed in the search api rather than adjusting the tests. I'm guessing an exception changed and is no longer being caught correctly?
There was a problem hiding this comment.
Based on the README documentation, -32003 represents an "Elasticsearch response error." This is also asserted on line 52. Additionally, I traced the code, and if it's correct, it should be raising an Elasticsearch response error.
search_api2/src/search2_rpc/service.py
Line 34 in e17f604
There was a problem hiding this comment.
I think this is probably related to #63 (comment)
The code in this PR is a revision behind that in the requirements toml file. I'd guess this is fixed in in the alpha 6 release
There was a problem hiding this comment.
Where is the Alpha6 release? Alpha5 is the vendored repository that we are currently using. Am i missing something?
There was a problem hiding this comment.
Search requires alpha 6, not alpha 5: https://github.com/kbase/search_api2/blob/develop/pyproject.toml#L14
As far as where that code lives, none of the branches in the jsonrpcbase repo look promising since they're all behind master. I'd extract it from pypi and update the readme to explain where the code came from
There was a problem hiding this comment.
Extracted jsonrpc alpha6 from PyPI, and the unit test passed.
There was a problem hiding this comment.
Did you have to make any changes or is it just strict C&P now?
There was a problem hiding this comment.
This is a direct copy with no changes. The only difference between alpha5 and alpha6 is the line 'message': RPC_ERRORS.get(code, 'Server error') in the main.py file.
| def test_search_objects_private_and_public_counts(service): | ||
| assert_counts(service, 1, 1, 12) | ||
| assert_counts(service, 1, 1, 21) | ||
|
|
||
|
|
||
| def test_search_objects_private_counts(service): | ||
| assert_counts(service, 1, 0, 5) | ||
| assert_counts(service, 1, 0, 12) | ||
|
|
||
|
|
||
| def test_search_objects_public_counts(service): | ||
| assert_counts(service, 0, 1, 9) | ||
| assert_counts(service, 0, 1, 11) |
There was a problem hiding this comment.
Just to be sure and leave a record: The data returned from the search api is a super set of the objects and workspaces in the response files in this repo, right?
There was a problem hiding this comment.
I verified that the data returned from the search API is a superset of the objects and workspaces in the response files (case-03-response.json) in this repository.
… integration tests
MrCreosote
left a comment
There was a problem hiding this comment.
Note to self: all comments above this review are resolved
| Simple JSON-RPC service without transport layer. | ||
|
|
||
| This repository includes a vendored copy of [jsonrpcbase](https://github.com/kbaseincubator/jsonrpcbase) to resolve dependency conflicts. | ||
|
|
||
| Specifically, this is version kbase-jsonrpcbase 0.3.0a6, extracted from [pypi](https://pypi.org/project/kbase-jsonrpcbase/) | ||
|
|
||
| The original repository was only used by this project, so the code has been brought in directly to simplify maintenance and eliminate external dependency issues. No newline at end of file |
There was a problem hiding this comment.
| Simple JSON-RPC service without transport layer. | |
| This repository includes a vendored copy of [jsonrpcbase](https://github.com/kbaseincubator/jsonrpcbase) to resolve dependency conflicts. | |
| Specifically, this is version kbase-jsonrpcbase 0.3.0a6, extracted from [pypi](https://pypi.org/project/kbase-jsonrpcbase/) | |
| The original repository was only used by this project, so the code has been brought in directly to simplify maintenance and eliminate external dependency issues. | |
| Simple JSON-RPC service without transport layer. | |
| This repository includes a vendored copy of [jsonrpcbase](https://pypi.org/project/kbase-jsonrpcbase/) version `0.3.0a6` to resolve dependency conflicts. | |
| Note that there exists a [github repo](https://github.com/kbaseincubator/jsonrpcbase) which is presumably the source of the PyPi module, but it appears to only contain the alpha5 release of the code vs. PyPi's alpha6. It is not clear where the alpha6 code resides other than PyPi, | |
| The original repository was only used by this project, so the code has been brought in directly to simplify maintenance and eliminate external dependency issues. |
| logger.info('Waiting until service has stopped...') | ||
|
|
||
| if not common.wait_for_line("container.err", | ||
| lambda line: 'Stopping' in line and 'done' in line, | ||
| if not common.wait_for_line("container.out", | ||
| lambda line: "exited with code 0" in line, | ||
| timeout=stop_timeout, | ||
| line_count=1): | ||
| raise Exception(f'Container did not stop in the alloted time of {stop_timeout} seconds') |
There was a problem hiding this comment.
Since subprocess run will block until docker compose down is complete, I don't think all this checking code does anything anymore. It won't run until the down is finished
There was a problem hiding this comment.
I believe this check is useful and necessary because it verifies that the containers are actually shutting down.
There was a problem hiding this comment.
They must be down at this point. Run blocks until the command exits, and check ensures that the exit code is 0. If not, an exception will be thrown. This code can only be reached if the containers are down
There was a problem hiding this comment.
Interestingly the tests are no longer passing. I don't see how the changes you made could've caused that...
| logger.info('Waiting until service has stopped...') | ||
| if not common.wait_for_line("container.err", | ||
| lambda line: 'Stopping' in line and 'done' in line, | ||
| if not common.wait_for_line("container.out", | ||
| lambda line: "exited with code 0" in line, | ||
| timeout=stop_timeout, | ||
| line_count=2): | ||
|
|
||
| # Use logger.warning here to allow tests to pass in CI. | ||
| # Note: Containers shut down properly when run locally, but may not behave the same in CI environments. | ||
| logger.warning(f'Container did not stop in the alotted time of {stop_timeout} seconds') |
MrCreosote
left a comment
There was a problem hiding this comment.
LGTM. @bio-boris do you want to review?



No description provided.