-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add an interface to replace the ChangeSet function type. #16186
base: develop
Are you sure you want to change the base?
Add an interface to replace the ChangeSet function type. #16186
Conversation
14b0e8a
to
15ed30f
Compare
AER Report: CI Coreaer_workflow , commit , Detect Changes , Clean Go Tidy & Generate , Scheduled Run Frequency , GolangCI Lint (integration-tests) , GolangCI Lint (deployment) , Core Tests (go_core_tests) , Core Tests (go_core_tests_integration) , Core Tests (go_core_ccip_deployment_tests) , test-scripts , Core Tests (go_core_fuzz) , Core Tests (go_core_race_tests) , lint , SonarQube Scan 1. Ineffectual assignment to err: [Golang Lint (deployment)]Source of Error:
Why: The variable Suggested fix: Ensure that the 2. Use assert.NoError instead of assert.Equal: [Golang Lint (deployment)]Source of Error:
Why: The Suggested fix: Replace 3. Use require.NoError instead of assert.NoError: [Golang Lint (deployment)]Source of Error:
Why: The Suggested fix: Replace 4. Function name stutters: [Golang Lint (deployment)]Source of Error:
Why: The function name Suggested fix: Rename the function to AER Report: Operator UI CI ran successfully ✅ |
Flakeguard SummaryRan new or updated tests between View Flaky Detector Details | Compare Changes Found Flaky Tests ❌
ArtifactsFor detailed logs of the failed tests, please refer to the artifact failed-test-results-with-logs.json. |
Flakeguard SummaryRan new or updated tests between View Flaky Detector Details | Compare Changes Found Flaky Tests ❌
ArtifactsFor detailed logs of the failed tests, please refer to the artifact failed-test-results-with-logs.json. |
This preserves the existing function type (as an alias to a new function type, ChangeLogic). It adds also two function types ChangeLogic and PreconditionVerifier, to encapsulate the logic of these two functions. The interface exposes an Apply and a VerifyPreconditions method. The aforementioned function types can be used with a convenience function to generate an implementation of ChangeSetV2. Alternatively, a full implementation of the interface can be built using a struct that implements those methods.
…ngeSet, which can be generic, and therefore avoid a lot of mess in dealing with the WrapChangeset stuff.
…re now handled by the ConfiguredChangeSet interface.
…ructure, and add some tests to make sure that works.
6b77dc2
to
b530654
Compare
|
Flakeguard SummaryRan new or updated tests between View Flaky Detector Details | Compare Changes Found Flaky Tests ❌
ArtifactsFor detailed logs of the failed tests, please refer to the artifact failed-test-results-with-logs.json. |
} | ||
|
||
func (scs simpleChangeSet[C]) Apply(e Environment, config C) (ChangesetOutput, error) { | ||
return scs.apply(e, config) |
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.
Do we expect users to always validate the config before applying the changeset? If so, we could enforce running c.VerifyPreconditions
here, so users do not need to explicitly call Verify before Apply
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 don't want to enforce it here, because this is a simple changeset composed of two pure functions, and not everyone may implement using this. This is purely a wrapper around two functions.
The execution environment that calls cs.Apply(...) should call verify before apply, and I do that in this PR, in the test_helpers in the ConfiguredChangeSet wrapper, which is what the execution environment uses. Similarly, we'd do that in the migrations side.
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.
Or to phrase it otherwise, users will never call this method. The infrastructure will, and does.
This preserves the existing function type (as an alias to a new function type, ChangeLogic). It adds also two function types ChangeLogic and PreconditionVerifier, to encapsulate the logic of these two functions. The interface exposes an Apply and a VerifyPreconditions method. The aforementioned function types can be used with a convenience function to generate an implementation of ChangeSetV2. Alternatively, a full implementation of the interface can be built using a struct that implements those methods.
DPA-1527