forked from edgexfoundry/device-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit_test.go
33 lines (28 loc) · 847 Bytes
/
init_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// -*- Mode: Go; indent-tabs-mode: t -*-
//
// Copyright (C) 2018 IOTech Ltd
//
// SPDX-License-Identifier: Apache-2.0
package clients
import (
"net"
"testing"
"github.com/edgexfoundry/device-sdk-go/internal/common"
bootstrapConfig "github.com/edgexfoundry/go-mod-bootstrap/config"
"github.com/edgexfoundry/go-mod-core-contracts/clients/logger"
)
func TestCheckServiceAvailableByPingWithTimeoutError(test *testing.T) {
var clientConfig = map[string]bootstrapConfig.ClientInfo{
common.ClientData: {
Host: "www.google.com",
Port: 81,
Protocol: "http",
},
}
config := &common.ConfigurationStruct{Clients: clientConfig}
lc := logger.NewMockClient()
err := checkServiceAvailableByPing(common.ClientData, config, lc)
if err, ok := err.(net.Error); ok && !err.Timeout() {
test.Fatal("Should be timeout error")
}
}