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 fields validation in non utf-8 environments #18130

Merged
merged 3 commits into from
Apr 30, 2020

Conversation

jsoriano
Copy link
Member

@jsoriano jsoriano commented Apr 30, 2020

There was a non-ascii character in fields documentation that was making
fields validation in some tests to fail.

Fix fields validation to don't fail on this case, and replace the non-ascii character.

This should fix tests failing like this one:

[2020-04-30T09:41:34.047Z] ======================================================================
[2020-04-30T09:41:34.047Z] ERROR: statsd server metricset test
[2020-04-30T09:41:34.047Z] ----------------------------------------------------------------------
[2020-04-30T09:41:34.047Z] Traceback (most recent call last):
[2020-04-30T09:41:34.047Z]   File "/var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18125/src/github.com/elastic/beats/x-pack/metricbeat/module/statsd/test_statsd.py", line 46, in test_server
[2020-04-30T09:41:34.047Z]     self.assert_fields_are_documented(evt)
[2020-04-30T09:41:34.047Z]   File "/var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18125/src/github.com/elastic/beats/libbeat/tests/system/beat/beat.py", line 688, in assert_fields_are_documented
[2020-04-30T09:41:34.047Z]     expected_fields, dict_fields, aliases = self.load_fields()
[2020-04-30T09:41:34.047Z]   File "/var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18125/src/github.com/elastic/beats/libbeat/tests/system/beat/beat.py", line 596, in load_fields
[2020-04-30T09:41:34.047Z]     content += f.read()
[2020-04-30T09:41:34.047Z]   File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
[2020-04-30T09:41:34.047Z]     return codecs.ascii_decode(input, self.errors)[0]
[2020-04-30T09:41:34.047Z] UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 702041: ordinal not in range(128)
[2020-04-30T09:41:34.047Z] 
[2020-04-30T09:41:34.047Z] [error] 92.18% test_statsd.Test.test_server: 5.6803s
[2020-04-30T09:41:34.047Z] [success] 7.82% test_xpack_base.Test.test_start_stop: 0.4818s
[2020-04-30T09:41:34.047Z] ----------------------------------------------------------------------
[2020-04-30T09:41:34.047Z] Ran 24 tests in 6.171s

@jsoriano jsoriano added bug review needs_backport PR is waiting to be backported to other branches. :Testing [zube]: In Review Team:Integrations Label for the Integrations team ci labels Apr 30, 2020
@jsoriano jsoriano self-assigned this Apr 30, 2020
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Apr 30, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations (Team:Integrations)

@jsoriano jsoriano removed the needs_team Indicates that the issue/PR needs a Team:* label label Apr 30, 2020
@jsoriano
Copy link
Member Author

Maybe environments have been always running without utf-8, I can reproduce this failure since #17650, where no change in environments was done. Some character in the new fields added there? 🤔

@jsoriano
Copy link
Member Author

@elasticmachine
Copy link
Collaborator

elasticmachine commented Apr 30, 2020

💔 Build Failed

Pipeline View Test View Changes Artifacts preview stats

Expand to view the summary

Build stats

Steps errors

Expand to view the steps failures

  • Name: Make check
    • Description: make check

    • Result: FAILURE

    • Duration: 7 min 5 sec<

    • Start Time: 2020-04-30T13:20:24.249+0000

Log output

Expand to view the last 100 lines of log output

[2020-04-30T13:27:34.310Z] Stage "Journalbeat" skipped due to earlier failure(s)
[2020-04-30T13:27:34.312Z] Stage "Generators" skipped due to earlier failure(s)
[2020-04-30T13:27:34.313Z] Stage "Kubernetes" skipped due to earlier failure(s)
[2020-04-30T13:27:34.523Z] Stage "Heartbeat" skipped due to earlier failure(s)
[2020-04-30T13:27:34.527Z] Stage "Auditbeat oss" skipped due to earlier failure(s)
[2020-04-30T13:27:34.529Z] Stage "Libbeat" skipped due to earlier failure(s)
[2020-04-30T13:27:34.534Z] Stage "Packetbeat" skipped due to earlier failure(s)
[2020-04-30T13:27:34.536Z] Stage "dockerlogbeat" skipped due to earlier failure(s)
[2020-04-30T13:27:34.538Z] Stage "Winlogbeat" skipped due to earlier failure(s)
[2020-04-30T13:27:34.541Z] Stage "Functionbeat" skipped due to earlier failure(s)
[2020-04-30T13:27:34.544Z] Stage "Journalbeat" skipped due to earlier failure(s)
[2020-04-30T13:27:34.547Z] Stage "Generators" skipped due to earlier failure(s)
[2020-04-30T13:27:35.307Z] Failed in branch Elastic Agent x-pack
[2020-04-30T13:27:35.312Z] Failed in branch Elastic Agent x-pack Windows
[2020-04-30T13:27:35.313Z] Failed in branch Elastic Agent Mac OS X
[2020-04-30T13:27:35.315Z] Failed in branch Filebeat oss
[2020-04-30T13:27:35.316Z] Failed in branch Filebeat x-pack
[2020-04-30T13:27:35.320Z] Failed in branch Filebeat Mac OS X
[2020-04-30T13:27:35.321Z] Failed in branch Filebeat Windows
[2020-04-30T13:27:35.322Z] Failed in branch Auditbeat x-pack
[2020-04-30T13:27:35.323Z] Failed in branch Libbeat x-pack
[2020-04-30T13:27:35.324Z] Failed in branch Metricbeat OSS Unit tests
[2020-04-30T13:27:35.325Z] Failed in branch Metricbeat OSS Integration tests
[2020-04-30T13:27:35.326Z] Failed in branch Metricbeat Python integration tests
[2020-04-30T13:27:35.326Z] Failed in branch Metricbeat x-pack
[2020-04-30T13:27:35.329Z] Failed in branch Metricbeat crosscompile
[2020-04-30T13:27:35.331Z] Failed in branch Metricbeat Mac OS X
[2020-04-30T13:27:35.332Z] Failed in branch Metricbeat Windows
[2020-04-30T13:27:35.333Z] Failed in branch Winlogbeat Windows x-pack
[2020-04-30T13:27:35.334Z] Failed in branch Kubernetes
[2020-04-30T13:27:35.949Z] Stage "Heartbeat" skipped due to earlier failure(s)
[2020-04-30T13:27:35.952Z] Stage "Auditbeat oss" skipped due to earlier failure(s)
[2020-04-30T13:27:35.953Z] Stage "Libbeat" skipped due to earlier failure(s)
[2020-04-30T13:27:35.958Z] Stage "Winlogbeat" skipped due to earlier failure(s)
[2020-04-30T13:27:35.960Z] Stage "Functionbeat" skipped due to earlier failure(s)
[2020-04-30T13:27:35.966Z] Stage "Generators" skipped due to earlier failure(s)
[2020-04-30T13:27:36.155Z] Failed in branch Packetbeat
[2020-04-30T13:27:36.157Z] Failed in branch dockerlogbeat
[2020-04-30T13:27:36.159Z] Failed in branch Journalbeat
[2020-04-30T13:27:36.681Z] Stage "Heartbeat" skipped due to earlier failure(s)
[2020-04-30T13:27:36.683Z] Stage "Auditbeat oss" skipped due to earlier failure(s)
[2020-04-30T13:27:36.686Z] Stage "Libbeat" skipped due to earlier failure(s)
[2020-04-30T13:27:36.688Z] Stage "Functionbeat" skipped due to earlier failure(s)
[2020-04-30T13:27:36.690Z] Stage "Generators" skipped due to earlier failure(s)
[2020-04-30T13:27:36.753Z] Failed in branch Winlogbeat
[2020-04-30T13:27:37.189Z] Failed in branch Heartbeat
[2020-04-30T13:27:37.190Z] Failed in branch Libbeat
[2020-04-30T13:27:37.191Z] Failed in branch Functionbeat
[2020-04-30T13:27:37.192Z] Stage "Auditbeat oss" skipped due to earlier failure(s)
[2020-04-30T13:27:37.195Z] Stage "Generators" skipped due to earlier failure(s)
[2020-04-30T13:27:37.438Z] Failed in branch Auditbeat oss
[2020-04-30T13:27:37.439Z] Failed in branch Generators
[2020-04-30T13:27:37.837Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18130/src/github.com/elastic/beats
[2020-04-30T13:27:38.246Z] + find . -type f -name TEST*.xml -path */build/* -delete
[2020-04-30T13:27:38.276Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18130/src/github.com/elastic/beats/Lint
[2020-04-30T13:27:38.804Z] + cat
[2020-04-30T13:27:38.804Z] + /usr/local/bin/runbld ./runbld-script
[2020-04-30T13:27:38.804Z] Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
[2020-04-30T13:27:45.571Z] runbld>>> runbld started
[2020-04-30T13:27:45.572Z] runbld>>> 1.6.11/a66728ff8f4356963772e6e6d2069392fa06acbe
[2020-04-30T13:27:47.032Z] runbld>>> The following profiles matched the job 'Beats/beats-beats-mbp/PR-18130' in order of occurrence in the config (last value wins).
[2020-04-30T13:27:48.043Z] runbld>>> Debug logging enabled.
[2020-04-30T13:27:48.043Z] runbld>>> Storing result
[2020-04-30T13:27:48.347Z] runbld>>> Store result: created {:total 2, :successful 2, :failed 0} 1
[2020-04-30T13:27:48.347Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1587637540455/t/20200430132747-B410C2E5
[2020-04-30T13:27:48.347Z] runbld>>> Adding system facts.
[2020-04-30T13:27:48.962Z] runbld>>> Adding vcs info for the latest commit:  404db2ec697296cc6f105ec58e462b6aa0481128
[2020-04-30T13:27:49.241Z] runbld>>> >>>>>>>>>>>> SCRIPT EXECUTION BEGIN >>>>>>>>>>>>
[2020-04-30T13:27:49.241Z] runbld>>> Adding /usr/lib/jvm/java-8-openjdk-amd64/bin to the path.
[2020-04-30T13:27:49.241Z] + echo 'Processing JUnit reports with runbld...'
[2020-04-30T13:27:49.241Z] Processing JUnit reports with runbld...
[2020-04-30T13:27:49.517Z] runbld>>> <<<<<<<<<<<< SCRIPT EXECUTION END <<<<<<<<<<<<
[2020-04-30T13:27:49.517Z] runbld>>> DURATION: 18ms
[2020-04-30T13:27:49.517Z] runbld>>> STDOUT: 40 bytes
[2020-04-30T13:27:49.517Z] runbld>>> STDERR: 49 bytes
[2020-04-30T13:27:49.517Z] runbld>>> WRAPPED PROCESS: SUCCESS (0)
[2020-04-30T13:27:49.517Z] runbld>>> Searching for build metadata in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18130/src/github.com/elastic/beats
[2020-04-30T13:27:50.534Z] runbld>>> Storing build metadata: 
[2020-04-30T13:27:50.534Z] runbld>>> Adding test report.
[2020-04-30T13:27:50.534Z] runbld>>> Searching for junit test output files with the pattern: TEST-.*\.xml$ in: /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18130/src/github.com/elastic/beats
[2020-04-30T13:27:51.528Z] runbld>>> Found 0 test output files
[2020-04-30T13:27:51.528Z] runbld>>> Test output logs contained: Errors: 0 Failures: 0 Tests: 0 Skipped: 0
[2020-04-30T13:27:51.528Z] runbld>>> Storing result
[2020-04-30T13:27:51.811Z] runbld>>> Store result: updated {:total 2, :successful 2, :failed 0} 2
[2020-04-30T13:27:51.811Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1587637540455/t/20200430132747-B410C2E5
[2020-04-30T13:27:51.811Z] runbld>>> Email notification disabled by environment variable.
[2020-04-30T13:27:51.811Z] runbld>>> Slack notification disabled by environment variable.
[2020-04-30T13:27:59.133Z] Running on Jenkins in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18130
[2020-04-30T13:27:59.668Z] [INFO] getVaultSecret: Getting secrets
[2020-04-30T13:27:59.794Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID
[2020-04-30T13:28:01.063Z] + chmod 755 generate-build-data.sh
[2020-04-30T13:28:01.063Z] + ./generate-build-data.sh https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-18130/ https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-18130/runs/2 FAILURE 921049
[2020-04-30T13:28:01.614Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-18130/runs/2/steps/?limit=10000 -o steps-info.json
[2020-04-30T13:28:02.959Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-18130/runs/2/tests/?status=FAILED -o tests-errors.json
[2020-04-30T13:28:03.209Z] jq: error (at tests-errors.json:4): Cannot index string with string "_links"
[2020-04-30T13:28:03.462Z] jq: error (at tests-errors.json:4): Cannot index string with string "_class"
[2020-04-30T13:28:03.713Z] jq: error (at tests-errors.json:4): Cannot index string with string "state"
[2020-04-30T13:28:03.713Z] jq: error (at tests-errors.json:4): Cannot index string with string "hasStdLog"
[2020-04-30T13:28:03.963Z] jq: error (at tests-errors.json:4): Cannot index string with string "errorStackTrace"
[2020-04-30T13:28:03.963Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-18130/runs/2/log/ -o pipeline-log.txt

@jsoriano jsoriano merged commit 93b5998 into elastic:master Apr 30, 2020
@jsoriano jsoriano deleted the fix-fields-validation-non-utf-8 branch April 30, 2020 16:28
jsoriano added a commit to jsoriano/beats that referenced this pull request Apr 30, 2020
There was a non-ascii character in fields documentation that was making
fields validation in some tests to fail.

Fix fields validation to don't fail on this case, and replace the non-ascii
character.

(cherry picked from commit 93b5998)
@jsoriano jsoriano added v7.8.0 and removed needs_backport PR is waiting to be backported to other branches. labels Apr 30, 2020
jsoriano added a commit that referenced this pull request Apr 30, 2020
There was a non-ascii character in fields documentation that was making
fields validation in some tests to fail.

Fix fields validation to don't fail on this case, and replace the non-ascii
character.

(cherry picked from commit 93b5998)
@kaiyan-sheng
Copy link
Contributor

Thank you for fixing it!!! I finally realized encoding="utf_8" was the problem in #18112 and then realized you already fixed it 👍 👍 👍 👍 Thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants