[Metricbeat][ Add option to remove fields from comparison in mocked tests and mage target#11703
[Metricbeat][ Add option to remove fields from comparison in mocked tests and mage target#11703sayden wants to merge 0 commit intoelastic:masterfrom
Conversation
There was a problem hiding this comment.
There's a Package field in GoTestArgs type but the order of the executed contents isn't correct when using it. By placing everything as ExtraFlag I could control the order of the flags and package run.
There was a problem hiding this comment.
@ruflin I modified this from MarshalIndent to just Marshal. I understood that the idea of using indent was to write into the data.json file in pretty format but for comparison it wasn't nice when it failed as the console was escaping newlines like here

There was a problem hiding this comment.
No strong preference as long as the files written to disk are indented.
For the screenshot you posted: It shows the error pretty well I would say.
There was a problem hiding this comment.
Added some example config file for full reference :)
ruflin
left a comment
There was a problem hiding this comment.
Thank your for the addition of the docs.
I suggest to take out docs and magefile change into a separate PR for further discussion so we can get the field remove code in quickly to rebase the apache module on top of it. WDYT?
There was a problem hiding this comment.
No strong preference as long as the files written to disk are indented.
For the screenshot you posted: It shows the error pretty well I would say.
There was a problem hiding this comment.
It's not correct that the server is launched on 5555, it's a random port selected but we hardcode 5555 in the final event.
88ca161 to
460354d
Compare
|
Closed this by mistake, I cannot reopen it now 🤓 PR has been split in 3:
|
Added 3 things:
remove_fields_from_comparisonto remove fields from the JSON generated and expected files to byte-to-byte comparison when asserting tests.mockedTeststo avoid navigating tobeats/metricbeat/mb/testing/datato run tests.The PR can be considered a WIP but some overlook might be nice @ruflin to know if you like the current heading and altitude 😉