Skip to content
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

Input v2 cursor testing #19573

Merged
merged 1 commit into from
Jul 2, 2020
Merged

Input v2 cursor testing #19573

merged 1 commit into from
Jul 2, 2020

Conversation

urso
Copy link

@urso urso commented Jul 1, 2020

  • Enhancement

What does this PR do?

Add tests for the stateful input manager and inputs.

The full list of changes will include:

Test coverage:

$ gocov test ./... | gocov report
ok  	github.com/elastic/beats/v7/filebeat/input/v2/input-cursor	0.335s	coverage: 89.4% of statements

github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/input.go	 managedInput.Run		 100.00% (10/10)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/clean.go	 checkCleanResource		 100.00% (9/9)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/input.go	 managedInput.Test		 100.00% (8/8)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/clean.go	 gcFind				 100.00% (7/7)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/manager.go	 @123:18			 100.00% (7/7)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/manager.go	 lockResource			 100.00% (7/7)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/input.go	 @115:10			 100.00% (6/6)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/store.go	 resource.UnpackCursor		 100.00% (5/5)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/store.go	 resource.stateSnapshot		 100.00% (4/4)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/publish.go	 cursorPublisher.forward	 100.00% (4/4)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/input.go	 @141:8				 100.00% (3/3)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/cursor.go	 Cursor.Unpack			 100.00% (3/3)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/store.go	 resource.IsNew			 100.00% (3/3)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/input.go	 @89:8				 100.00% (3/3)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/publish.go	 updateOp.done			 100.00% (3/3)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/manager.go	 InputManager.init		 100.00% (2/2)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/manager.go	 releaseResource		 100.00% (2/2)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/store.go	 store.Release			 100.00% (2/2)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/input.go	 managedInput.testSource	 100.00% (2/2)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/clean.go	 cleaner.run			 100.00% (2/2)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/cursor.go	 makeCursor			 100.00% (1/1)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/store.go	 resource.Release		 100.00% (1/1)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/store.go	 resource.Retain		 100.00% (1/1)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/input.go	 newInputACKHandler		 100.00% (1/1)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/store.go	 resource.inSyncStateSnapshot	 100.00% (1/1)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/manager.go	 InputManager.shutdown		 100.00% (1/1)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/store.go	 resource.UpdatesReleaseN	 100.00% (1/1)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/cursor.go	 Cursor.IsNew			 100.00% (1/1)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/clean.go	 @47:37				 100.00% (1/1)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/input.go	 @76:10				 100.00% (1/1)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/store.go	 store.Retain			 100.00% (1/1)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/store.go	 resource.Finished		 100.00% (1/1)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/store.go	 store.Get			 100.00% (1/1)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/publish.go	 createUpdateOp			 93.33% (14/15)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/input.go	 @183:9				 92.31% (12/13)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/clean.go	 gcStore			 90.91% (10/11)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/store.go	 states.Find			 90.91% (10/11)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/store.go	 openStore			 90.00% (9/10)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/publish.go	 updateOp.Execute		 88.24% (15/17)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/manager.go	 @89:18				 87.50% (7/8)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/input.go	 managedInput.runSource		 85.71% (12/14)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/publish.go	 cursorPublisher.Publish	 85.71% (6/7)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/store.go	 store.UpdateTTL		 84.62% (11/13)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/manager.go	 InputManager.Create		 84.62% (11/13)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/store.go	 readStates			 83.33% (5/6)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/clean.go	 gcClean			 80.00% (4/5)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/store.go	 @292:20			 77.78% (7/9)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/manager.go	 InputManager.lock		 66.67% (4/6)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/input.go	 managedInput.createSourceID	 66.67% (2/3)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/manager.go	 InputManager.Init		 64.29% (9/14)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/store.go	 store.close			 50.00% (1/2)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/input.go	 managedInput.Name		 0.00% (0/1)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/store.go	 @137:27			 0.00% (0/1)
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor		 ----------------------------	 89.44% (254/284)

Why is it important?

Test implementation for supporting stateful inputs.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
    - [ ] 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 in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Author's Checklist

  • [ ]

How to test this PR locally

$ go test

Related issues

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jul 1, 2020
@urso urso added Filebeat Filebeat needs_backport PR is waiting to be backported to other branches. Project:Filebeat-Input-v2 review Team:Services (Deprecated) Label for the former Integrations-Services team labels Jul 1, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations-services (Team:Services)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jul 1, 2020
@elasticmachine
Copy link
Collaborator

elasticmachine commented Jul 1, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #19573 updated]

  • Start Time: 2020-07-02T16:10:09.571+0000

  • Duration: 71 min 2 sec

Test stats 🧪

Test Results
Failed 0
Passed 4218
Skipped 677
Total 4895

Copy link
Contributor

@kvch kvch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment.

@urso urso force-pushed the input-v2-cursor-testing branch from 8e7c072 to e63e74e Compare July 2, 2020 15:20
Add tests for the stateful input manager and inputs.

The full list of changes will include:
- Introduce v2 API interfaces
- Introduce [compatibility layer](https://github.com/urso/beats/tree/fb-input-v2-combined/filebeat/input/v2/compat) to integrate API with existing functionality
- Introduce helpers for writing [stateless](https://github.com/urso/beats/blob/fb-input-v2-combined/filebeat/input/v2/input-stateless/stateless.go) inputs.
- Introduce helpers for writing [inputs that store a state](https://github.com/urso/beats/tree/fb-input-v2-combined/filebeat/input/v2/input-cursor) between restarts.
- Integrate new API with [existing inputs and modules](https://github.com/urso/beats/blob/fb-input-v2-combined/filebeat/beater/filebeat.go#L301) in filebeat.
@urso urso force-pushed the input-v2-cursor-testing branch from e63e74e to 1468db8 Compare July 2, 2020 16:09
@urso urso merged commit 1e759ef into elastic:master Jul 2, 2020
@urso urso deleted the input-v2-cursor-testing branch July 2, 2020 19:55
v1v added a commit to v1v/beats that referenced this pull request Jul 3, 2020
…ne-beats

* upstream/master: (35 commits)
  [ci] fix env variable name for xpack filebeats (elastic#19617)
  Cache error responses for cloudfoundry apps metadata (elastic#19181)
  ci: user fixed type of agent (elastic#19625)
  Input v2 cursor testing (elastic#19573)
  Update Jenkinsfile to not inspect removed vendor (elastic#19610)
  Fix ordering and duplicate configs on autodiscover (elastic#19317)
  Prepare input/file for changes in the registrar (elastic#19516)
  Cursor input and manager implementation (elastic#19571)
  [Filebeat] Fix tls mapping in suricata module (elastic#19494)
  [Ingest Manager] Make Agent beta and Constraints experimental (elastic#19586)
  Accept prefix as metric_types for stackdriver metricset in GCP (elastic#19345)
  Implement memlog store operations (elastic#19533)
  introduce journalbeat/pkg in order to provide reusable shared code (elastic#19581)
  Add descriptions to HAProxy fields in Metricbeat (elastic#19561)
  ci: apm-server-update trigered only on upstream, comments, and manual triggered (elastic#19590)
  ci: enable upstream triggering on the packaging job (elastic#19589)
  ci: some jjbb improvements (elastic#19588)
  [MetricBeat] set tags correctly if the dimension value is ARN (elastic#19433)
  [Filebeat] Add default_fields: false to fields.yml in aws module (elastic#19568)
  Add publisher implementation for stateful inputs (elastic#19530)
  ...
urso pushed a commit to urso/beats that referenced this pull request Jul 8, 2020
Add tests for the stateful input manager and inputs.
@urso urso removed needs_backport PR is waiting to be backported to other branches. blocked labels Jul 8, 2020
urso pushed a commit that referenced this pull request Jul 8, 2020
…plement storage handling for cursor inputs (#19732)
melchiormoulin pushed a commit to melchiormoulin/beats that referenced this pull request Oct 14, 2020
Add tests for the stateful input manager and inputs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Filebeat Filebeat Project:Filebeat-Input-v2 review skip-test-plan Team:Services (Deprecated) Label for the former Integrations-Services team v7.9.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants