Skip to content
This repository was archived by the owner on Aug 30, 2019. It is now read-only.

Commit cb5ded3

Browse files
committed
fixtures: rename to testutil
1 parent cd22ce3 commit cb5ded3

20 files changed

+84
-995
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ ci:
3636
# task used by CI
3737
GOOS=windows go build ./cmd/trace-agent # ensure windows builds
3838
go get -u github.com/golang/lint/golint/...
39-
golint -set_exit_status=1 ./cmd/trace-agent ./filters ./fixtures ./info ./quantile ./obfuscate ./sampler ./statsd ./watchdog ./writer ./flags ./osutil
39+
golint -set_exit_status=1 ./cmd/trace-agent ./filters ./testutil ./info ./quantile ./obfuscate ./sampler ./statsd ./watchdog ./writer ./flags ./osutil
4040
go test -v ./...
4141

4242
windows:

cmd/trace-agent/agent_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ import (
1313
log "github.com/cihub/seelog"
1414

1515
"github.com/DataDog/datadog-trace-agent/config"
16-
"github.com/DataDog/datadog-trace-agent/fixtures"
1716
"github.com/DataDog/datadog-trace-agent/info"
1817
"github.com/DataDog/datadog-trace-agent/model"
1918
"github.com/DataDog/datadog-trace-agent/obfuscate"
19+
"github.com/DataDog/datadog-trace-agent/testutil"
2020
"github.com/stretchr/testify/assert"
2121
)
2222

@@ -208,7 +208,7 @@ func runTraceProcessingBenchmark(b *testing.B, c *config.AgentConfig) {
208208
b.ResetTimer()
209209
b.ReportAllocs()
210210
for i := 0; i < b.N; i++ {
211-
agent.Process(fixtures.RandomTrace(10, 8))
211+
agent.Process(testutil.RandomTrace(10, 8))
212212
}
213213
}
214214

cmd/trace-agent/model_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ package main
66
import (
77
"testing"
88

9-
"github.com/DataDog/datadog-trace-agent/fixtures"
109
"github.com/DataDog/datadog-trace-agent/model"
10+
"github.com/DataDog/datadog-trace-agent/testutil"
1111
)
1212

1313
const (
@@ -21,7 +21,7 @@ func BenchmarkHandleSpanRandom(b *testing.B) {
2121
b.ResetTimer()
2222
b.ReportAllocs()
2323
for i := 0; i < b.N; i++ {
24-
trace := fixtures.RandomTrace(10, 8)
24+
trace := testutil.RandomTrace(10, 8)
2525
root := trace.GetRoot()
2626
trace.ComputeTopLevel()
2727
wt := model.NewWeightedTrace(trace, root)

cmd/trace-agent/receiver_test.go

+22-22
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ import (
1414
"time"
1515

1616
"github.com/DataDog/datadog-trace-agent/config"
17-
"github.com/DataDog/datadog-trace-agent/fixtures"
1817
"github.com/DataDog/datadog-trace-agent/info"
1918
"github.com/DataDog/datadog-trace-agent/model"
2019
"github.com/DataDog/datadog-trace-agent/sampler"
20+
"github.com/DataDog/datadog-trace-agent/testutil"
2121
"github.com/stretchr/testify/assert"
2222
"github.com/tinylib/msgp/msgp"
2323
)
@@ -113,8 +113,8 @@ func TestLegacyReceiver(t *testing.T) {
113113
contentType string
114114
traces model.Trace
115115
}{
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()}},
118118
}
119119

120120
for _, tc := range testCases {
@@ -169,15 +169,15 @@ func TestReceiverJSONDecoder(t *testing.T) {
169169
contentType string
170170
traces []model.Trace
171171
}{
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)},
181181
}
182182

183183
for _, tc := range testCases {
@@ -233,10 +233,10 @@ func TestReceiverMsgpackDecoder(t *testing.T) {
233233
contentType string
234234
traces model.Traces
235235
}{
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)},
240240
}
241241

242242
for _, tc := range testCases {
@@ -492,7 +492,7 @@ func TestHandleTraces(t *testing.T) {
492492

493493
// prepare the msgpack payload
494494
var buf bytes.Buffer
495-
msgp.Encode(&buf, fixtures.GetTestTrace(10, 10, true))
495+
msgp.Encode(&buf, testutil.GetTestTrace(10, 10, true))
496496

497497
// prepare the receiver
498498
conf := NewTestReceiverConfig()
@@ -556,7 +556,7 @@ func TestReceiverPreSamplerCancel(t *testing.T) {
556556
var buf bytes.Buffer
557557

558558
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))
560560

561561
conf := NewTestReceiverConfig()
562562
conf.PreSampleRate = 0.000001 // Make sure we sample aggressively
@@ -598,7 +598,7 @@ func BenchmarkHandleTracesFromOneApp(b *testing.B) {
598598
// prepare the payload
599599
// msgpack payload
600600
var buf bytes.Buffer
601-
msgp.Encode(&buf, fixtures.GetTestTrace(1, 1, true))
601+
msgp.Encode(&buf, testutil.GetTestTrace(1, 1, true))
602602

603603
// prepare the receiver
604604
conf := NewTestReceiverConfig()
@@ -638,7 +638,7 @@ func BenchmarkHandleTracesFromMultipleApps(b *testing.B) {
638638
// prepare the payload
639639
// msgpack payload
640640
var buf bytes.Buffer
641-
msgp.Encode(&buf, fixtures.GetTestTrace(1, 1, true))
641+
msgp.Encode(&buf, testutil.GetTestTrace(1, 1, true))
642642

643643
// prepare the receiver
644644
conf := NewTestReceiverConfig()
@@ -676,7 +676,7 @@ func BenchmarkHandleTracesFromMultipleApps(b *testing.B) {
676676

677677
func BenchmarkDecoderJSON(b *testing.B) {
678678
assert := assert.New(b)
679-
traces := fixtures.GetTestTrace(150, 66, true)
679+
traces := testutil.GetTestTrace(150, 66, true)
680680

681681
// json payload
682682
payload, err := json.Marshal(traces)
@@ -701,7 +701,7 @@ func BenchmarkDecoderMsgpack(b *testing.B) {
701701

702702
// msgpack payload
703703
var buf bytes.Buffer
704-
err := msgp.Encode(&buf, fixtures.GetTestTrace(150, 66, true))
704+
err := msgp.Encode(&buf, testutil.GetTestTrace(150, 66, true))
705705
assert.Nil(err)
706706

707707
// benchmark

filters/blacklister_test.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ package filters
33
import (
44
"testing"
55

6-
"github.com/DataDog/datadog-trace-agent/fixtures"
6+
"github.com/DataDog/datadog-trace-agent/testutil"
7+
78
"github.com/stretchr/testify/assert"
89
)
910

@@ -30,7 +31,7 @@ func TestBlacklister(t *testing.T) {
3031
}
3132

3233
for _, test := range tests {
33-
span := fixtures.RandomSpan()
34+
span := testutil.RandomSpan()
3435
span.Resource = test.resource
3536
filter := NewBlacklister(test.filter)
3637

@@ -41,7 +42,7 @@ func TestBlacklister(t *testing.T) {
4142
func TestCompileRules(t *testing.T) {
4243
filter := NewBlacklister([]string{"[123", "]123", "{6}"})
4344
for i := 0; i < 100; i++ {
44-
span := fixtures.RandomSpan()
45+
span := testutil.RandomSpan()
4546
assert.True(t, filter.Allows(span))
4647
}
4748
}

fixtures/backoff.go

-59
This file was deleted.

fixtures/fixtures.go

-11
This file was deleted.

fixtures/random.go

-31
This file was deleted.

fixtures/services.go

-29
This file was deleted.

0 commit comments

Comments
 (0)