Skip to content

Commit 0d545d3

Browse files
committed
quality fixtures
1 parent 11446b1 commit 0d545d3

File tree

5 files changed

+25
-30
lines changed

5 files changed

+25
-30
lines changed

CONTRIBUTING

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
All development activity takes place on github.
2+
3+
If you think you've discovered a bug, or you would like
4+
to make a feature request please do this through github.

README.md

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,35 @@
11
# DataDog Server mock
22

3-
2MB golang server listening on port 8125 writing metrics to stdout.
3+
golang server listening on port 8125 writing metrics to stdout. (datadog/mock 3.02MB)
44

55
### Bootstrap
66

7-
```
8-
make install
9-
make test
10-
```
7+
Require docker to assembly
8+
9+
`make install test`
1110

1211
### Running
1312

14-
```
15-
make run
16-
```
13+
automagically
14+
15+
`make run`
1716

18-
or
17+
run in docker
1918

20-
```
21-
docker run -it --log-driver none --rm -p 0.0.0.0:8125:8125/UDP datadog/mock
22-
```
19+
`docker run -it --log-driver none --rm -p 0.0.0.0:8125:8125/UDP datadog/mock`
2320

24-
or
21+
run on host
2522

26-
```
27-
./target/datadog_mock
28-
```
23+
`./target/datadog_mock`
2924

3025

3126
### Verify
3227

33-
When datadog/mock is running
28+
When datadog/mock is running run manually
3429

35-
```
36-
echo "deploys.test.myservice:1|c" > /dev/udp/127.0.0.1/8125
37-
```
30+
`echo "deploys.test.myservice:1|c" > /dev/udp/127.0.0.1/8125`
3831

39-
or
32+
or send MESSAGE repeat EACH second
4033

41-
```
42-
EACH=.001 ./dev/event-producer.sh
43-
```
34+
`MESSAGE="deploys.test.myservice:1|c" EACH=.001 ./dev/event-producer.sh`
4435

dev/event-producer.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ set -eo pipefail
55
trap exit INT TERM
66

77
####
8-
sample="deploys.test.myservice:1|c"
98

109
[ -z $EACH ] && EACH=2 || :
10+
[ -z $MESSAGE ] && MESSAGE="deploys.test.myservice:1|c" || :
1111

12-
printf "[info] sending \"%s\" every %ssec\n" $sample $EACH
12+
printf "[info] sending \"%s\" every %ssec\n" $MESSAGE $EACH
1313

1414
####
1515

1616
while true; do
17-
echo $sample > /dev/udp/127.0.0.1/8125
17+
echo $MESSAGE > /dev/udp/127.0.0.1/8125
1818
sleep $EACH
1919
done
2020

src/datadog-mock/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func main() {
2626
stream, err := net.ResolveUDPAddr("udp", ":8125")
2727

2828
if err != nil {
29-
fmt.Println("Fatal: %v", err)
29+
fmt.Println(err)
3030
os.Exit(1)
3131
}
3232

src/datadog-mock/sink.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func (r *sink) Run(addr *net.UDPAddr) {
2828
inputStreamConn, err := net.ListenUDP("udp", addr)
2929

3030
if err != nil {
31-
fmt.Println("Fatal: %v", err)
31+
fmt.Println(err)
3232
os.Exit(1)
3333
}
3434

@@ -39,7 +39,7 @@ func (r *sink) Run(addr *net.UDPAddr) {
3939
forever:
4040
n, _, err := inputStreamConn.ReadFromUDP(buf)
4141
if err != nil {
42-
fmt.Println("Error: %v", err)
42+
fmt.Println(err)
4343
goto forever
4444
}
4545

0 commit comments

Comments
 (0)