aboutsummaryrefslogtreecommitdiffstats
path: root/test/main_test.go
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2018-10-19 22:16:11 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2018-10-22 12:16:57 +0000
commit777f88336442c887552fb3353db93a5ed5b4ff74 (patch)
tree8985830bf3d7fb635c99f86519f7d8391b37c054 /test/main_test.go
parent5fa00200173151a25a45777e17c0926b7082e953 (diff)
Fix tests
Change-Id: I9b8dbe26bfe6d1d32cbce09a89b7d0f47d7ef4b5 Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'test/main_test.go')
-rw-r--r--test/main_test.go17
1 files changed, 10 insertions, 7 deletions
diff --git a/test/main_test.go b/test/main_test.go
index 4889991..ced75a6 100644
--- a/test/main_test.go
+++ b/test/main_test.go
@@ -47,18 +47,21 @@ var HTTPCli *common.HTTPClient
var logDir string
var sCli *IOSockClient
+// Debug function used to print debug logs
func Debug(t *testing.T, args ...interface{}) {
if os.Getenv("VERBOSE") != "" {
- t.Log(args)
+ t.Log(args...)
}
}
+// Debugf function used to print debug logs
func Debugf(t *testing.T, format string, args ...interface{}) {
if os.Getenv("VERBOSE") != "" {
- t.Logf(format, args)
+ t.Logf(format, args...)
}
}
+// Copy copies from src to dst until either EOF
func Copy(src, dst string) error {
in, err := os.Open(src)
if err != nil {
@@ -144,17 +147,17 @@ func getHTTPClient(lvl int) (*common.HTTPClient, *os.File) {
LogPrefix: "XDSSERVERTEST: ",
LogLevel: lvl,
}
- cli, err := common.HTTPNewClient(prefixURL, conf)
+ HTTPcli, err := common.HTTPNewClient(prefixURL, conf)
if err != nil {
log.Fatal(err)
}
- log.Printf("HTTP session ID : %v", cli.GetClientID())
+ log.Printf("HTTP session ID : %v", HTTPcli.GetClientID())
var ver xsapiv1.Version
- err = cli.Get("/version", &ver)
+ err = HTTPcli.Get("/version", &ver)
if err != nil {
log.Fatal(err)
}
- return cli, file
+ return HTTPcli, file
}
func NewIoSocketClient(url, clientID string) (*IOSockClient, error) {
@@ -191,7 +194,7 @@ func NewIoSocketClient(url, clientID string) (*IOSockClient, error) {
}
func TestMain(m *testing.M) {
/* useful for debugging, preventing from launching xds-server
- * it can be launch separetly */
+ * it can be launch separately */
launchProcess := true
log.Printf("TestMain: launchProcess is %v, so launching xds-server", launchProcess)
initEnv(launchProcess)