Documentation ¶
Overview ¶
Package approvaltest contains helper functions to compare and assert the received content of a test vs the accepted.
Index ¶
Constants ¶
const ( // ApprovedSuffix signals a file has been reviewed and approved. ApprovedSuffix = ".approved.json" // ReceivedSuffix signals a file has changed and not yet been approved. ReceivedSuffix = ".received.json" )
Variables ¶
This section is empty.
Functions ¶
func ApproveEvents ¶
ApproveEvents compares the _source of the search hits with the contents of the file in "approvals/<name>.approved.json".
Dynamic fields (@timestamp, observer.id, etc.) are replaced with a static string for comparison. Integration tests elsewhere use canned data to test fields that we do not cover here.
If the events differ, then the test will fail.
func ApproveFields ¶
ApproveFields compares the fields of the search hits with the contents of the file in "approvals/<name>.approved.json".
Dynamic fields (@timestamp, observer.id, etc.) are replaced with a static string for comparison. Integration tests elsewhere use canned data to test fields that we do not cover here.
TODO(axw) eventually remove ApproveEvents when we have updated all calls to use ApproveFields. ApproveFields should be used since it includes runtime fields, whereas ApproveEvents only looks at _source.
Types ¶
This section is empty.