}
/*add target*/
assert.Nil(t, HTTPCli.Post("/targets", target, &target))
- t.Logf("add target %v", target.Name)
+ Debugf(t, "add target %v", target.Name)
targetEvt := <-chTarget //waiting for event targetAdd
assert.Equal(t, target.ID, targetEvt.ID)
listID[i] = target.ID
}
/*add terminal on target*/
assert.Nil(t, HTTPCli.Post("/targets/"+listID[j]+"/terminals", term, &term))
- t.Logf("add terminal %v", term.Name)
+ Debugf(t, "add terminal %v", term.Name)
termEvt := <-chTermEvt //waiting for event terminalAdd*/
assert.Equal(t, term.ID, termEvt.ID)
listTermsID[i] = term.ID
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)
+ Debugf(t, "%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)
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)
+ Debugf(t, "check that term status %v is %v", term.Name, post)
}
}
}
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)
+ Debugf(t, "remove terminal %v", term.Name)
}
var tgtRes xsapiv1.TargetConfig
assert.Nil(t, HTTPCli.Delete("/targets/"+targets[i].ID, &tgtRes))
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))
+ Debugf(t, "send following command through terminal: %v", string(data))
assert.Nil(t, sCli.Conn.Emit(xsapiv1.TerminalInEvent, data))
flushChannelTerm(chTerm, 50) //waiting for terminal msg
/*send cmd though term*/
data = []byte("cat " + totoFileCurrent + "\n")
- t.Logf("send following command through terminal: %v", string(data))
+ Debugf(t, "send following command through terminal: %v", string(data))
assert.Nil(t, sCli.Conn.Emit(xsapiv1.TerminalInEvent, data))
<-chTerm //cmd sent
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))
+ Debugf(t, "check terminal output msg: %v", string(termOut.Stdout))
}
PostTerms(t, "close", chTermEvt)
target := xsapiv1.TargetConfig{}
var targetRes xsapiv1.TargetConfig
assert.NotNil(t, HTTPCli.Post("/targets", target, &targetRes))
- t.Logf("error while creating empty target")
+ Debugf(t, "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")
+ Debugf(t, "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)
+ Debugf(t, "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")
+ Debugf(t, "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")
+ Debugf(t, "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")
+ Debugf(t, "create several terminals")
/*remove targets and terms*/
var targetArray []xsapiv1.TargetConfig
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)
+ Debugf(t, "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)
+ Debugf(t, "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)
+ Debugf(t, "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)
+ Debugf(t, "error while deleting an already deleted target %v", tgtRes.Name)
}
}