aboutsummaryrefslogtreecommitdiffstats
path: root/test/folders_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/folders_test.go')
-rw-r--r--test/folders_test.go38
1 files changed, 19 insertions, 19 deletions
diff --git a/test/folders_test.go b/test/folders_test.go
index 065e3e3..10f1dc6 100644
--- a/test/folders_test.go
+++ b/test/folders_test.go
@@ -28,7 +28,7 @@ import (
func TestFolders(t *testing.T) {
/*init: check there is no folder*/
- t.Log("check there is no folder")
+ Debug(t, "check there is no folder")
var cfgArray []xsapiv1.FolderConfig
assert.Nil(t, HTTPCli.Get("/folders", &cfgArray))
assert.Equal(t, len(cfgArray), 0)
@@ -43,10 +43,10 @@ func TestFolders(t *testing.T) {
},
}
var cfg xsapiv1.FolderConfig
- t.Logf("create folder: \n%v", fPrj)
+ Debugf(t, "create folder: \n%v", fPrj)
assert.Nil(t, HTTPCli.Post("/folders", fPrj, &cfg))
assert.NotNil(t, cfg)
- t.Logf("result folder: \n%v", cfg)
+ Debugf(t, "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]+$")
@@ -74,23 +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)
+ Debugf(t, "create folder with id=%v", cfg.ID)
assert.Nil(t, HTTPCli.Post("/folders", fPrj, &cfg))
- t.Logf("create folder with id=%v", cfg.ID)
+ Debugf(t, "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)
+ Debugf(t, "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)
+ Debugf(t, "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)
+ Debugf(t, "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)
@@ -109,19 +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)
+ Debugf(t, "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)
+ Debugf(t, "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)
+ Debugf(t, "error while creating folder with empty type \n%v", fPrj)
var cfgArray []xsapiv1.FolderConfig
assert.Nil(t, HTTPCli.Get("/folders", &cfgArray))
@@ -142,7 +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)
+ Debugf(t, "error while creating folder with no checkfile \n%v", fPrj)
var checkFileClient = fPrj.ClientPath + "/checkfile"
var checkFileServer = fPrj.DataPathMap.ServerPath + "/checkfile"
@@ -153,30 +153,30 @@ func TestFoldersPathMapConfig(t *testing.T) {
fPrj.DataPathMap.CheckContent = "CheckContent From Client\n"
file, err := os.OpenFile(checkFileClient, os.O_CREATE|os.O_RDWR, 0644)
if err != nil {
- t.Log(err)
+ Debug(t, err)
}
if err := os.Symlink(checkFileClient, checkFileServer); err != nil {
- t.Log(err)
+ Debug(t, err)
}
/*file content differ*/
assert.NotNil(t, HTTPCli.Post("/folders", fPrj, &cfg))
- t.Logf("error while creating folder with different checkfiles \n%v", fPrj)
+ Debugf(t, "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)
+ Debug(t, err)
}
assert.Nil(t, HTTPCli.Post("/folders", fPrj, &cfg))
- t.Logf("create folder with same checkfiles \n%v", fPrj)
+ Debugf(t, "create folder with same checkfiles \n%v", fPrj)
/*check server msg: ServerUID needed*/
- t.Logf("check server msg")
+ Debugf(t, "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"
data, err := ioutil.ReadAll(file)
if err != nil {
- t.Log(err)
+ Debug(t, err)
}
assert.Equal(t, msg, string(data))