mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-23 10:45:45 +01:00
modify code as travis ci required
This commit is contained in:
parent
7c74b16eef
commit
888604fb0d
@ -22,6 +22,7 @@ import (
|
|||||||
"github.com/vmware/harbor/utils/log"
|
"github.com/vmware/harbor/utils/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//LogAPi handles request api/logs
|
||||||
type LogAPI struct {
|
type LogAPI struct {
|
||||||
BaseAPI
|
BaseAPI
|
||||||
userID int
|
userID int
|
||||||
|
@ -119,11 +119,11 @@ func AccessLog(username, projectName, repoName, repoTag, action string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//GetRecentLogs returns recent logs according to parameters
|
//GetRecentLogs returns recent logs according to parameters
|
||||||
func GetRecentLogs(lines int, start_time, end_time string) ([]models.AccessLog, error) {
|
func GetRecentLogs(lines int, startTime, endTime string) ([]models.AccessLog, error) {
|
||||||
var recentLogList []models.AccessLog
|
var recentLogList []models.AccessLog
|
||||||
queryParam := make([]interface{}, 1)
|
queryParam := make([]interface{}, 1)
|
||||||
queryParam = append(queryParam, start_time)
|
queryParam = append(queryParam, startTime)
|
||||||
queryParam = append(queryParam, end_time)
|
queryParam = append(queryParam, endTime)
|
||||||
qb, _ := orm.NewQueryBuilder("mysql")
|
qb, _ := orm.NewQueryBuilder("mysql")
|
||||||
qb.Select("log_id",
|
qb.Select("log_id",
|
||||||
"user_id", "project_id", "repo_name", "repo_tag", "GUID", "operation", "op_time").
|
"user_id", "project_id", "repo_name", "repo_tag", "GUID", "operation", "op_time").
|
||||||
|
@ -736,7 +736,7 @@ func TestChangeUserProfile(t *testing.T) {
|
|||||||
t.Errorf("user email does not update, expected: %s, acutal: %s", "Unit Test", loginedUser.Email)
|
t.Errorf("user email does not update, expected: %s, acutal: %s", "Unit Test", loginedUser.Email)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func GetRecentLogs(t *testing.T) {
|
func TestGetRecentLogs(t *testing.T) {
|
||||||
logs, err := GetRecentLogs(10, "2016-05-13 00:00:00", time.Now().String())
|
logs, err := GetRecentLogs(10, "2016-05-13 00:00:00", time.Now().String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("error occured in getting recent logs", err)
|
t.Errorf("error occured in getting recent logs", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user