fix: Improve parser tests by using go-cmp/cmp#10497
Merged
MyaLongmire merged 2 commits intoinfluxdata:masterfrom Feb 10, 2022
Merged
fix: Improve parser tests by using go-cmp/cmp#10497MyaLongmire merged 2 commits intoinfluxdata:masterfrom
MyaLongmire merged 2 commits intoinfluxdata:masterfrom
Conversation
3 tasks
Contributor
|
👍 This pull request doesn't change the Telegraf binary size 📦 Looks like new artifacts were built from this PR. Expand this list to get them here ! 🐯Artifact URLs |
etycomputer
approved these changes
Feb 1, 2022
Contributor
etycomputer
left a comment
There was a problem hiding this comment.
Looks good to me @srebhan.
Thanks for making the change
powersj
reviewed
Feb 2, 2022
powersj
approved these changes
Feb 2, 2022
powersj
reviewed
Feb 8, 2022
| ef.Set(v) | ||
| gf.Set(v) | ||
| } | ||
| options = append(options, cmpopts.IgnoreFields(stype, settings.mask...)) |
Contributor
There was a problem hiding this comment.
For the above set of code, can you briefly explain what is going on?
It looks like we are taking parser type and ignoring out various unexported fields that the parser has?
Contributor
There was a problem hiding this comment.
The idea is to ignore all unexported fields and telegraf.Logger, and add the fields that are needed to check specifically by name in the override structure.
powersj
approved these changes
Feb 10, 2022
MyaLongmire
approved these changes
Feb 10, 2022
pteich
added a commit
to pteich/telegraf
that referenced
this pull request
Feb 13, 2022
* master: (117 commits) fix: bump github.com/nats-io/nats-server/v2 from 2.6.5 to 2.7.2 (influxdata#10638) chore: add -race flag to go tests (influxdata#10629) feat: update etc/telegraf.conf and etc/telegraf_windows.conf (influxdata#10631) fix: license doc outdated causing CI failure (influxdata#10630) fix: bump k8s.io/client-go from 0.22.2 to 0.23.3 (influxdata#10589) feat: Implemented support for reading raw values, added tests and doc (influxdata#6501) fix: Improve parser tests by using go-cmp/cmp (influxdata#10497) feat(mongodb): add FsTotalSize and FsUsedSize informations (influxdata#10625) docs: update quay docs for auth (influxdata#10612) chore: allow downgrade of go version in windows script (influxdata#10614) chore: update CI go to 1.17.6 (influxdata#10611) feat: update etc/telegraf.conf and etc/telegraf_windows.conf (influxdata#10600) fix(inputs.opcua): add more data to error log (influxdata#10465) fix: bump github.com/aws/aws-sdk-go-v2/service/kinesis from 1.6.0 to 1.13.0 (influxdata#10601) refactor: use early return pattern (influxdata#10591) fix: bump github.com/benbjohnson/clock from 1.1.0 to 1.3.0 (influxdata#10588) feat: add dynamic tagging to gnmi plugin (influxdata#7484) fix: bump github.com/Azure/azure-kusto-go from 0.5.0 to 0.5.2 (influxdata#10598) feat: update etc/telegraf.conf and etc/telegraf_windows.conf (influxdata#10584) fix(parsers.json_v2): allow optional paths and handle wrong paths correctly (influxdata#10468) ... # Conflicts: # plugins/outputs/elasticsearch/elasticsearch.go # plugins/outputs/elasticsearch/elasticsearch_test.go
phemmer
added a commit
to phemmer/telegraf
that referenced
this pull request
Feb 18, 2022
* origin/master: (211 commits) feat: update configs (influxdata#10676) feat[elastic output]: add elastic pipeline flags (influxdata#10505) Update changelog fix: ensure folders do not get loaded more than once (influxdata#10551) docs: update VMWare doc links (influxdata#10663) fix: prometheusremotewrite wrong timestamp unit (influxdata#10547) feat: update configs (influxdata#10662) fix: add graylog toml tags (influxdata#10660) feat: add socks5 proxy support for kafka output plugin (influxdata#8192) docs: override reported OpenSearch version (influxdata#10586) feat: update etc/telegraf.conf and etc/telegraf_windows.conf (influxdata#10659) fix: bump all go.opentelemetry.io dependencies (influxdata#10647) feat: collection offset implementation (influxdata#10545) chore: update go to 1.17.7 (influxdata#10658) fix: check for nil client before closing in amqp (influxdata#10635) fix: timestamp change during execution of json_v2 parser. (influxdata#10657) fix: bump github.com/signalfx/golib/v3 from 3.3.38 to 3.3.43 (influxdata#10652) fix: bump github.com/aliyun/alibaba-cloud-sdk-go (influxdata#10653) fix: incorrect handling of json_v2 timestamp_path (influxdata#10618) feat: gather additional stats from memcached (influxdata#10641) feat: update etc/telegraf.conf and etc/telegraf_windows.conf (influxdata#10649) fix: Revert deprecation of http_listener_v2 (influxdata#10648) fix: bump github.com/denisenkom/go-mssqldb from 0.10.0 to 0.12.0 (influxdata#10503) fix: bump github.com/gopcua/opcua from 0.2.3 to 0.3.1 (influxdata#10626) fix: use current time as ecs timestamp (influxdata#10636) fix: bump github.com/nats-io/nats-server/v2 from 2.6.5 to 2.7.2 (influxdata#10638) chore: add -race flag to go tests (influxdata#10629) feat: update etc/telegraf.conf and etc/telegraf_windows.conf (influxdata#10631) fix: license doc outdated causing CI failure (influxdata#10630) fix: bump k8s.io/client-go from 0.22.2 to 0.23.3 (influxdata#10589) feat: Implemented support for reading raw values, added tests and doc (influxdata#6501) fix: Improve parser tests by using go-cmp/cmp (influxdata#10497) feat(mongodb): add FsTotalSize and FsUsedSize informations (influxdata#10625) docs: update quay docs for auth (influxdata#10612) chore: allow downgrade of go version in windows script (influxdata#10614) chore: update CI go to 1.17.6 (influxdata#10611) feat: update etc/telegraf.conf and etc/telegraf_windows.conf (influxdata#10600) fix(inputs.opcua): add more data to error log (influxdata#10465) fix: bump github.com/aws/aws-sdk-go-v2/service/kinesis from 1.6.0 to 1.13.0 (influxdata#10601) refactor: use early return pattern (influxdata#10591) ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Will fix CI error in #10083.
The current parser tests in
config/config_testis usingrequire.EqualValues()which also checks on unexported fields of the parser to test. This leads to problems due to internal states (see CI error in #10083 orxpath_*) which cannot be ignored with the mentioned function.As we do not want to check internal states anyway (but only check if the parsers are equally configured) we change the comparision in this PR to use
github.com/google/go-cmp/cmp. By this we can flexibly ignore certain fields. By default, both unexported fields andtelegraf.Loggerare ignored. Additional fields can be specified by name in theoverridestructure.As a side effect, the testing code becomes more compact and readable.