summaryrefslogtreecommitdiffstats
path: root/test/main_test.go
diff options
context:
space:
mode:
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)