Skip to content

Commit

Permalink
Fixes TestUnpackConfig/overwrite_default (#5356) (#5384)
Browse files Browse the repository at this point in the history
tlscommon captures a new closure that assert.Equals can not compare

(cherry picked from commit a6b7a75)

Co-authored-by: Martijn Laarman <[email protected]>
  • Loading branch information
mergify[bot] and Mpdreamz authored Jun 1, 2021
1 parent e9bbce6 commit 5e1d116
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions beater/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,13 +450,15 @@ func TestUnpackConfig(t *testing.T) {
cfg, err := NewConfig(inpCfg, nil)
require.NoError(t, err)
require.NotNil(t, cfg)
if test.outCfg.JaegerConfig.GRPC.TLS != nil {
// tlscommon sets VerifyConnection to a closure, so we
// cannot compare the TLS configs as-is. We don't need
// to test libbeat behaviour, so just unset the field.
test.outCfg.JaegerConfig.GRPC.TLS.VerifyConnection = nil
if test.outCfg.JaegerConfig.GRPC.TLS != nil || cfg.JaegerConfig.GRPC.TLS != nil {
// tlscommon captures closures for the following callbacks
// setting them to nil to skip these from comparison
cfg.JaegerConfig.GRPC.TLS.VerifyConnection = nil
test.outCfg.JaegerConfig.GRPC.TLS.VerifyConnection = nil
test.outCfg.JaegerConfig.GRPC.TLS.ClientCAs = nil
cfg.JaegerConfig.GRPC.TLS.ClientCAs = nil
}

assert.Equal(t, test.outCfg, cfg)
})
}
Expand Down

0 comments on commit 5e1d116

Please sign in to comment.