Increase unit coverage#1685
Conversation
| } | ||
|
|
||
| func TestNewMeta_EmptyArgs(t *testing.T) { | ||
| m := NewMeta("", "", "") |
There was a problem hiding this comment.
I think this test and SetsAllFields and maybe the global meta tests could all be one tests
| after := time.Now().Add(1 * time.Second) | ||
|
|
||
| require.NotNil(t, m.Timestamp) | ||
| ts := time.Unix(m.Timestamp.Seconds, int64(m.Timestamp.Nanos)) |
There was a problem hiding this comment.
I'm not really sure I understand this test. For the timestamp we just do types.TimestampNow() so this feels like its just testing Go's timestamp.Now function
| } | ||
|
|
||
| func TestNewMessageMeta_ConcurrentReads(t *testing.T) { | ||
| resetMetaForTest() |
There was a problem hiding this comment.
I'm not sure this test is needed, the go routines are just reading the values that are not being changed so wont find race conditions
| assert.Equal(t, testBearer, ci.bearer) | ||
| } | ||
|
|
||
| func TestNewClientAuth_MultipleOptions(t *testing.T) { |
There was a problem hiding this comment.
I think these tesNewClientAuth tests could be refactored to be done in the one test
| assert.Equal(t, []string{testToken}, md.Get(TokenHeader)) | ||
| } | ||
|
|
||
| func TestClientInterceptor_CustomLogger(t *testing.T) { |
There was a problem hiding this comment.
Think this could be added to the NewClientAuth tests
| "github.com/stretchr/testify/assert" | ||
| ) | ||
|
|
||
| func TestClientInterceptor_ImplementsInterfaces(t *testing.T) { |
There was a problem hiding this comment.
This check can be done in the code its self I think with
var _ ClientInterceptor= (*clientInterceptor)(nil) in the client.go file
| } | ||
| } | ||
|
|
||
| func TestGetTimeMetrics_Median(t *testing.T) { |
There was a problem hiding this comment.
I think some of these tests can be joined into one
Proposed changes
Increased unit test coverage for agent v2.
Checklist
Before creating a PR, run through this checklist and mark each as complete.
CONTRIBUTINGdocumentmake install-toolsand have attached any dependency changes to this pull requestREADME.md)