mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-27 12:46:03 +01:00
modify log_test.go
This commit is contained in:
parent
3bb594aad6
commit
9d3d7e6502
@ -21,7 +21,7 @@ func TestLogGet(t *testing.T) {
|
|||||||
project.ProjectName = "my_project"
|
project.ProjectName = "my_project"
|
||||||
project.Public = 1
|
project.Public = 1
|
||||||
now := fmt.Sprintf("%v", time.Now().Unix())
|
now := fmt.Sprintf("%v", time.Now().Unix())
|
||||||
statusCode, result, err := apiTest.LogGet(*admin, "0", now, "")
|
statusCode, result, err := apiTest.LogGet(*admin, "0", now, "1000")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error("Error while get log information", err.Error())
|
t.Error("Error while get log information", err.Error())
|
||||||
t.Log(err)
|
t.Log(err)
|
||||||
@ -41,6 +41,7 @@ func TestLogGet(t *testing.T) {
|
|||||||
assert.Equal(int(201), reply, "Case 2: Project creation status should be 201")
|
assert.Equal(int(201), reply, "Case 2: Project creation status should be 201")
|
||||||
}
|
}
|
||||||
//case 1: right parameters, expect the right output
|
//case 1: right parameters, expect the right output
|
||||||
|
now = fmt.Sprintf("%v", time.Now().Unix())
|
||||||
statusCode, result, err = apiTest.LogGet(*admin, "0", now, "1000")
|
statusCode, result, err = apiTest.LogGet(*admin, "0", now, "1000")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error("Error while get log information", err.Error())
|
t.Error("Error while get log information", err.Error())
|
||||||
@ -58,7 +59,6 @@ func TestLogGet(t *testing.T) {
|
|||||||
}
|
}
|
||||||
fmt.Println("log ", result)
|
fmt.Println("log ", result)
|
||||||
//case 2: wrong format of start_time parameter, expect the wrong output
|
//case 2: wrong format of start_time parameter, expect the wrong output
|
||||||
now = fmt.Sprintf("%v", time.Now().Unix())
|
|
||||||
statusCode, result, err = apiTest.LogGet(*admin, "ss", now, "3")
|
statusCode, result, err = apiTest.LogGet(*admin, "ss", now, "3")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error("Error occured while get log information since the format of start_time parameter is not right.", err.Error())
|
t.Error("Error occured while get log information since the format of start_time parameter is not right.", err.Error())
|
||||||
@ -77,7 +77,6 @@ func TestLogGet(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//case 4: wrong format of lines parameter, expect the wrong output
|
//case 4: wrong format of lines parameter, expect the wrong output
|
||||||
now = fmt.Sprintf("%v", time.Now().Unix())
|
|
||||||
statusCode, result, err = apiTest.LogGet(*admin, "0", now, "s")
|
statusCode, result, err = apiTest.LogGet(*admin, "0", now, "s")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error("Error occured while get log information since the format of lines parameter is not right.", err.Error())
|
t.Error("Error occured while get log information since the format of lines parameter is not right.", err.Error())
|
||||||
@ -87,7 +86,6 @@ func TestLogGet(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//case 5: wrong format of lines parameter, expect the wrong output
|
//case 5: wrong format of lines parameter, expect the wrong output
|
||||||
now = fmt.Sprintf("%v", time.Now().Unix())
|
|
||||||
statusCode, result, err = apiTest.LogGet(*admin, "0", now, "-5")
|
statusCode, result, err = apiTest.LogGet(*admin, "0", now, "-5")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error("Error occured while get log information since the format of lines parameter is not right.", err.Error())
|
t.Error("Error occured while get log information since the format of lines parameter is not right.", err.Error())
|
||||||
@ -143,7 +141,6 @@ func TestLogGet(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("\n")
|
fmt.Printf("\n")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func getLog(result []apilib.AccessLog) (int, int) {
|
func getLog(result []apilib.AccessLog) (int, int) {
|
||||||
|
Loading…
Reference in New Issue
Block a user