-
Notifications
You must be signed in to change notification settings - Fork 65
[BCI-3989][solana] - CR methods err when service unstarted #829
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
Draft
Farber98
wants to merge
29
commits into
develop
Choose a base branch
from
BCI-3989-cr-methods-error-when-unstarted
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 6 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
e4b1032
add missing methods to testing interface
Farber98 72b155d
rename interface tester methods
Farber98 ae54542
remove unnecesary Start method
Farber98 826bfb9
Merge branch 'develop' into BCI-3989-cr-methods-error-when-unstarted
Farber98 07e8c77
close method impl
Farber98 06201dc
svc not started test in solana
Farber98 411032a
Merge branch 'develop' into BCI-3989-cr-methods-error-when-unstarted
Farber98 e666621
start service again so cleanup closes gracefully
Farber98 c14eed5
bump common ref
Farber98 a0b44bd
close ignoring error as core does. It might be already closed
Farber98 fc6cfe8
add start. address comment
Farber98 b15fafd
bump common
Farber98 0c335b0
merge develop
Farber98 6254cdb
bump common
Farber98 9769b7d
bump data streams for core integration tests
Farber98 048d13c
fix v2 dependencies
Farber98 c82beda
Merge branch 'develop' into BCI-3989-cr-methods-error-when-unstarted
Farber98 53f53b6
fix conflicts with chain components pr
Farber98 f629984
Merge branch 'develop' into BCI-3989-cr-methods-error-when-unstarted
Farber98 1cf0ccd
fix pr conflicts
Farber98 6d6b396
bump common version
Farber98 3f986a2
add flag to control if we return cr started
Farber98 1f37e8a
bump common
Farber98 79b4500
bump common
Farber98 cf4ce48
Merge branch 'develop' into BCI-3989-cr-methods-error-when-unstarted
Farber98 71454f3
make gomodtidy
Farber98 b7f19d9
refactor codec and chaincomponents ifaces
Farber98 099f8de
Merge branch 'develop' into BCI-3989-cr-methods-error-when-unstarted
Farber98 bc3a0f4
bump common
Farber98 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
These need to remain unchanged. It is never correct to skip
Close()after callingStart, and this should be the only place that it happens.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.
Right! Doing it same way as core so we don't skip
Closebut can execute it a second time without failing harda0b44bd(#829)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.
What do you mean by this? It is incorrect by definition to call
Closea second time. This must be the only location that callsClose, and it must check the returnederror.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.
I'll take
GetLatestValueas an example for code references.I'm trying to test that calling the
CRmethods returns an err when the service is notStarted. To achieve this, I'm calling the Close() method that was added to the testing interface "early". The method called in Solana is this one.In Solana GetChainReader() is calling
Start()and thecleanup()is callingClose(). When we run this test, we Close() the service for the first time and then when executing thecleanup(), we will get an error because we are trying toClose()again. That's why I removed therequire.NoError()to do it the same way as it is in Core. By doing this, we are sure that the service was closed but we don't fail with the secondClose()attempt.The other thing I could do is remove the
Start()andClose()calls inside theGetChainReader()in Solana and Core and execute them as needed in every test. It will introduce a lot of redundant calls toStart()andClose()but we will be able to control when we want to call these funcs avoiding doubleStart/Closeproblems.Let me know your thoughts and if you have a better approach to achieve this
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.
This existing code in incorrect. This is a bug.
Suppressing the error without checking it does not guarantee this. Other errors are possible than a double close error - but that still should not be ignored regardless. It is incorrect by definition to call
Closea second time, and it is never necessary to do so.I don't understand what you mean by this. Can you elaborate?
If the goal is to evaluate errors returned when not started, then all that is necessary is to make method calls either before starting or after closing. Is something preventing that from being done in a straightforward way?
Uh oh!
There was an error while loading. Please reload this page.
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.
The core code should be fixed, there is an error when
Close()is called because the db instance gets closed before CR. This is happening becauseGetChainReader()calls intoNewSqlxDB()which calls intot.Cleanup()beforeSetup()is called and callst.Cleanup()which means that sqlx db gets cleaned up first.We shouldn't ignore this error, but rather fix the cause
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.
Thanks for the clarification!
I was thinking on exposing the
Start()andClose()methods in theChainReaderInterfaceTesterand be able to call them from the tests in the moments we want rather than receiving it already started by theSetup()and having a mandatoryClose()call at the end executed by thecleanup(). In this way we could callStart()andClose()when we need to and defer theClose()call if we want it to act as acleanup()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.
Pushed these changes in the 3 repos. CI will fail until smartcontractkit/chainlink#14252 is merged and I rebase
core. Tests were passing locally.