From 72bb1c521aff5bb166db287ef426b243166d8927 Mon Sep 17 00:00:00 2001 From: Clément Bénier Date: Mon, 20 Aug 2018 17:39:39 +0200 Subject: tests: add comments and logs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I31ef0fa20a74f76b696ac9cb768fac18e2197ea5 Signed-off-by: Clément Bénier --- test/config_test.go | 1 + test/exec_test.go | 24 ++++++++++++++++++++---- test/folders_test.go | 16 ++++++++++++++++ test/sdks_test.go | 28 ++++++++++++++++++++++------ test/target_test.go | 27 +++++++++++++++++++++++++-- test/xdsserver_test.go | 12 +++++++----- 6 files changed, 91 insertions(+), 17 deletions(-) (limited to 'test') diff --git a/test/config_test.go b/test/config_test.go index ad6ea1b..da56188 100644 --- a/test/config_test.go +++ b/test/config_test.go @@ -42,6 +42,7 @@ func CheckIP(ipconfig string) bool { func TestConfig(t *testing.T) { var cfg xsapiv1.APIConfig assert.Nil(t, HTTPCli.Get("/config", &cfg)) + t.Logf("Config is %v", cfg) re := regexp.MustCompile("^[0-9a-z]+-[0-9a-z]+-[0-9a-z]+-[0-9a-z]+-[0-9a-z]+$") assert.True(t, re.MatchString(cfg.ServerUID)) //ID diff --git a/test/exec_test.go b/test/exec_test.go index ff67322..8759dbd 100644 --- a/test/exec_test.go +++ b/test/exec_test.go @@ -29,11 +29,15 @@ import ( ) func InitExec(t *testing.T) string { + t.Logf("Create helloworld directory with app-templates") + /*copy helloworld from fixtures to envRootCfgDir*/ helloworldDir := path.Join(os.Getenv(envRootCfgDir), "helloworld") cmd := exec.Command("cp", "-r", helloworldFixturesDir, helloworldDir) var out bytes.Buffer cmd.Stdout = &out assert.Nil(t, cmd.Run()) + + /*clone submodules app templates into helloworld*/ subHelloworldAppTemplateDir := path.Join(helloworldDir, "conf.d", "app-templates") cmd = exec.Command("git", "clone", "https://gerrit.automotivelinux.org/gerrit/p/apps/app-templates.git", subHelloworldAppTemplateDir) assert.Nil(t, cmd.Run()) @@ -53,6 +57,7 @@ func flushChannelExec(channel chan xsapiv1.ExecOutMsg, ms time.Duration) { } func TestExec(t *testing.T) { helloworldDir := InitExec(t) + /*channel for SDK events*/ chSdks := make(chan xsapiv1.SDK) defer close(chSdks) sdk := xsapiv1.SDKInstallArgs{ @@ -63,6 +68,7 @@ func TestExec(t *testing.T) { ConnectSDKStateChange(t, sCli, chSdks) sdkRes := installFakeSdk(t, sdk, chSdks) + /*check there is no project*/ var cfgArray []xsapiv1.FolderConfig assert.Nil(t, HTTPCli.Get("/folders", &cfgArray)) assert.Equal(t, len(cfgArray), 0) @@ -76,16 +82,20 @@ func TestExec(t *testing.T) { ServerPath: helloworldDir, }, } + /*create project*/ var cfg xsapiv1.FolderConfig assert.Nil(t, HTTPCli.Post("/folders", fPrj, &cfg)) assert.NotNil(t, cfg) + /*channel for ExecOutMsg*/ chExec := make(chan xsapiv1.ExecOutMsg) defer close(chExec) + /*connect to ExecOutEvent*/ sCli.Conn.On(xsapiv1.ExecOutEvent, func(ev xsapiv1.ExecOutMsg) { chExec <- ev }) + /*cmake helloworld project with fake sdk*/ sdkSourceFile := path.Join(sdkRes.Path, "environment-setup-corei7-64-native-linux") cmd := "source " + sdkSourceFile cmd = cmd + " && " @@ -99,14 +109,17 @@ func TestExec(t *testing.T) { cmd = cmd + " && " cmd = cmd + "cmake .." + /*post exec cmd cmake*/ exec := xsapiv1.ExecArgs{ ID: cfg.ID, Cmd: cmd, } var execRes xsapiv1.ExecArgs + t.Logf("exec cmake cmd(%v)", cmd) assert.Nil(t, HTTPCli.Post("/exec", exec, &execRes)) - flushChannelExec(chExec, 1000) + flushChannelExec(chExec, 1000) //waiting for execOutMsg + /*make helloworld project with fake sdk*/ cmd = "source " + sdkSourceFile cmd = cmd + " && " cmd = cmd + "unset SDKTARGETSYSROOT" @@ -117,15 +130,18 @@ func TestExec(t *testing.T) { cmd = cmd + "&&" cmd = cmd + "make" exec.Cmd = cmd + /*post exec cmd make*/ + t.Logf("exec make cmd(%v)", cmd) assert.Nil(t, HTTPCli.Post("/exec", exec, &execRes)) - flushChannelExec(chExec, 1000) + flushChannelExec(chExec, 1000) //waiting for execOutMsg - /*check afb-helloworld.so exists*/ + /*check if helloworld.so exists*/ + t.Log("check that helloworld.so exists") _, err := os.Stat(path.Join(fPrj.ClientPath, "build/helloworld/helloworld.so")) assert.Nil(t, err) + /*deinit*/ assert.Nil(t, HTTPCli.Delete("/folders/"+cfg.ID, &cfg)) - RemoveSdk(t, sdkRes, chSdks) DisconnectSDKStateChange(t, sCli) } diff --git a/test/folders_test.go b/test/folders_test.go index 42db7c2..065e3e3 100644 --- a/test/folders_test.go +++ b/test/folders_test.go @@ -27,6 +27,8 @@ import ( ) func TestFolders(t *testing.T) { + /*init: check there is no folder*/ + t.Log("check there is no folder") var cfgArray []xsapiv1.FolderConfig assert.Nil(t, HTTPCli.Get("/folders", &cfgArray)) assert.Equal(t, len(cfgArray), 0) @@ -41,8 +43,10 @@ func TestFolders(t *testing.T) { }, } var cfg xsapiv1.FolderConfig + t.Logf("create folder: \n%v", fPrj) assert.Nil(t, HTTPCli.Post("/folders", fPrj, &cfg)) assert.NotNil(t, cfg) + t.Logf("result folder: \n%v", cfg) isCfgPrjMatch := func(fPrj xsapiv1.FolderConfig, cfg xsapiv1.FolderConfig) { re := regexp.MustCompile("^[0-9a-z]+-[0-9a-z]+-[0-9a-z]+-[0-9a-z]+-[0-9a-z]+$") @@ -70,18 +74,23 @@ func TestFolders(t *testing.T) { /*create/delete folders*/ var cfgArrayBis []xsapiv1.FolderConfig assert.Nil(t, HTTPCli.Post("/folders", fPrj, &cfg)) + t.Logf("create folder with id=%v", cfg.ID) assert.Nil(t, HTTPCli.Post("/folders", fPrj, &cfg)) + t.Logf("create folder with id=%v", cfg.ID) assert.Nil(t, HTTPCli.Get("/folders", &cfgArray)) assert.Equal(t, len(cfgArray), 3) assert.Nil(t, HTTPCli.Delete("/folders/"+cfgArray[1].ID, &cfg)) + t.Logf("delete folder with id=%v", cfg.ID) assert.Equal(t, cfg, cfgArray[1]) assert.Nil(t, HTTPCli.Get("/folders", &cfgArrayBis)) assert.Equal(t, len(cfgArrayBis), 2) assert.Nil(t, HTTPCli.Delete("/folders/"+cfgArray[0].ID, &cfg)) + t.Logf("delete folder with id=%v", cfg.ID) assert.Equal(t, cfg, cfgArray[0]) assert.Nil(t, HTTPCli.Get("/folders", &cfgArrayBis)) assert.Equal(t, len(cfgArrayBis), 1) assert.Nil(t, HTTPCli.Delete("/folders/"+cfgArray[2].ID, &cfg)) + t.Logf("delete folder with id=%v", cfg.ID) assert.Equal(t, cfg, cfgArray[2]) assert.Nil(t, HTTPCli.Get("/folders", &cfgArrayBis)) assert.Equal(t, len(cfgArrayBis), 0) @@ -100,16 +109,19 @@ func TestFoldersEmptyValues(t *testing.T) { var cfg xsapiv1.FolderConfig /*ServerPath is empty*/ assert.NotNil(t, HTTPCli.Post("/folders", fPrj, &cfg)) + t.Logf("error while creating folder with empty serverpath \n%v", fPrj) fPrj.DataPathMap.ServerPath = logDir + "sameserverpath" fPrj.ClientPath = "" /*ClientPath is Empty*/ assert.NotNil(t, HTTPCli.Post("/folders", fPrj, &cfg)) + t.Logf("error while creating folder with empty clientpath \n%v", fPrj) fPrj.ClientPath = "logDir" fPrj.Type = "" /*Type is empty*/ assert.NotNil(t, HTTPCli.Post("/folders", fPrj, &cfg)) + t.Logf("error while creating folder with empty type \n%v", fPrj) var cfgArray []xsapiv1.FolderConfig assert.Nil(t, HTTPCli.Get("/folders", &cfgArray)) @@ -130,6 +142,7 @@ func TestFoldersPathMapConfig(t *testing.T) { var cfg xsapiv1.FolderConfig /*file not present*/ assert.NotNil(t, HTTPCli.Post("/folders", fPrj, &cfg)) + t.Logf("error while creating folder with no checkfile \n%v", fPrj) var checkFileClient = fPrj.ClientPath + "/checkfile" var checkFileServer = fPrj.DataPathMap.ServerPath + "/checkfile" @@ -147,14 +160,17 @@ func TestFoldersPathMapConfig(t *testing.T) { } /*file content differ*/ assert.NotNil(t, HTTPCli.Post("/folders", fPrj, &cfg)) + t.Logf("error while creating folder with different checkfiles \n%v", fPrj) /*write same message*/ if _, err := file.WriteString(fPrj.DataPathMap.CheckContent); err != nil { t.Log(err) } assert.Nil(t, HTTPCli.Post("/folders", fPrj, &cfg)) + t.Logf("create folder with same checkfiles \n%v", fPrj) /*check server msg: ServerUID needed*/ + t.Logf("check server msg") var APIcfg xsapiv1.APIConfig assert.Nil(t, HTTPCli.Get("/config", &APIcfg)) msg := "Pathmap checked message written by xds-server ID: " + APIcfg.ServerUID + "\n" diff --git a/test/sdks_test.go b/test/sdks_test.go index c00966f..1e3298f 100644 --- a/test/sdks_test.go +++ b/test/sdks_test.go @@ -60,6 +60,7 @@ func DisconnectSDKStateChange(t *testing.T, sCli *IOSockClient) { } func InitSdkDir() { + /*create sdk dir*/ sdkDir := os.Getenv(envXdtSdk) os.MkdirAll(sdkDir, 0755) currentDir, err := os.Getwd() @@ -72,29 +73,31 @@ func InitSdkDir() { } func RemoveSdk(t *testing.T, sdk xsapiv1.SDK, chSdks chan xsapiv1.SDK) { + t.Logf("remove sdk %v", sdk.ID) assert.Nil(t, HTTPCli.Delete("/sdks/"+sdk.ID, &sdk)) - sdkFromEvt := <-chSdks //Uninstalling + sdkFromEvt := <-chSdks //waiting for event Uninstalling assert.Equal(t, sdk.ID, sdkFromEvt.ID) assert.Equal(t, sdkFromEvt.Status, "Un-installing") - sdkFromEvt = <-chSdks //not installed + sdkFromEvt = <-chSdks //waiting for event not installed assert.Equal(t, sdkFromEvt.Status, "Not Installed") os.RemoveAll(path.Join(os.Getenv(envXdtSdk), sdk.Profile)) os.Remove(strings.Replace(sdk.URL, "file://", "", 1)) } func TestSdks(t *testing.T) { - cpt = 0 InitSdkDir() + /*get sdk list from sdk_latest.json*/ var sdkArray []xsapiv1.SDK assert.Nil(t, HTTPCli.Get("/sdks", &sdkArray)) _, err := os.Stat(path.Join(os.Getenv(envXdtSdk), "sdks_latest.json")) - time.Sleep(1000 * time.Millisecond) assert.Nil(t, err) + /*create channel fro SDK event*/ chSdks := make(chan xsapiv1.SDK) defer close(chSdks) ConnectSDKStateChange(t, sCli, chSdks) + /*checking startup installing of SDKs*/ for i := 0; i < len(sdkArray); i++ { re := regexp.MustCompile("^[0-9a-z]+-[0-9a-z]+-[0-9a-z]+-[0-9a-z]+-[0-9a-z]+$") assert.True(t, re.MatchString(sdkArray[i].ID)) @@ -105,15 +108,19 @@ func TestSdks(t *testing.T) { assert.Equal(t, sdkArray[i], sdk) var sdkRes xsapiv1.SDK + /*install sdk*/ + t.Logf("install sdk %v", sdk.Name) assert.Nil(t, HTTPCli.Post("/sdks", sdk, &sdkRes)) assert.Equal(t, sdkRes.Status, "Installing") - sdkFromEvent := <-chSdks + sdkFromEvent := <-chSdks //waiting for installing event assert.Equal(t, sdkRes.ID, sdkFromEvent.ID) assert.Equal(t, sdkFromEvent.Status, "Installing") + /*abort sdk install*/ + t.Logf("abort install sdk %v", sdk.Name) assert.Nil(t, HTTPCli.Post("/sdks/abortinstall", sdk, &sdkRes)) assert.Equal(t, sdkRes.Status, "Not Installed") - sdkFromEvent = <-chSdks + sdkFromEvent = <-chSdks //waiting for not installed status*/ assert.Equal(t, sdkRes.ID, sdkFromEvent.ID) assert.Equal(t, sdkRes.Status, sdkFromEvent.Status) } @@ -123,6 +130,7 @@ func installFakeSdk(t *testing.T, sdkInstall xsapiv1.SDKInstallArgs, chSdks chan InitSdkDir() var sdkRes xsapiv1.SDK assert.Nil(t, HTTPCli.Post("/sdks", sdkInstall, &sdkRes)) + t.Logf("Install fake sdk %v (force=%v)", sdkRes.Name, sdkInstall.Force) assert.Equal(t, sdkRes.Status, "Installing") sdkFromEvent := <-chSdks assert.Equal(t, sdkRes.ID, sdkFromEvent.ID) @@ -132,6 +140,7 @@ func installFakeSdk(t *testing.T, sdkInstall xsapiv1.SDKInstallArgs, chSdks chan assert.Equal(t, sdkRes.ID, sdkFromEvent.ID) assert.Equal(t, "Installed", sdkFromEvent.Status) assert.Equal(t, sdkFromEvent.LastError, "") + t.Logf("Fake sdk %v installed", sdkFromEvent.Name) return sdkFromEvent } @@ -160,10 +169,17 @@ func TestSdksError(t *testing.T) { Filename: "", Force: false, } + t.Logf("error while installing sdk with no ID and no Filename") var sdkRes xsapiv1.SDK + /*error with no ID no filename*/ assert.NotNil(t, HTTPCli.Post("/sdks", sdk, &sdkRes)) sdk.ID = "42885c24-374e-3ef0-9723-0c8a05191aa" + t.Logf("error while installing sdk with a fake id=%v", sdk.ID) + /*error with fake ID*/ assert.NotNil(t, HTTPCli.Post("/sdks", sdk, &sdkRes)) + sdk.ID = "" sdk.Filename = "fake" + t.Logf("error while installing sdk with a fake filename=%v", sdk.Filename) + /*error with fake filename*/ assert.NotNil(t, HTTPCli.Post("/sdks", sdk, &sdkRes)) } diff --git a/test/target_test.go b/test/target_test.go index e222505..0fcd94d 100644 --- a/test/target_test.go +++ b/test/target_test.go @@ -111,6 +111,7 @@ func AddTargets(t *testing.T, nbTargets int, chTarget chan xsapiv1.TargetConfig) } /*add target*/ assert.Nil(t, HTTPCli.Post("/targets", target, &target)) + t.Logf("add target %v", target.Name) targetEvt := <-chTarget //waiting for event targetAdd assert.Equal(t, target.ID, targetEvt.ID) listID[i] = target.ID @@ -133,6 +134,7 @@ func AddTerms(t *testing.T, nbTerms int, listID []string, chTermEvt chan xsapiv1 } /*add terminal on target*/ assert.Nil(t, HTTPCli.Post("/targets/"+listID[j]+"/terminals", term, &term)) + t.Logf("add terminal %v", term.Name) termEvt := <-chTermEvt //waiting for event terminalAdd*/ assert.Equal(t, term.ID, termEvt.ID) listTermsID[i] = term.ID @@ -162,7 +164,9 @@ func PostTerms(t *testing.T, post string, chTermEvt chan xsapiv1.TerminalConfig) listTermsID := make([]string, len(terms)) for j := 0; j < len(terms); j++ { var term xsapiv1.TerminalConfig + /*post action on term*/ assert.Nil(t, HTTPCli.Post("/targets/"+targets[i].ID+"/terminals/"+terms[j].ID+"/"+post, terms[j], &term)) + t.Logf("%v terminal %v", post, term.Name) termEvt := <-chTermEvt //waiting for event terminalStateChange assert.Equal(t, term.ID, termEvt.ID) assert.Equal(t, term.Status, status) @@ -174,6 +178,7 @@ func PostTerms(t *testing.T, post string, chTermEvt chan xsapiv1.TerminalConfig) var term xsapiv1.TerminalConfig assert.Nil(t, HTTPCli.Get("/targets/"+targets[i].ID+"/terminals/"+listTermsID[i], &term)) assert.True(t, strings.EqualFold(term.Status, post)) + t.Logf("check that term status %v is %v", term.Name, post) } } } @@ -190,10 +195,11 @@ func RemoveTermsTargets(t *testing.T, chTarget chan xsapiv1.TargetConfig, chTerm termEvt := <-chTermEvt assert.Equal(t, term.ID, termEvt.ID) assert.NotNil(t, HTTPCli.Delete("/targets/"+targets[i].ID+"/terminals/"+terms[j].ID, &term)) + t.Logf("remove terminal %v", term.Name) } var tgtRes xsapiv1.TargetConfig assert.Nil(t, HTTPCli.Delete("/targets/"+targets[i].ID, &tgtRes)) - targetEvt := <-chTarget + targetEvt := <-chTarget //waiting for remove terminal event assert.Equal(t, tgtRes.ID, targetEvt.ID) assert.Equal(t, targets[i].ID, tgtRes.ID) } @@ -228,7 +234,7 @@ func TestTarget(t *testing.T) { chTerm <- ev }) - /*open first term*/ + /*open terminals*/ PostTerms(t, "open", chTermEvt) /*just for the first term*/ @@ -241,6 +247,7 @@ func TestTarget(t *testing.T) { t.Fatalf("%vcopy your pub key in authorized_keys\ncat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys", stdoutMsg) } assert.True(t, strings.Contains(stdoutMsg, "Last login")) //first terminal msg should be Last Login + t.Logf("terminal is open, console msg is %v", stdoutMsg) /*create toto file through terminals*/ rootCfgDir := os.Getenv(envRootCfgDir) @@ -251,6 +258,7 @@ func TestTarget(t *testing.T) { totoFileCurrent := totoFile + strconv.Itoa(i) /*send cmd though term*/ data := []byte("echo helloWorld" + strconv.Itoa(i) + " >> " + totoFileCurrent + "\n") + t.Logf("send following command through terminal: %v", string(data)) assert.Nil(t, sCli.Conn.Emit(xsapiv1.TerminalInEvent, data)) flushChannelTerm(chTerm, 50) //waiting for terminal msg @@ -260,6 +268,7 @@ func TestTarget(t *testing.T) { /*send cmd though term*/ data = []byte("cat " + totoFileCurrent + "\n") + t.Logf("send following command through terminal: %v", string(data)) assert.Nil(t, sCli.Conn.Emit(xsapiv1.TerminalInEvent, data)) <-chTerm //cmd sent @@ -267,6 +276,7 @@ func TestTarget(t *testing.T) { flushChannelTerm(chTerm, 50) //flushing what remains /*check that terminal msg is what was written before*/ assert.Equal(t, string(termOut.Stdout), "helloWorld"+strconv.Itoa(i)+"\r\n") + t.Logf("check terminal output msg: %v", string(termOut.Stdout)) } PostTerms(t, "close", chTermEvt) @@ -278,23 +288,32 @@ func TestTarget(t *testing.T) { } func TestTargetErrors(t *testing.T) { + /*cannot create empty target*/ target := xsapiv1.TargetConfig{} var targetRes xsapiv1.TargetConfig assert.NotNil(t, HTTPCli.Post("/targets", target, &targetRes)) + t.Logf("error while creating empty target") + /*check cannot create target with no IP*/ target.Type = xsapiv1.TypeTgtStandard assert.NotNil(t, HTTPCli.Post("/targets", target, &targetRes)) + t.Logf("error while creating target without IP") target.IP = "127.0.0.1" assert.Nil(t, HTTPCli.Post("/targets", target, &targetRes)) + t.Logf("create target %v", targetRes.Name) + /*cannot create empty terminal*/ term := xsapiv1.TerminalConfig{} var termRes xsapiv1.TerminalConfig assert.NotNil(t, HTTPCli.Post("/targets/"+targetRes.ID+"/terminals", term, &termRes)) + t.Logf("error while creating empty terminal") term.Type = xsapiv1.TypeTermSSH assert.NotNil(t, HTTPCli.Post("/targets/"+"1010"+"/terminals", term, &termRes)) + t.Logf("error while creating terminal on an non existing target") assert.Nil(t, HTTPCli.Post("/targets/"+targetRes.ID+"/terminals", term, &termRes)) assert.Nil(t, HTTPCli.Post("/targets/"+targetRes.ID+"/terminals", term, &termRes)) assert.Nil(t, HTTPCli.Post("/targets/"+targetRes.ID+"/terminals", term, &termRes)) assert.Nil(t, HTTPCli.Post("/targets/"+targetRes.ID+"/terminals", term, &termRes)) + t.Logf("create several terminals") /*remove targets and terms*/ var targetArray []xsapiv1.TargetConfig @@ -304,11 +323,15 @@ func TestTargetErrors(t *testing.T) { assert.Nil(t, HTTPCli.Get("/targets/"+targetArray[i].ID+"/terminals", &termArray)) for j := 0; j < len(termArray); j++ { assert.Nil(t, HTTPCli.Delete("/targets/"+targetArray[i].ID+"/terminals/"+termArray[j].ID, &termRes)) + t.Logf("delete terminal %v", termRes.Name) assert.NotNil(t, HTTPCli.Delete("/targets/"+targetArray[i].ID+"/terminals/"+termArray[j].ID, &termRes)) + t.Logf("error while deleting an already deleted terminal %v", termRes.Name) } var tgtRes xsapiv1.TargetConfig assert.Nil(t, HTTPCli.Delete("/targets/"+targetArray[i].ID, &tgtRes)) + t.Logf("delete target %v", tgtRes.Name) assert.Equal(t, targetArray[i].ID, tgtRes.ID) assert.NotNil(t, HTTPCli.Delete("/targets/"+targetArray[i].ID, &tgtRes)) + t.Logf("error while deleting an already deleted target %v", tgtRes.Name) } } diff --git a/test/xdsserver_test.go b/test/xdsserver_test.go index ba56321..b8e98b5 100644 --- a/test/xdsserver_test.go +++ b/test/xdsserver_test.go @@ -69,12 +69,14 @@ func Copy(src, dst string) error { func initEnv(launchProcess bool) { if launchProcess { + /*kill xds-server if needed*/ cmd := exec.Command("killall", "-9", "xds-server") if err := cmd.Start(); err != nil { log.Fatal(err) } cmd.Wait() } + /*set environment variable*/ rootTestLog := "/tmp/xds-server-test" if err := os.Setenv(envRootCfgDir, rootTestLog); err != nil { log.Fatal(err) @@ -92,12 +94,14 @@ func initEnv(launchProcess bool) { if err := os.Setenv("XDS_LOG_SILLY", "1"); err != nil { log.Fatal(err) } + /*remove and recreate working directories*/ os.RemoveAll(rootTestLog) os.MkdirAll(rootTestLog, 0755) logDir = rootTestLog + "/logs/" os.MkdirAll(logDir, 0755) } +/*prepare xds-server process*/ func launchXdsServer(proc **os.Process) *os.File { logFile := logDir + logFileXdsServer file, err := os.OpenFile(logFile, os.O_CREATE|os.O_WRONLY, 0644) @@ -142,7 +146,6 @@ func getHTTPClient(lvl int) (*common.HTTPClient, *os.File) { } func NewIoSocketClient(url, clientID string) (*IOSockClient, error) { - var err error sCli := &IOSockClient{ @@ -152,7 +155,6 @@ func NewIoSocketClient(url, clientID string) (*IOSockClient, error) { Transport: "websocket", Header: make(map[string][]string), }, - //ServerDiscoChan: make(chan Disconnection, 1), } sCli.Options.Header["XDS-SID"] = []string{clientID} @@ -174,6 +176,8 @@ func NewIoSocketClient(url, clientID string) (*IOSockClient, error) { return sCli, nil } func TestMain(m *testing.M) { + /* useful for debugging, preventing from launching xds-server + * it can be launch separetly */ launchProcess := true log.Printf("TestMain: launchProcess is %v, so launching xds-server", launchProcess) initEnv(launchProcess) @@ -183,6 +187,7 @@ func TestMain(m *testing.M) { if launchProcess { fileXdsServer = launchXdsServer(&proc) go func(p *os.Process) { + log.Print("xds-server is launching") if status, err := p.Wait(); err != nil { log.Fatalf("status=%v\n err=%v\n", status, err) } @@ -208,6 +213,3 @@ func TestMain(m *testing.M) { res := m.Run() defer os.Exit(res) } - -func init() { -} -- cgit 1.2.3-korg