Skip to content

Commit 72e46f0

Browse files
committed
localize struct type
1 parent 910da49 commit 72e46f0

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

systemtest/main_test.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,6 @@ func TestMain(m *testing.M) {
4848
os.Exit(m.Run())
4949
}
5050

51-
var stats struct {
52-
GeoIPStats `json:"stats"`
53-
}
54-
55-
type GeoIPStats struct {
56-
DatabasesCount int `json:"databases_count"`
57-
}
58-
5951
const requestBody = `{"metadata": { "service": {"name": "alice", "agent": {"version": "3.14.0", "name": "elastic-node"}}}}
6052
{"metricset": {"samples":{"a":{"value":3.2}}, "timestamp": 1496170422281000}}`
6153

@@ -113,10 +105,15 @@ func waitGeoIPDownload() error {
113105
if err != nil {
114106
return err
115107
}
108+
var stats = struct {
109+
Stats struct {
110+
DatabasesCount int `json:"databases_count"`
111+
} `json:"stats"`
112+
}{}
116113
if err := json.Unmarshal(body, &stats); err != nil {
117114
return err
118115
}
119-
if stats.DatabasesCount == 3 {
116+
if stats.Stats.DatabasesCount == 3 {
120117
log.Println("GeoIP database downloaded")
121118
return nil
122119
}

0 commit comments

Comments
 (0)