@@ -14,10 +14,10 @@ import (
14
14
"time"
15
15
16
16
"github.com/DataDog/datadog-trace-agent/config"
17
- "github.com/DataDog/datadog-trace-agent/fixtures"
18
17
"github.com/DataDog/datadog-trace-agent/info"
19
18
"github.com/DataDog/datadog-trace-agent/model"
20
19
"github.com/DataDog/datadog-trace-agent/sampler"
20
+ "github.com/DataDog/datadog-trace-agent/testutil"
21
21
"github.com/stretchr/testify/assert"
22
22
"github.com/tinylib/msgp/msgp"
23
23
)
@@ -113,8 +113,8 @@ func TestLegacyReceiver(t *testing.T) {
113
113
contentType string
114
114
traces model.Trace
115
115
}{
116
- {"v01 with empty content-type" , NewTestReceiverFromConfig (conf ), v01 , "" , model.Trace {fixtures .GetTestSpan ()}},
117
- {"v01 with application/json" , NewTestReceiverFromConfig (conf ), v01 , "application/json" , model.Trace {fixtures .GetTestSpan ()}},
116
+ {"v01 with empty content-type" , NewTestReceiverFromConfig (conf ), v01 , "" , model.Trace {testutil .GetTestSpan ()}},
117
+ {"v01 with application/json" , NewTestReceiverFromConfig (conf ), v01 , "application/json" , model.Trace {testutil .GetTestSpan ()}},
118
118
}
119
119
120
120
for _ , tc := range testCases {
@@ -169,15 +169,15 @@ func TestReceiverJSONDecoder(t *testing.T) {
169
169
contentType string
170
170
traces []model.Trace
171
171
}{
172
- {"v02 with empty content-type" , NewTestReceiverFromConfig (conf ), v02 , "" , fixtures .GetTestTrace (1 , 1 , false )},
173
- {"v03 with empty content-type" , NewTestReceiverFromConfig (conf ), v03 , "" , fixtures .GetTestTrace (1 , 1 , false )},
174
- {"v04 with empty content-type" , NewTestReceiverFromConfig (conf ), v04 , "" , fixtures .GetTestTrace (1 , 1 , false )},
175
- {"v02 with application/json" , NewTestReceiverFromConfig (conf ), v02 , "application/json" , fixtures .GetTestTrace (1 , 1 , false )},
176
- {"v03 with application/json" , NewTestReceiverFromConfig (conf ), v03 , "application/json" , fixtures .GetTestTrace (1 , 1 , false )},
177
- {"v04 with application/json" , NewTestReceiverFromConfig (conf ), v04 , "application/json" , fixtures .GetTestTrace (1 , 1 , false )},
178
- {"v02 with text/json" , NewTestReceiverFromConfig (conf ), v02 , "text/json" , fixtures .GetTestTrace (1 , 1 , false )},
179
- {"v03 with text/json" , NewTestReceiverFromConfig (conf ), v03 , "text/json" , fixtures .GetTestTrace (1 , 1 , false )},
180
- {"v04 with text/json" , NewTestReceiverFromConfig (conf ), v04 , "text/json" , fixtures .GetTestTrace (1 , 1 , false )},
172
+ {"v02 with empty content-type" , NewTestReceiverFromConfig (conf ), v02 , "" , testutil .GetTestTrace (1 , 1 , false )},
173
+ {"v03 with empty content-type" , NewTestReceiverFromConfig (conf ), v03 , "" , testutil .GetTestTrace (1 , 1 , false )},
174
+ {"v04 with empty content-type" , NewTestReceiverFromConfig (conf ), v04 , "" , testutil .GetTestTrace (1 , 1 , false )},
175
+ {"v02 with application/json" , NewTestReceiverFromConfig (conf ), v02 , "application/json" , testutil .GetTestTrace (1 , 1 , false )},
176
+ {"v03 with application/json" , NewTestReceiverFromConfig (conf ), v03 , "application/json" , testutil .GetTestTrace (1 , 1 , false )},
177
+ {"v04 with application/json" , NewTestReceiverFromConfig (conf ), v04 , "application/json" , testutil .GetTestTrace (1 , 1 , false )},
178
+ {"v02 with text/json" , NewTestReceiverFromConfig (conf ), v02 , "text/json" , testutil .GetTestTrace (1 , 1 , false )},
179
+ {"v03 with text/json" , NewTestReceiverFromConfig (conf ), v03 , "text/json" , testutil .GetTestTrace (1 , 1 , false )},
180
+ {"v04 with text/json" , NewTestReceiverFromConfig (conf ), v04 , "text/json" , testutil .GetTestTrace (1 , 1 , false )},
181
181
}
182
182
183
183
for _ , tc := range testCases {
@@ -233,10 +233,10 @@ func TestReceiverMsgpackDecoder(t *testing.T) {
233
233
contentType string
234
234
traces model.Traces
235
235
}{
236
- {"v01 with application/msgpack" , NewTestReceiverFromConfig (conf ), v01 , "application/msgpack" , fixtures .GetTestTrace (1 , 1 , false )},
237
- {"v02 with application/msgpack" , NewTestReceiverFromConfig (conf ), v02 , "application/msgpack" , fixtures .GetTestTrace (1 , 1 , false )},
238
- {"v03 with application/msgpack" , NewTestReceiverFromConfig (conf ), v03 , "application/msgpack" , fixtures .GetTestTrace (1 , 1 , false )},
239
- {"v04 with application/msgpack" , NewTestReceiverFromConfig (conf ), v04 , "application/msgpack" , fixtures .GetTestTrace (1 , 1 , false )},
236
+ {"v01 with application/msgpack" , NewTestReceiverFromConfig (conf ), v01 , "application/msgpack" , testutil .GetTestTrace (1 , 1 , false )},
237
+ {"v02 with application/msgpack" , NewTestReceiverFromConfig (conf ), v02 , "application/msgpack" , testutil .GetTestTrace (1 , 1 , false )},
238
+ {"v03 with application/msgpack" , NewTestReceiverFromConfig (conf ), v03 , "application/msgpack" , testutil .GetTestTrace (1 , 1 , false )},
239
+ {"v04 with application/msgpack" , NewTestReceiverFromConfig (conf ), v04 , "application/msgpack" , testutil .GetTestTrace (1 , 1 , false )},
240
240
}
241
241
242
242
for _ , tc := range testCases {
@@ -492,7 +492,7 @@ func TestHandleTraces(t *testing.T) {
492
492
493
493
// prepare the msgpack payload
494
494
var buf bytes.Buffer
495
- msgp .Encode (& buf , fixtures .GetTestTrace (10 , 10 , true ))
495
+ msgp .Encode (& buf , testutil .GetTestTrace (10 , 10 , true ))
496
496
497
497
// prepare the receiver
498
498
conf := NewTestReceiverConfig ()
@@ -556,7 +556,7 @@ func TestReceiverPreSamplerCancel(t *testing.T) {
556
556
var buf bytes.Buffer
557
557
558
558
n := 100 // Payloads need to be big enough, else bug is not triggered
559
- msgp .Encode (& buf , fixtures .GetTestTrace (n , n , true ))
559
+ msgp .Encode (& buf , testutil .GetTestTrace (n , n , true ))
560
560
561
561
conf := NewTestReceiverConfig ()
562
562
conf .PreSampleRate = 0.000001 // Make sure we sample aggressively
@@ -598,7 +598,7 @@ func BenchmarkHandleTracesFromOneApp(b *testing.B) {
598
598
// prepare the payload
599
599
// msgpack payload
600
600
var buf bytes.Buffer
601
- msgp .Encode (& buf , fixtures .GetTestTrace (1 , 1 , true ))
601
+ msgp .Encode (& buf , testutil .GetTestTrace (1 , 1 , true ))
602
602
603
603
// prepare the receiver
604
604
conf := NewTestReceiverConfig ()
@@ -638,7 +638,7 @@ func BenchmarkHandleTracesFromMultipleApps(b *testing.B) {
638
638
// prepare the payload
639
639
// msgpack payload
640
640
var buf bytes.Buffer
641
- msgp .Encode (& buf , fixtures .GetTestTrace (1 , 1 , true ))
641
+ msgp .Encode (& buf , testutil .GetTestTrace (1 , 1 , true ))
642
642
643
643
// prepare the receiver
644
644
conf := NewTestReceiverConfig ()
@@ -676,7 +676,7 @@ func BenchmarkHandleTracesFromMultipleApps(b *testing.B) {
676
676
677
677
func BenchmarkDecoderJSON (b * testing.B ) {
678
678
assert := assert .New (b )
679
- traces := fixtures .GetTestTrace (150 , 66 , true )
679
+ traces := testutil .GetTestTrace (150 , 66 , true )
680
680
681
681
// json payload
682
682
payload , err := json .Marshal (traces )
@@ -701,7 +701,7 @@ func BenchmarkDecoderMsgpack(b *testing.B) {
701
701
702
702
// msgpack payload
703
703
var buf bytes.Buffer
704
- err := msgp .Encode (& buf , fixtures .GetTestTrace (150 , 66 , true ))
704
+ err := msgp .Encode (& buf , testutil .GetTestTrace (150 , 66 , true ))
705
705
assert .Nil (err )
706
706
707
707
// benchmark
0 commit comments