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

Fix null pointer for some SSL configs in heartbeat #26392

Closed
wants to merge 1 commit into from

Conversation

andrewvc
Copy link
Contributor

@andrewvc andrewvc commented Jun 21, 2021

Fixes #26391

We should use a non-pointer type for TLS configs, and use .IsEnabled() to check existence of the subsection.

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 bug Heartbeat Team:obs-ds-hosted-services Label for the Observability Hosted Services team v7.13.3 labels Jun 21, 2021
@andrewvc andrewvc self-assigned this Jun 21, 2021
@andrewvc andrewvc requested a review from a team as a code owner June 21, 2021 16:40
@elasticmachine
Copy link
Collaborator

Pinging @elastic/uptime (Team:Uptime)

@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 Jun 21, 2021
@elasticmachine
Copy link
Collaborator

💔 Tests Failed

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 #26392 opened

  • Start Time: 2021-06-21T16:40:37.398+0000

  • Duration: 27 min 7 sec

  • Commit: 110ae69

Test stats 🧪

Test Results
Failed 6
Passed 690
Skipped 0
Total 696

Trends 🧪

Image of Build Times

Image of Tests

Test errors 6

Expand to view the tests failures

Build&Test / heartbeat-build / TestConfigValidate/Validate_if_no_scheme_is_present_then_it_is_added_correctly – github.com/elastic/beats/v7/heartbeat/monitors/active/http
    Expand to view the error details

     Failed 
    

    Expand to view the stacktrace

     === RUN   TestConfigValidate/Validate_if_no_scheme_is_present_then_it_is_added_correctly
        config_test.go:92: 
            	Error Trace:	config_test.go:92
            	Error:      	Not equal: 
            	            	expected: "http://localhost"
            	            	actual  : "https://localhost"
            	            	
            	            	Diff:
            	            	--- Expected
            	            	+++ Actual
            	            	@@ -1 +1 @@
            	            	-http://localhost
            	            	+https://localhost
            	Test:       	TestConfigValidate/Validate_if_no_scheme_is_present_then_it_is_added_correctly
        --- FAIL: TestConfigValidate/Validate_if_no_scheme_is_present_then_it_is_added_correctly (0.00s)
     
    

Build&Test / heartbeat-build / TestConfigValidate/Validate_if_no_scheme_is_present_but_has_a_port_then_it_is_added_correctly – github.com/elastic/beats/v7/heartbeat/monitors/active/http
    Expand to view the error details

     Failed 
    

    Expand to view the stacktrace

     === RUN   TestConfigValidate/Validate_if_no_scheme_is_present_but_has_a_port_then_it_is_added_correctly
        config_test.go:92: 
            	Error Trace:	config_test.go:92
            	Error:      	Not equal: 
            	            	expected: "http://localhost:8080"
            	            	actual  : "https://localhost:8080"
            	            	
            	            	Diff:
            	            	--- Expected
            	            	+++ Actual
            	            	@@ -1 +1 @@
            	            	-http://localhost:8080
            	            	+https://localhost:8080
            	Test:       	TestConfigValidate/Validate_if_no_scheme_is_present_but_has_a_port_then_it_is_added_correctly
        --- FAIL: TestConfigValidate/Validate_if_no_scheme_is_present_but_has_a_port_then_it_is_added_correctly (0.00s)
     
    

Build&Test / heartbeat-build / TestConfigValidate – github.com/elastic/beats/v7/heartbeat/monitors/active/http
    Expand to view the error details

     Failed 
    

    Expand to view the stacktrace

     === RUN   TestConfigValidate
    --- FAIL: TestConfigValidate (0.00s)
     
    

Build&Test / heartbeat-windows-windows-2019 / TestConfigValidate/Validate_if_no_scheme_is_present_then_it_is_added_correctly – github.com/elastic/beats/v7/heartbeat/monitors/active/http
    Expand to view the error details

     Failed 
    

    Expand to view the stacktrace

     === RUN   TestConfigValidate/Validate_if_no_scheme_is_present_then_it_is_added_correctly
        config_test.go:92: 
            	Error Trace:	config_test.go:92
            	Error:      	Not equal: 
            	            	expected: "http://localhost"
            	            	actual  : "https://localhost"
            	            	
            	            	Diff:
            	            	--- Expected
            	            	+++ Actual
            	            	@@ -1 +1 @@
            	            	-http://localhost
            	            	+https://localhost
            	Test:       	TestConfigValidate/Validate_if_no_scheme_is_present_then_it_is_added_correctly
        --- FAIL: TestConfigValidate/Validate_if_no_scheme_is_present_then_it_is_added_correctly (0.00s)
     
    

Build&Test / heartbeat-windows-windows-2019 / TestConfigValidate/Validate_if_no_scheme_is_present_but_has_a_port_then_it_is_added_correctly – github.com/elastic/beats/v7/heartbeat/monitors/active/http
    Expand to view the error details

     Failed 
    

    Expand to view the stacktrace

     === RUN   TestConfigValidate/Validate_if_no_scheme_is_present_but_has_a_port_then_it_is_added_correctly
        config_test.go:92: 
            	Error Trace:	config_test.go:92
            	Error:      	Not equal: 
            	            	expected: "http://localhost:8080"
            	            	actual  : "https://localhost:8080"
            	            	
            	            	Diff:
            	            	--- Expected
            	            	+++ Actual
            	            	@@ -1 +1 @@
            	            	-http://localhost:8080
            	            	+https://localhost:8080
            	Test:       	TestConfigValidate/Validate_if_no_scheme_is_present_but_has_a_port_then_it_is_added_correctly
        --- FAIL: TestConfigValidate/Validate_if_no_scheme_is_present_but_has_a_port_then_it_is_added_correctly (0.00s)
     
    

Build&Test / heartbeat-windows-windows-2019 / TestConfigValidate – github.com/elastic/beats/v7/heartbeat/monitors/active/http
    Expand to view the error details

     Failed 
    

    Expand to view the stacktrace

     === RUN   TestConfigValidate
    --- FAIL: TestConfigValidate (0.01s)
     
    

Steps errors 3

Expand to view the steps failures

heartbeat-build - mage build test
  • Took 1 min 25 sec . View more details on here
  • Description: mage build test
heartbeat-windows-windows-2019 - mage build unitTest
  • Took 1 min 21 sec . View more details on here
  • Description: mage build unitTest
Error signal
  • Took 0 min 0 sec . View more details on here
  • Description: Error 'hudson.AbortException: script returned exit code 1'

Log output

Expand to view the last 100 lines of log output

[2021-06-21T17:06:14.215Z] coverage: [no statements]
[2021-06-21T17:06:14.215Z] ok  	github.com/elastic/beats/v7/heartbeat/config	0.420s	coverage: [no statements] [no tests to run]
[2021-06-21T17:06:14.215Z] ok  	github.com/elastic/beats/v7/heartbeat/autodiscover/builder/hints	0.551s	coverage: 79.7% of statements
[2021-06-21T17:06:14.789Z] ok  	github.com/elastic/beats/v7/heartbeat/look	0.181s	coverage: 100.0% of statements
[2021-06-21T17:06:15.052Z] ok  	github.com/elastic/beats/v7/heartbeat/monitors	0.401s	coverage: 37.7% of statements
[2021-06-21T17:06:15.315Z] ok  	github.com/elastic/beats/v7/heartbeat/monitors/jobs	0.510s	coverage: 69.2% of statements
[2021-06-21T17:06:15.315Z] ok  	github.com/elastic/beats/v7/heartbeat/monitors/active/dialchain/tlsmeta	0.585s	coverage: 87.5% of statements
[2021-06-21T17:06:15.888Z] ok  	github.com/elastic/beats/v7/heartbeat/monitors/active/icmp	0.738s	coverage: 13.5% of statements
[2021-06-21T17:06:16.461Z] ok  	github.com/elastic/beats/v7/heartbeat/monitors/stdfields	0.202s	coverage: 77.8% of statements
[2021-06-21T17:06:16.461Z] ok  	github.com/elastic/beats/v7/heartbeat/scheduler/schedule	0.283s	coverage: 71.4% of statements
[2021-06-21T17:06:17.409Z] ok  	github.com/elastic/beats/v7/heartbeat	0.683s	coverage: 0.0% of statements
[2021-06-21T17:06:17.409Z] ?   	github.com/elastic/beats/v7/heartbeat/beater	[no test files]
[2021-06-21T17:06:17.409Z] ?   	github.com/elastic/beats/v7/heartbeat/cmd	[no test files]
[2021-06-21T17:06:17.409Z] ?   	github.com/elastic/beats/v7/heartbeat/eventext	[no test files]
[2021-06-21T17:06:17.409Z] ?   	github.com/elastic/beats/v7/heartbeat/hbregistry	[no test files]
[2021-06-21T17:06:17.409Z] ?   	github.com/elastic/beats/v7/heartbeat/hbtest	[no test files]
[2021-06-21T17:06:17.409Z] ?   	github.com/elastic/beats/v7/heartbeat/hbtestllext	[no test files]
[2021-06-21T17:06:17.409Z] ?   	github.com/elastic/beats/v7/heartbeat/include	[no test files]
[2021-06-21T17:06:17.409Z] ?   	github.com/elastic/beats/v7/heartbeat/monitors/active/dialchain	[no test files]
[2021-06-21T17:06:17.672Z] ok  	github.com/elastic/beats/v7/heartbeat/monitors/wrappers	0.330s	coverage: 90.6% of statements
[2021-06-21T17:06:17.934Z] ok  	github.com/elastic/beats/v7/heartbeat/scheduler/timerqueue	0.148s	coverage: 97.7% of statements
[2021-06-21T17:06:17.934Z] ok  	github.com/elastic/beats/v7/heartbeat/scheduler	0.216s	coverage: 85.4% of statements
[2021-06-21T17:06:17.934Z] ok  	github.com/elastic/beats/v7/heartbeat/monitors/active/tcp	2.973s	coverage: 78.6% of statements
[2021-06-21T17:06:18.880Z] FAIL
[2021-06-21T17:06:18.880Z] FAIL	github.com/elastic/beats/v7/heartbeat/monitors/active/http	3.624s
[2021-06-21T17:06:18.880Z] ?   	github.com/elastic/beats/v7/heartbeat/monitors/plugin	[no test files]
[2021-06-21T17:06:18.880Z] ?   	github.com/elastic/beats/v7/heartbeat/reason	[no test files]
[2021-06-21T17:06:18.880Z] ?   	github.com/elastic/beats/v7/heartbeat/scheduler/schedule/cron	[no test files]
[2021-06-21T17:06:18.880Z] ?   	github.com/elastic/beats/v7/heartbeat/scripts/mage	[no test files]
[2021-06-21T17:06:18.880Z] ?   	github.com/elastic/beats/v7/heartbeat/watcher	[no test files]
[2021-06-21T17:06:19.142Z] 
[2021-06-21T17:06:19.142Z] === Failed
[2021-06-21T17:06:19.142Z] === FAIL: heartbeat/monitors/active/http TestConfigValidate/Validate_if_no_scheme_is_present_then_it_is_added_correctly (0.00s)
[2021-06-21T17:06:19.142Z]     config_test.go:92: 
[2021-06-21T17:06:19.142Z]         	Error Trace:	config_test.go:92
[2021-06-21T17:06:19.142Z]         	Error:      	Not equal: 
[2021-06-21T17:06:19.142Z]         	            	expected: "http://localhost"
[2021-06-21T17:06:19.142Z]         	            	actual  : "https://localhost"
[2021-06-21T17:06:19.142Z]         	            	
[2021-06-21T17:06:19.142Z]         	            	Diff:
[2021-06-21T17:06:19.142Z]         	            	--- Expected
[2021-06-21T17:06:19.142Z]         	            	+++ Actual
[2021-06-21T17:06:19.142Z]         	            	@@ -1 +1 @@
[2021-06-21T17:06:19.142Z]         	            	-http://localhost
[2021-06-21T17:06:19.142Z]         	            	+https://localhost
[2021-06-21T17:06:19.142Z]         	Test:       	TestConfigValidate/Validate_if_no_scheme_is_present_then_it_is_added_correctly
[2021-06-21T17:06:19.142Z]     --- FAIL: TestConfigValidate/Validate_if_no_scheme_is_present_then_it_is_added_correctly (0.00s)
[2021-06-21T17:06:19.142Z] 
[2021-06-21T17:06:19.142Z] === FAIL: heartbeat/monitors/active/http TestConfigValidate/Validate_if_no_scheme_is_present_but_has_a_port_then_it_is_added_correctly (0.00s)
[2021-06-21T17:06:19.142Z]     config_test.go:92: 
[2021-06-21T17:06:19.142Z]         	Error Trace:	config_test.go:92
[2021-06-21T17:06:19.142Z]         	Error:      	Not equal: 
[2021-06-21T17:06:19.142Z]         	            	expected: "http://localhost:8080"
[2021-06-21T17:06:19.142Z]         	            	actual  : "https://localhost:8080"
[2021-06-21T17:06:19.142Z]         	            	
[2021-06-21T17:06:19.142Z]         	            	Diff:
[2021-06-21T17:06:19.142Z]         	            	--- Expected
[2021-06-21T17:06:19.142Z]         	            	+++ Actual
[2021-06-21T17:06:19.142Z]         	            	@@ -1 +1 @@
[2021-06-21T17:06:19.142Z]         	            	-http://localhost:8080
[2021-06-21T17:06:19.142Z]         	            	+https://localhost:8080
[2021-06-21T17:06:19.142Z]         	Test:       	TestConfigValidate/Validate_if_no_scheme_is_present_but_has_a_port_then_it_is_added_correctly
[2021-06-21T17:06:19.142Z]     --- FAIL: TestConfigValidate/Validate_if_no_scheme_is_present_but_has_a_port_then_it_is_added_correctly (0.00s)
[2021-06-21T17:06:19.142Z] 
[2021-06-21T17:06:19.142Z] === FAIL: heartbeat/monitors/active/http TestConfigValidate (0.01s)
[2021-06-21T17:06:19.142Z] 
[2021-06-21T17:06:19.142Z] DONE 305 tests, 3 failures in 31.682s
[2021-06-21T17:06:19.403Z] Error: go test returned a non-zero value: exit status 1
[2021-06-21T17:06:19.896Z] 
[2021-06-21T17:06:19.896Z] C:\Users\jenkins\workspace\PR-26392-1-eb49aa02-6b53-4c54-adda-706f9c855ba0\src\github.com\elastic\beats>FOR / %d IN ("ve") DO @IF EXIST "%d" rmdir /s /q "%d" 
[2021-06-21T17:06:20.495Z] 
[2021-06-21T17:06:20.496Z] C:\Users\jenkins\workspace\PR-26392-1-eb49aa02-6b53-4c54-adda-706f9c855ba0\src\github.com\elastic\beats>python .ci/scripts/pre_archive_test.py 
[2021-06-21T17:06:20.756Z] Copy .\heartbeat\build into build\heartbeat\build
[2021-06-21T17:06:20.788Z] Running in C:\Users\jenkins\workspace\PR-26392-1-eb49aa02-6b53-4c54-adda-706f9c855ba0\src\github.com\elastic\beats\build
[2021-06-21T17:06:20.846Z] Recording test results
[2021-06-21T17:06:21.494Z] [Checks API] No suitable checks publisher found.
[2021-06-21T17:06:21.845Z] 
[2021-06-21T17:06:21.845Z] C:\Users\jenkins\workspace\PR-26392-1-eb49aa02-6b53-4c54-adda-706f9c855ba0\src\github.com\elastic\beats\build>tar --version  1>NUL 
[2021-06-21T17:06:22.269Z] 
[2021-06-21T17:06:22.269Z] C:\Users\jenkins\workspace\PR-26392-1-eb49aa02-6b53-4c54-adda-706f9c855ba0\src\github.com\elastic\beats\build>tar --exclude=test-build-artifacts-heartbeat-windows-windows-2019-tgz -czf test-build-artifacts-heartbeat-windows-windows-2019-tgz . 
[2021-06-21T17:06:22.777Z] 
[2021-06-21T17:06:22.777Z] C:\Users\jenkins\workspace\PR-26392-1-eb49aa02-6b53-4c54-adda-706f9c855ba0\src\github.com\elastic\beats\build>gsutil --version  1>NUL 
[2021-06-21T17:06:37.731Z] Masking supported pattern matches of %FILE_CREDENTIAL%
[2021-06-21T17:06:38.416Z] 
[2021-06-21T17:06:38.416Z] C:\Users\jenkins\workspace\PR-26392-1-eb49aa02-6b53-4c54-adda-706f9c855ba0\src\github.com\elastic\beats\build>gcloud auth activate-service-account --key-file **** 
[2021-06-21T17:06:40.329Z] Activated service account credentials for: [beats-ci-gcs-plugin@elastic-ci-prod.iam.gserviceaccount.com]
[2021-06-21T17:06:44.279Z] [INFO] system-tests=''. If no empty then let's create a tarball
[2021-06-21T17:06:44.726Z] 
[2021-06-21T17:06:44.726Z] C:\Users\jenkins\workspace\PR-26392-1-eb49aa02-6b53-4c54-adda-706f9c855ba0\src\github.com\elastic\beats>go clean -modcache 
[2021-06-21T17:07:42.345Z] Failed in branch heartbeat-windows-windows-2019
[2021-06-21T17:07:42.576Z] Stage "Extended" skipped due to earlier failure(s)
[2021-06-21T17:07:42.668Z] Stage "Packaging" skipped due to earlier failure(s)
[2021-06-21T17:07:42.757Z] Stage "Packaging-Pipeline" skipped due to earlier failure(s)
[2021-06-21T17:07:42.875Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-26392/src/github.com/elastic/beats
[2021-06-21T17:07:43.415Z] Running on Jenkins in /var/lib/jenkins/workspace/Beats_beats_PR-26392
[2021-06-21T17:07:43.523Z] [INFO] getVaultSecret: Getting secrets
[2021-06-21T17:07:43.572Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID
[2021-06-21T17:07:44.776Z] + chmod 755 generate-build-data.sh
[2021-06-21T17:07:44.776Z] + ./generate-build-data.sh https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-26392/ https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-26392/runs/1 FAILURE 1627104
[2021-06-21T17:07:44.776Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-26392/runs/1/steps/?limit=10000 -o steps-info.json

🐛 Flaky test report

❕ There are test failures but not known flaky tests.

Expand to view the summary

Test stats 🧪

Test Results
Failed 6
Passed 690
Skipped 0
Total 696

Genuine test errors 6

💔 There are test failures but not known flaky tests, most likely a genuine test failure.

  • Name: Build&Test / heartbeat-build / TestConfigValidate/Validate_if_no_scheme_is_present_then_it_is_added_correctly – github.com/elastic/beats/v7/heartbeat/monitors/active/http
  • Name: Build&Test / heartbeat-build / TestConfigValidate/Validate_if_no_scheme_is_present_but_has_a_port_then_it_is_added_correctly – github.com/elastic/beats/v7/heartbeat/monitors/active/http
  • Name: Build&Test / heartbeat-build / TestConfigValidate – github.com/elastic/beats/v7/heartbeat/monitors/active/http
  • Name: Build&Test / heartbeat-windows-windows-2019 / TestConfigValidate/Validate_if_no_scheme_is_present_then_it_is_added_correctly – github.com/elastic/beats/v7/heartbeat/monitors/active/http
  • Name: Build&Test / heartbeat-windows-windows-2019 / TestConfigValidate/Validate_if_no_scheme_is_present_but_has_a_port_then_it_is_added_correctly – github.com/elastic/beats/v7/heartbeat/monitors/active/http
  • Name: Build&Test / heartbeat-windows-windows-2019 / TestConfigValidate – github.com/elastic/beats/v7/heartbeat/monitors/active/http

@mergify
Copy link
Contributor

mergify bot commented Jun 29, 2021

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b fix-hb-ssl-enabled upstream/fix-hb-ssl-enabled
git merge upstream/master
git push upstream fix-hb-ssl-enabled

@andrewvc
Copy link
Contributor Author

Closing since this was fixed in #25219

@andrewvc andrewvc closed this Jul 20, 2021
@andrewvc andrewvc deleted the fix-hb-ssl-enabled branch July 20, 2021 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Heartbeat Team:obs-ds-hosted-services Label for the Observability Hosted Services team v7.13.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Heartbeat] Fix null pointer in per-monitor SSL setting
2 participants