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

[Heartbeat] Zip URL Support #24714

Merged
merged 14 commits into from
Apr 23, 2021
Merged

[Heartbeat] Zip URL Support #24714

merged 14 commits into from
Apr 23, 2021

Conversation

andrewvc
Copy link
Contributor

@andrewvc andrewvc commented Mar 23, 2021

Adds support for remote zips to browser monitors, letting users just automatically pull from a remote repo.

Fixes elastic/uptime#271

Why is it important?

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

Related issues

Use cases

Screenshots

Logs

@andrewvc andrewvc added enhancement Heartbeat Team:obs-ds-hosted-services Label for the Observability Hosted Services team v7.13.0 labels Mar 23, 2021
@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Mar 23, 2021
@elasticmachine
Copy link
Collaborator

elasticmachine commented Mar 23, 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 #24714 updated

  • Start Time: 2021-04-23T02:20:43.330+0000

  • Duration: 38 min 52 sec

  • Commit: 309ef64

Test stats 🧪

Test Results
Failed 0
Passed 68
Skipped 0
Total 68

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 68
Skipped 0
Total 68

@vigneshshanmugam vigneshshanmugam marked this pull request as ready for review April 21, 2021 22:39
@elasticmachine
Copy link
Collaborator

Pinging @elastic/uptime (Team:Uptime)

@andrewvc andrewvc self-assigned this Apr 23, 2021
Copy link
Member

@vigneshshanmugam vigneshshanmugam left a comment

Choose a reason for hiding this comment

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

Looks good to me 👍

err = unzipFile(targetDir, folder, f)
if err != nil {
// TODO: err handlers
os.RemoveAll(targetDir)
Copy link
Member

Choose a reason for hiding this comment

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

This feels unnecessary right? we already remove the directory when unzip returns error.

https://github.com/elastic/beats/pull/24714/files#diff-a42b602f839672a041979a73130887f65c77d4792a207ce86444af8a01660012R71

)

func TestZipUrlFetchNoAuth(t *testing.T) {
address, teardown := setupTests()
Copy link
Member

Choose a reason for hiding this comment

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

I thought doing this for every test was a overkill which is why i moved up everything in to functions and called them from a global test function. I guess it's not? Just a question though.

@andrewvc andrewvc merged commit f548f54 into elastic:master Apr 23, 2021
@andrewvc andrewvc deleted the zipurl branch April 23, 2021 16:15
andrewvc added a commit to andrewvc/beats that referenced this pull request Apr 23, 2021
Adds support for remote zips to browser monitors, letting users just automatically pull from a remote repo.

Fixes elastic/uptime#271
andrewvc added a commit to andrewvc/beats that referenced this pull request Apr 23, 2021
Adds support for remote zips to browser monitors, letting users just automatically pull from a remote repo.

Fixes elastic/uptime#271
andrewvc added a commit that referenced this pull request Apr 23, 2021
Adds support for remote zips to browser monitors, letting users just automatically pull from a remote repo.

Fixes elastic/uptime#271
@andrewkroh
Copy link
Member

@andrewvc One of the new tests in the PR is panicking in master.

https://beats-ci.elastic.co/job/Beats/job/beats/job/master/560/testReport/junit/github/com_elastic_beats_v7_x-pack_heartbeat_monitors_browser_source/Build_Test___x_pack_heartbeat_build___TestZipUrlTargetDirectory/

=== RUN   TestZipUrlTargetDirectory
--- FAIL: TestZipUrlTargetDirectory (1.50s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x73bd49]

goroutine 70 [running]:
testing.tRunner.func1.1(0x785400, 0xa520e0)
	/var/lib/jenkins/workspace/master-560-11f31d70-23ff-4709-a29c-a54165d77063/.gvm/versions/go1.15.9.linux.amd64/src/testing/testing.go:1072 +0x30d
testing.tRunner.func1(0xc0002a2480)
	/var/lib/jenkins/workspace/master-560-11f31d70-23ff-4709-a29c-a54165d77063/.gvm/versions/go1.15.9.linux.amd64/src/testing/testing.go:1075 +0x41a
panic(0x785400, 0xa520e0)
	/var/lib/jenkins/workspace/master-560-11f31d70-23ff-4709-a29c-a54165d77063/.gvm/versions/go1.15.9.linux.amd64/src/runtime/panic.go:969 +0x1b9
github.com/elastic/beats/v7/x-pack/heartbeat/monitors/browser/source.retryingZipRequest(0x7e9d3d, 0x4, 0xc0000e1ef0, 0xe0, 0xd8, 0x7de820)
	/var/lib/jenkins/workspace/master-560-11f31d70-23ff-4709-a29c-a54165d77063/src/github.com/elastic/beats/x-pack/heartbeat/monitors/browser/source/zipurl.go:177 +0x189
github.com/elastic/beats/v7/x-pack/heartbeat/monitors/browser/source.checkIfChanged(0xc0000e1ef0, 0x40f100, 0x0, 0x0)
	/var/lib/jenkins/workspace/master-560-11f31d70-23ff-4709-a29c-a54165d77063/src/github.com/elastic/beats/x-pack/heartbeat/monitors/browser/source/zipurl.go:212 +0x6e
github.com/elastic/beats/v7/x-pack/heartbeat/monitors/browser/source.(*ZipURLSource).Fetch(0xc0000e1ef0, 0x0, 0x0)
	/var/lib/jenkins/workspace/master-560-11f31d70-23ff-4709-a29c-a54165d77063/src/github.com/elastic/beats/x-pack/heartbeat/monitors/browser/source/zipurl.go:34 +0x73
github.com/elastic/beats/v7/x-pack/heartbeat/monitors/browser/source.fetchAndCheckDir(0xc0002a2480, 0xc0000e1ef0)
	/var/lib/jenkins/workspace/master-560-11f31d70-23ff-4709-a29c-a54165d77063/src/github.com/elastic/beats/x-pack/heartbeat/monitors/browser/source/zipurl_test.go:118 +0x3f
github.com/elastic/beats/v7/x-pack/heartbeat/monitors/browser/source.TestZipUrlTargetDirectory(0xc0002a2480)
	/var/lib/jenkins/workspace/master-560-11f31d70-23ff-4709-a29c-a54165d77063/src/github.com/elastic/beats/x-pack/heartbeat/monitors/browser/source/zipurl_test.go:57 +0x14c
testing.tRunner(0xc0002a2480, 0x805e78)
	/var/lib/jenkins/workspace/master-560-11f31d70-23ff-4709-a29c-a54165d77063/.gvm/versions/go1.15.9.linux.amd64/src/testing/testing.go:1123 +0xef
created by testing.(*T).Run
	/var/lib/jenkins/workspace/master-560-11f31d70-23ff-4709-a29c-a54165d77063/.gvm/versions/go1.15.9.linux.amd64/src/testing/testing.go:1168 +0x2b3

andrewvc added a commit that referenced this pull request Apr 23, 2021
* [Heartbeat] Zip URL Support (#24714)

Adds support for remote zips to browser monitors, letting users just automatically pull from a remote repo.

Fixes elastic/uptime#271

* Fix null check

* Add missing test
@andrewvc
Copy link
Contributor Author

@andrewkroh fixed it in #25288 , apologies for the flakiness!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Heartbeat Team:obs-ds-hosted-services Label for the Observability Hosted Services team v7.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remote Zip URL support for heartbeat synthetics
4 participants