-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Introduce statestore internal testing support #19177
Conversation
Pinging @elastic/integrations-services (Team:Services) |
💔 Build FailedExpand to view the summary
Build stats
Test stats 🧪
Steps errorsExpand to view the steps failures
Log outputExpand to view the last 100 lines of log output
|
This change introduces an internal package to the statestore that provides testing helpers. The addition of the statestore package is split up into multiple changeset to ease review. The final version of the package can be found [here](https://github.com/urso/beats/tree/fb-input-v2-combined/libbeat/statestore). Once finalized, the libbeat/statestore package contains: - The statestore frontend and interface for use within Beats - Interfaces for the store backend - A common set of tests store backends need to support - a storetest package for testing new features that require a store. The testing helpers use map[string]interface{} that can be initialized or queried after the test run for validation purposes. - The default memlog backend + tests This change include common testing support, that will be used by the memlog backend, and to verify the storetest package.
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.
LGTM and I just left a couple of comments. If you change them, feel free to merge afterwards
|
||
// Store helper for writing tests. | ||
// The store needs a reference to the Registry with the current test context. | ||
// The Store provides additional helpers for reopning the store, MustX methods |
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.
nit: Typo in reopning
} | ||
|
||
// MustHas fails the test if an error occured in a call to Has. | ||
func (s *Store) MustHas(key string) bool { |
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 needed to do a search 😅 but it seems that the correct form is MustHave
https://www.quora.com/Which-is-grammatically-correct-it-must-has-or-it-must-have
CI errors occured when building kafka containers. Relevant tests have passed. |
This change introduces an internal package to the statestore that provides testing helpers. The addition of the statestore package is split up into multiple changeset to ease review. The final version of the package can be found [here](https://github.com/urso/beats/tree/fb-input-v2-combined/libbeat/statestore). Once finalized, the libbeat/statestore package contains: - The statestore frontend and interface for use within Beats - Interfaces for the store backend - A common set of tests store backends need to support - a storetest package for testing new features that require a store. The testing helpers use map[string]interface{} that can be initialized or queried after the test run for validation purposes. - The default memlog backend + tests This change include common testing support, that will be used by the memlog backend, and to verify the storetest package. (cherry picked from commit 8c23383)
This change introduces an internal package to the statestore that provides testing helpers. The addition of the statestore package is split up into multiple changeset to ease review. The final version of the package can be found [here](https://github.com/urso/beats/tree/fb-input-v2-combined/libbeat/statestore). Once finalized, the libbeat/statestore package contains: - The statestore frontend and interface for use within Beats - Interfaces for the store backend - A common set of tests store backends need to support - a storetest package for testing new features that require a store. The testing helpers use map[string]interface{} that can be initialized or queried after the test run for validation purposes. - The default memlog backend + tests This change include common testing support, that will be used by the memlog backend, and to verify the storetest package.
What does this PR do?
This change introduces an internal package to the statestore that
provides testing helpers.
The addition of the statestore package is split up into multiple
changeset to ease review. The final version of the package can be found
here.
Once finalized, the libbeat/statestore package contains:
testing helpers use map[string]interface{} that can be initialized or
queried after the test run for validation purposes.
This change include common testing support, that will be used by the
memlog backend, and to verify the storetest package.
Why is it important?
The statestore introduces a simple key-value store to Beats. The statestore will be used to replace the registry in filebeat in the future.
Checklist
- [ ] I have made corresponding changes to the documentation- [ ] I have made corresponding change to the default configuration files- [ ] I have added tests that prove my fix is effective or that my feature works- [ ] I have added an entry inCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Related issues