Skip to content

Commit

Permalink
Speedup tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Oct 4, 2021
1 parent 712e3cb commit f68d540
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion meter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ func TestMeters(t *testing.T) {
"i/o timeout",
"no ping response for 192.0.2.2", // SMA
"[1ESY1161052714 1ESY1161229249 1EMH0008842285 1ESY1161978584 1EMH0004864048 1ESY1161979033 7ELS8135823805]", // Discovergy
"can only have either uri or device", // modbus
"can only have either uri or device", // modbus
"(Client.Timeout exceeded while awaiting headers)", // http
}

for _, tmpl := range test.ConfigTemplates("meter") {
Expand Down
7 changes: 6 additions & 1 deletion provider/socket.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,13 @@ func (p *Socket) listen() {
headers.Set(k, v)
}

dialer := &websocket.Dialer{
Proxy: http.ProxyFromEnvironment,
HandshakeTimeout: request.Timeout,
}

for {
client, _, err := websocket.DefaultDialer.Dial(p.url, headers)
client, _, err := dialer.Dial(p.url, headers)
if err != nil {
p.log.ERROR.Println(err)
time.Sleep(retryDelay)
Expand Down

0 comments on commit f68d540

Please sign in to comment.