File tree 3 files changed +30
-0
lines changed
3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ script:
25
25
- go test ./service/static -race -v -coverprofile=static.txt -covermode=atomic
26
26
- go test ./service/limit -race -v -coverprofile=limit.txt -covermode=atomic
27
27
- go test ./service/headers -race -v -coverprofile=headers.txt -covermode=atomic
28
+ - go test ./service/metrics -race -v -coverprofile=metrics.txt -covermode=atomic
28
29
29
30
after_success :
30
31
- bash <(curl -s https://codecov.io/bash) -f lib.txt
@@ -36,6 +37,7 @@ after_success:
36
37
- bash <(curl -s https://codecov.io/bash) -f static.txt
37
38
- bash <(curl -s https://codecov.io/bash) -f limit.txt
38
39
- bash <(curl -s https://codecov.io/bash) -f headers.txt
40
+ - bash <(curl -s https://codecov.io/bash) -f metrics.txt
39
41
40
42
jobs :
41
43
include :
Original file line number Diff line number Diff line change 19
19
go test -v -race -cover ./service/static
20
20
go test -v -race -cover ./service/limit
21
21
go test -v -race -cover ./service/headers
22
+ go test -v -race -cover ./service/metrics
Original file line number Diff line number Diff line change
1
+ package metrics
2
+
3
+ import (
4
+ "encoding/json"
5
+ "github.com/spiral/roadrunner/service"
6
+ "github.com/stretchr/testify/assert"
7
+ "testing"
8
+ )
9
+
10
+ type mockCfg struct { cfg string }
11
+
12
+ func (cfg * mockCfg ) Get (name string ) service.Config { return nil }
13
+ func (cfg * mockCfg ) Unmarshal (out interface {}) error { return json .Unmarshal ([]byte (cfg .cfg ), out ) }
14
+
15
+ func Test_Config_Hydrate_Error1 (t * testing.T ) {
16
+ cfg := & mockCfg {`{"request": {"From": "Something"}}` }
17
+ c := & Config {}
18
+
19
+ assert .NoError (t , c .Hydrate (cfg ))
20
+ }
21
+
22
+ func Test_Config_Hydrate_Error2 (t * testing.T ) {
23
+ cfg := & mockCfg {`{"dir": "/dir/"` }
24
+ c := & Config {}
25
+
26
+ assert .Error (t , c .Hydrate (cfg ))
27
+ }
You can’t perform that action at this time.
0 commit comments