-
Notifications
You must be signed in to change notification settings - Fork 16
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
[BCI-3989][common] - CR methods err when service unstarted #705
base: main
Are you sure you want to change the base?
Conversation
This reverts commit 5006bec.
require.NoError(t, it.impl.Start(context.Background())) | ||
t.Cleanup(func() { require.NoError(t, it.impl.Close()) }) |
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.
Please use servicetest.Run
. Notice it uses assert
during cleanup.
…arted" This reverts commit e728084.
@@ -15,8 +15,28 @@ import ( | |||
"github.com/smartcontractkit/chainlink-common/pkg/utils/tests" | |||
) | |||
|
|||
type ChainComponentsInterfaceTester[T TestingT[T]] interface { | |||
type ChainComponentsTester[T any] interface { |
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.
- defined
ChainComponentsTester
so we use theSetup(t T, startCR bool)
only forchainComponents
tests - defined
chainComponentsTestcase
so we use thestartCR
testcase flag only forchainComponents
testcases - defined
runChainComponentsTests
to executechainComponents
specific tests using theChainComponentsTester
interface withSetup(t T, startCR bool)
@@ -19,8 +19,27 @@ type EncodeRequest struct { | |||
TestOn string | |||
} | |||
|
|||
type codecTestcase[T any] struct { |
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.
- defined CodecTester so we use the
Setup(t T)
without thestartCR
flag for thecodec
- defined
codecTestcase
so we don't use thestartCR
testcase flag forcodec
testcases - defined
runCodecTests
to executecodec
specific tests using theCodecTester
interface withSetup(t T)
fake, ok := it.impl.(*fakeContractReader) | ||
if ok { | ||
fake.vals = []valConfidencePair{} | ||
fake.triggers = []eventConfidencePair{} | ||
fake.stored = []TestStruct{} | ||
|
||
if startCR { | ||
servicetest.Run(t, it.impl) |
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.
added servicetest.Run(t, it.impl)
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.
Wdyt about this solution
solana ref: BCI-3989-cr-methods-error-when-unstarted
core ref: BCI-3989-cr-methods-error-when-unstarted
Task Description:
We only want
GetLatestValue
,BatchGetLatestValue
andQueryKey
to be called whenCR
service is inStarted
state. IfCR
is not started yet, we should return an error.This PR:
Ticket:
Unblocks:
Merging flow: