Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

v2 refactor #1008

Merged
merged 70 commits into from
Apr 21, 2021
Merged

v2 refactor #1008

merged 70 commits into from
Apr 21, 2021

Conversation

adam-stokes
Copy link
Contributor

@adam-stokes adam-stokes commented Apr 9, 2021

Signed-off-by: Adam Stokes [email protected]

What does this PR do?

This PR refactors a lot of the internal code into more organized packages under internal top level directory.

Why is it important?

As we grow the project it makes it a bit easier to reason about what code is doing what and provides a central location to find function references and definitions.

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 run the Unit tests for the CLI, and they are passing locally
  • I have run the End-2-End tests for the suite I'm working on, and they are passing locally
  • I have noticed new Go dependencies (run make notice in the proper directory)

Author's Checklist

  • Tag current master as 1.99.0 prior to merging
  • Verify current e2e tests pass

How to test this PR locally

The standard godog test instructions apply here:

cd e2e/_suites/fleet
godog -t '@fleed_mode_agent'

Related issues

@elasticmachine
Copy link
Contributor

elasticmachine commented Apr 9, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: Pull request #1008 updated

  • Start Time: 2021-04-21T14:55:45.956+0000

  • Duration: 21 min 33 sec

  • Commit: f11ef39

Test stats 🧪

Test Results
Failed 0
Passed 93
Skipped 0
Total 93

Trends 🧪

Image of Build Times

Image of Tests

💚 Flaky test report

Tests succeeded.

Expand to view the summary

Test stats 🧪

Test Results
Failed 0
Passed 93
Skipped 0
Total 93

@adam-stokes adam-stokes added the enhancement New feature or request label Apr 12, 2021
adam-stokes and others added 24 commits April 12, 2021 12:35
Signed-off-by: Adam Stokes <[email protected]>
Signed-off-by: Adam Stokes <[email protected]>
Signed-off-by: Adam Stokes <[email protected]>
There were 2 steps identical in both the stand-alone and fleet test suites.
Running the stand-alone test suite was picking up the step from the fleet test
suite and trying to reference the FleetTestSuite structure which did not hold
any of the agent information (like the hostname) for the stand alone tests.

This fixes it so that the standalone test step is being referenced in the
correct test suite.

Signed-off-by: Adam Stokes <[email protected]>
Signed-off-by: Adam Stokes <[email protected]>

Co-authored-by: Manuel de la Peña <[email protected]>
Signed-off-by: Adam Stokes <[email protected]>
Signed-off-by: Adam Stokes <[email protected]>
Signed-off-by: Adam Stokes <[email protected]>
@adam-stokes adam-stokes force-pushed the feat-kibana-refactor branch from bc65320 to 9842175 Compare April 12, 2021 17:50
@adam-stokes
Copy link
Contributor Author

Another bug hit: elastic/fleet-server#245 putting here to track

Signed-off-by: Adam Stokes <[email protected]>
In some cases such as attempting to re-enroll with a revoked token, the
elastic-agent will retry indefinitely. This fix adds a safeguard utilizing
'timeout' command prepended to the elastic-agent command so that it will timeout
after TimeoutFactor

Signed-off-by: Adam Stokes <[email protected]>
if force {
reqBody = `{"force": true}`
}
reqBody := `{"revoke": true}`
Copy link
Contributor

Choose a reason for hiding this comment

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

Neat!!

@mdelapenya mdelapenya mentioned this pull request Apr 21, 2021
13 tasks
@adam-stokes adam-stokes merged commit 5f59670 into master Apr 21, 2021
mdelapenya added a commit to mdelapenya/e2e-testing that referenced this pull request Apr 21, 2021
* master:
  v2 refactor (elastic#1008)
  fix: use a version of kibana with the fix for fleet-server validations (elastic#1055)
  feat: add first scenario for Fleet Server (elastic#900)
  fix: do not use GT_REPO variable, use fixed repo name instead (elastic#1049)
mergify bot pushed a commit that referenced this pull request Apr 21, 2021
* Move kibana into internals, update fleet test suite
* migrate docker-compose related code to internal layout
* move docker related code to internal layout
* move git related code to internal layout
* move common attributes into internal common file system layout
* move elasticsearch specifics into its own filesystem layout
* move installer based code to internal layout
* move shell related code to internal layout
* move sanitizer code to internal layout
* move io related code to internal layout
* move utils into internal layout
* Update package integration querying/altering
* move curl to internal layout
* move helm to internal layout
* move kubectl into internal layout
* move state internal filesystem
* cleanup config in stand-alone
* remove unused files
* Uniquify the stand-alone step for checking agent status (#993)

There were 2 steps identical in both the stand-alone and fleet test suites.
Running the stand-alone test suite was picking up the step from the fleet test
suite and trying to reference the FleetTestSuite structure which did not hold
any of the agent information (like the hostname) for the stand alone tests.

This fixes it so that the standalone test step is being referenced in the
correct test suite.

* Remove the agent config file parameters for stand alone (#983)
* Update helm/metricbeat tests to use new layout
* Fix policy endpoint update
* fix panic on helm init
* Fix step reference as this being merged seperately
* Update function call to correct standalone step
* Fix merge conflict
* update ProfileEnv query/set for KibanaVersion
* More fixes to agent endpoint security checks
* update backend feature to call out endpoint in step
* use common.TimeoutFactor in docker checkprocess state
* Update adding endpoint integration
* enable features for fleet server
* not necessary to enroll after install
* wait for filebeat/metricbeat before restarts
* clear out fts.CurrentToken during beforeScenario
* attach system integration on deploy
* enroll if rpm
* dont store fleet policy
* update kibana config for latest fleet server
* Update e2e/_suites/fleet/fleet.go
* Update e2e/_suites/fleet/fleet.go
* Update e2e/_suites/fleet/fleet.go
* Update .pre-commit-config.yaml
* Update e2e/Makefile
* rename apt -> deb for installer type
* execute docker start/stop with timeout between
* fixes fleet_server scenario
* Utilize fleet server in all tests
* Fix enrollment url for fleet server
* Query elasticsearch logs for endpoint security event changes
* Increase search result size for ES
* Fix issue with fleet server restarting continuously
* unpin kibana pr now that most major breakage is resolved
* force unenroll
* for new fleet bootstrap on re-enrollment
* Fix unenrollment
* Add timeout safeguard to elastic-agent execution

In some cases such as attempting to re-enroll with a revoked token, the
elastic-agent will retry indefinitely. This fix adds a safeguard utilizing
'timeout' command prepended to the elastic-agent command so that it will timeout
after TimeoutFactor

Signed-off-by: Adam Stokes <[email protected]>
Co-authored-by: Manuel de la Peña <[email protected]>
(cherry picked from commit 5f59670)

# Conflicts:
#	e2e/Makefile
#	e2e/_suites/fleet/ingest_manager_test.go
#	e2e/_suites/fleet/stand-alone.go
#	e2e/_suites/fleet/world.go
@mergify mergify bot mentioned this pull request Apr 21, 2021
adam-stokes added a commit that referenced this pull request Apr 21, 2021
* Move kibana into internals, update fleet test suite
* migrate docker-compose related code to internal layout
* move docker related code to internal layout
* move git related code to internal layout
* move common attributes into internal common file system layout
* move elasticsearch specifics into its own filesystem layout
* move installer based code to internal layout
* move shell related code to internal layout
* move sanitizer code to internal layout
* move io related code to internal layout
* move utils into internal layout
* Update package integration querying/altering
* move curl to internal layout
* move helm to internal layout
* move kubectl into internal layout
* move state internal filesystem
* cleanup config in stand-alone
* remove unused files
* Uniquify the stand-alone step for checking agent status (#993)

There were 2 steps identical in both the stand-alone and fleet test suites.
Running the stand-alone test suite was picking up the step from the fleet test
suite and trying to reference the FleetTestSuite structure which did not hold
any of the agent information (like the hostname) for the stand alone tests.

This fixes it so that the standalone test step is being referenced in the
correct test suite.

* Remove the agent config file parameters for stand alone (#983)
* Update helm/metricbeat tests to use new layout
* Fix policy endpoint update
* fix panic on helm init
* Fix step reference as this being merged seperately
* Update function call to correct standalone step
* Fix merge conflict
* update ProfileEnv query/set for KibanaVersion
* More fixes to agent endpoint security checks
* update backend feature to call out endpoint in step
* use common.TimeoutFactor in docker checkprocess state
* Update adding endpoint integration
* enable features for fleet server
* not necessary to enroll after install
* wait for filebeat/metricbeat before restarts
* clear out fts.CurrentToken during beforeScenario
* attach system integration on deploy
* enroll if rpm
* dont store fleet policy
* update kibana config for latest fleet server
* Update e2e/_suites/fleet/fleet.go
* Update e2e/_suites/fleet/fleet.go
* Update e2e/_suites/fleet/fleet.go
* Update .pre-commit-config.yaml
* Update e2e/Makefile
* rename apt -> deb for installer type
* execute docker start/stop with timeout between
* fixes fleet_server scenario
* Utilize fleet server in all tests
* Fix enrollment url for fleet server
* Query elasticsearch logs for endpoint security event changes
* Increase search result size for ES
* Fix issue with fleet server restarting continuously
* unpin kibana pr now that most major breakage is resolved
* force unenroll
* for new fleet bootstrap on re-enrollment
* Fix unenrollment
* Add timeout safeguard to elastic-agent execution

In some cases such as attempting to re-enroll with a revoked token, the
elastic-agent will retry indefinitely. This fix adds a safeguard utilizing
'timeout' command prepended to the elastic-agent command so that it will timeout
after TimeoutFactor

Signed-off-by: Adam Stokes <[email protected]>
Co-authored-by: Manuel de la Peña <[email protected]>
(cherry picked from commit 5f59670)

# Conflicts:
#	e2e/Makefile
#	e2e/_suites/fleet/ingest_manager_test.go
#	e2e/_suites/fleet/stand-alone.go
#	e2e/_suites/fleet/world.go

Co-authored-by: Adam Stokes <[email protected]>
adam-stokes added a commit that referenced this pull request Apr 21, 2021
This reverts commit d757abf.

Signed-off-by: Adam Stokes <[email protected]>
adam-stokes added a commit that referenced this pull request Apr 21, 2021
* Move kibana into internals, update fleet test suite
* migrate docker-compose related code to internal layout
* move docker related code to internal layout
* move git related code to internal layout
* move common attributes into internal common file system layout
* move elasticsearch specifics into its own filesystem layout
* move installer based code to internal layout
* move shell related code to internal layout
* move sanitizer code to internal layout
* move io related code to internal layout
* move utils into internal layout
* Update package integration querying/altering
* move curl to internal layout
* move helm to internal layout
* move kubectl into internal layout
* move state internal filesystem
* cleanup config in stand-alone
* remove unused files
* Uniquify the stand-alone step for checking agent status (#993)

There were 2 steps identical in both the stand-alone and fleet test suites.
Running the stand-alone test suite was picking up the step from the fleet test
suite and trying to reference the FleetTestSuite structure which did not hold
any of the agent information (like the hostname) for the stand alone tests.

This fixes it so that the standalone test step is being referenced in the
correct test suite.

* Remove the agent config file parameters for stand alone (#983)
* Update helm/metricbeat tests to use new layout
* Fix policy endpoint update
* fix panic on helm init
* Fix step reference as this being merged seperately
* Update function call to correct standalone step
* Fix merge conflict
* update ProfileEnv query/set for KibanaVersion
* More fixes to agent endpoint security checks
* update backend feature to call out endpoint in step
* use common.TimeoutFactor in docker checkprocess state
* Update adding endpoint integration
* enable features for fleet server
* not necessary to enroll after install
* wait for filebeat/metricbeat before restarts
* clear out fts.CurrentToken during beforeScenario
* attach system integration on deploy
* enroll if rpm
* dont store fleet policy
* update kibana config for latest fleet server
* Update e2e/_suites/fleet/fleet.go
* Update e2e/_suites/fleet/fleet.go
* Update e2e/_suites/fleet/fleet.go
* Update .pre-commit-config.yaml
* Update e2e/Makefile
* rename apt -> deb for installer type
* execute docker start/stop with timeout between
* fixes fleet_server scenario
* Utilize fleet server in all tests
* Fix enrollment url for fleet server
* Query elasticsearch logs for endpoint security event changes
* Increase search result size for ES
* Fix issue with fleet server restarting continuously
* unpin kibana pr now that most major breakage is resolved
* force unenroll
* for new fleet bootstrap on re-enrollment
* Fix unenrollment
* Add timeout safeguard to elastic-agent execution

In some cases such as attempting to re-enroll with a revoked token, the
elastic-agent will retry indefinitely. This fix adds a safeguard utilizing
'timeout' command prepended to the elastic-agent command so that it will timeout
after TimeoutFactor

Signed-off-by: Adam Stokes <[email protected]>
Co-authored-by: Manuel de la Peña <[email protected]>
Signed-off-by: Adam Stokes <[email protected]>
@mdelapenya mdelapenya deleted the feat-kibana-refactor branch April 22, 2021 08:43
@mdelapenya mdelapenya mentioned this pull request May 11, 2021
8 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request v7.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants