mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-29 13:45:20 +01:00
Fix misspell checking results (#5749)
Signed-off-by: wang yan <wangyan@vmware.com>
This commit is contained in:
parent
4e7c0d74ff
commit
fca2bb3a6b
@ -77,7 +77,7 @@ type TokenService struct {
|
||||
|
||||
// SystemCfg holds all configurations of system
|
||||
type SystemCfg struct {
|
||||
DomainName string `json:"domain_name"` // Harbor external URL: protocal://host:port
|
||||
DomainName string `json:"domain_name"` // Harbor external URL: protocol://host:port
|
||||
Authentication *Authentication `json:"authentication"`
|
||||
Database *Database `json:"database"`
|
||||
TokenService *TokenService `json:"token_service"`
|
||||
|
@ -115,7 +115,7 @@ func isTrue(value string) bool {
|
||||
// List projects the owner of which is user1: query := &QueryParam{Owner:"user1"}
|
||||
// List all public projects the owner of which is user1: query := &QueryParam{Owner:"user1",Public:true}
|
||||
// List projects which user1 is member of: query := &QueryParam{Member:&Member{Name:"user1"}}
|
||||
// List projects which user1 is the project admin : query := &QueryParam{Memeber:&Member{Name:"user1",Role:1}}
|
||||
// List projects which user1 is the project admin : query := &QueryParam{Member:&Member{Name:"user1",Role:1}}
|
||||
type ProjectQueryParam struct {
|
||||
Name string // the name of project
|
||||
Owner string // the username of project owner
|
||||
|
@ -56,7 +56,7 @@ type Configuration struct {
|
||||
|
||||
//Scheduler is designed for scheduling policies.
|
||||
type Scheduler struct {
|
||||
//Mutex for sync controling.
|
||||
//Mutex for sync controlling.
|
||||
*sync.RWMutex
|
||||
|
||||
//Related configuration options for scheduler.
|
||||
|
@ -121,7 +121,7 @@ func (c *Client) GetNotification(id string) (*models.ClairNotification, error) {
|
||||
if ne.Error != nil {
|
||||
return nil, fmt.Errorf("Clair error: %s", ne.Error.Message)
|
||||
}
|
||||
log.Debugf("Retrived notification %s from Clair.", id)
|
||||
log.Debugf("Retrieved notification %s from Clair.", id)
|
||||
return ne.Notification, nil
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ type SearchUserRes struct {
|
||||
Schemas []string `json:"schemas"`
|
||||
}
|
||||
|
||||
// DefaultClient leverages oauth2 pacakge for oauth features
|
||||
// DefaultClient leverages oauth2 package for oauth features
|
||||
type defaultClient struct {
|
||||
httpClient *http.Client
|
||||
oauth2Cfg *oauth2.Config
|
||||
|
2
src/jobservice/env/context.go
vendored
2
src/jobservice/env/context.go
vendored
@ -5,7 +5,7 @@ import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
//Context keep some sharable materials and system controling channels.
|
||||
//Context keep some sharable materials and system controlling channels.
|
||||
//The system context.Context interface is also included.
|
||||
type Context struct {
|
||||
//The system context with cancel capability.
|
||||
|
@ -72,7 +72,7 @@ func (gc *GarbageCollector) Run(ctx env.JobContext, params map[string]interface{
|
||||
}
|
||||
defer gc.readonly(false)
|
||||
if err := gc.registryCtlClient.Health(); err != nil {
|
||||
gc.logger.Errorf("failed to start gc as regsitry controller is unreachable: %v", err)
|
||||
gc.logger.Errorf("failed to start gc as registry controller is unreachable: %v", err)
|
||||
return err
|
||||
}
|
||||
gc.logger.Infof("start to run gc in job.")
|
||||
|
@ -255,7 +255,7 @@ func (rps *RedisPeriodicScheduler) Load() error {
|
||||
if pid, ok := keyScoreMap[score]; ok {
|
||||
policy.PolicyID = pid
|
||||
} else {
|
||||
//Something wrong, should not be happended
|
||||
//Something wrong, should not be happened
|
||||
//ignore here
|
||||
continue
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ func (ms *MessageServer) Start() error {
|
||||
switch m.Event {
|
||||
case period.EventSchedulePeriodicPolicy,
|
||||
period.EventUnSchedulePeriodicPolicy:
|
||||
//ignore error, actually error should not be happend because we did not change data
|
||||
//ignore error, actually error should not be happened because we did not change data
|
||||
//after the last unmarshal try.
|
||||
policyObject := &period.PeriodicJobPolicy{}
|
||||
dt, _ := json.Marshal(m.Data)
|
||||
|
@ -28,7 +28,7 @@ func MakeUniquePeriodicID(name, spec string, epoch int64) string {
|
||||
return fmt.Sprintf("periodic:job:%s:%s:%d", name, spec, epoch)
|
||||
}
|
||||
|
||||
//RedisNamespacePrefix ... Same with 'KeyNamespacePrefix', only for compatiblity.
|
||||
//RedisNamespacePrefix ... Same with 'KeyNamespacePrefix', only for compatibility.
|
||||
func RedisNamespacePrefix(namespace string) string {
|
||||
return KeyNamespacePrefix(namespace)
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ import (
|
||||
"github.com/goharbor/harbor/src/registryctl/api"
|
||||
)
|
||||
|
||||
// Client defines methods that an Regsitry client should implement
|
||||
// Client defines methods that an Registry client should implement
|
||||
type Client interface {
|
||||
// Health tests the connection with registry server
|
||||
Health() error
|
||||
|
@ -29,7 +29,7 @@ func TestMain(m *testing.M) {
|
||||
|
||||
server, err := test.NewRegistryCtl(nil)
|
||||
if err != nil {
|
||||
fmt.Printf("failed to create regsitry: %v", err)
|
||||
fmt.Printf("failed to create registry: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ func newAuthHandler(authenticator auth.AuthenticationHandler, handler http.Handl
|
||||
|
||||
func (a *authHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
if a.authenticator == nil {
|
||||
log.Errorf("No authenticator found in regsitry controller.")
|
||||
log.Errorf("No authenticator found in registry controller.")
|
||||
http.Error(w, http.StatusText(http.StatusInternalServerError),
|
||||
http.StatusInternalServerError)
|
||||
return
|
||||
|
@ -142,7 +142,7 @@ func (ctl *DefaultController) UpdatePolicy(updatedPolicy models.ReplicationPolic
|
||||
reset = true
|
||||
}
|
||||
case replication.TriggerKindImmediate:
|
||||
// Always reset immediate trigger as it is relevent with namespaces
|
||||
// Always reset immediate trigger as it is relevant with namespaces
|
||||
reset = true
|
||||
default:
|
||||
// manual trigger, no need to reset
|
||||
|
@ -1,6 +1,6 @@
|
||||
package trigger
|
||||
|
||||
//Interface is certian mechanism to know when fire the replication operation.
|
||||
//Interface is certain mechanism to know when fire the replication operation.
|
||||
type Interface interface {
|
||||
//Kind indicates what type of the trigger is.
|
||||
Kind() string
|
||||
|
@ -46,7 +46,7 @@ func (st *ScheduleTrigger) Setup() error {
|
||||
h, m, s := common_utils.ParseOfftime(st.params.Offtime)
|
||||
metadata.Cron = fmt.Sprintf("%d %d %d * * %d", s, m, h, st.params.Weekday%7)
|
||||
default:
|
||||
return fmt.Errorf("unsupported schedual trigger type: %s", st.params.Type)
|
||||
return fmt.Errorf("unsupported schedule trigger type: %s", st.params.Type)
|
||||
}
|
||||
|
||||
id, err := dao.AddRepJob(models.RepJob{
|
||||
|
@ -363,7 +363,7 @@ func (a testapi) ProjectsHead(prjUsr usrInfo, projectName string) (int, error) {
|
||||
return httpStatusCode, err
|
||||
}
|
||||
|
||||
//Return specific project detail infomation
|
||||
//Return specific project detail information
|
||||
func (a testapi) ProjectsGetByPID(projectID string) (int, apilib.Project, error) {
|
||||
_sling := sling.New().Get(a.basePath)
|
||||
|
||||
|
@ -85,7 +85,7 @@ func (gr *GCReq) ToJob() (*models.JobData, error) {
|
||||
metadata.Cron = fmt.Sprintf("%d %d %d * * %d", s, m, h, gr.Schedule.Weekday%7)
|
||||
case ScheduleManual, ScheduleNone:
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported schedual trigger type: %s", gr.Schedule.Type)
|
||||
return nil, fmt.Errorf("unsupported schedule trigger type: %s", gr.Schedule.Type)
|
||||
}
|
||||
|
||||
jobData := &models.JobData{
|
||||
|
@ -83,15 +83,15 @@ func TestAddProject(t *testing.T) {
|
||||
//t.Log(result)
|
||||
}
|
||||
|
||||
//case 4: reponse code = 400 : Project name is illegal in length
|
||||
fmt.Println("case 4 : reponse code = 400 : Project name is illegal in length ")
|
||||
//case 4: response code = 400 : Project name is illegal in length
|
||||
fmt.Println("case 4 : response code = 400 : Project name is illegal in length ")
|
||||
|
||||
result, err = apiTest.ProjectsPost(*admin, apilib.ProjectReq{"t", map[string]string{models.ProMetaPublic: "true"}})
|
||||
if err != nil {
|
||||
t.Error("Error while creat project", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(int(400), result, "case 4 : reponse code = 400 : Project name is illegal in length ")
|
||||
assert.Equal(int(400), result, "case 4 : response code = 400 : Project name is illegal in length ")
|
||||
}
|
||||
|
||||
fmt.Printf("\n")
|
||||
|
@ -18,7 +18,7 @@ func TestAdminJobPost(t *testing.T) {
|
||||
//case 1: add a new admin job
|
||||
code, err := apiTest.AddGC(*admin, adminJob001)
|
||||
if err != nil {
|
||||
t.Error("Error occured while add a admin job", err.Error())
|
||||
t.Error("Error occurred while add a admin job", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(200, code, "Add adminjob status should be 200")
|
||||
@ -31,7 +31,7 @@ func TestAdminJobGet(t *testing.T) {
|
||||
|
||||
code, _, err := apiTest.GCScheduleGet(*admin)
|
||||
if err != nil {
|
||||
t.Error("Error occured while get a admin job", err.Error())
|
||||
t.Error("Error occurred while get a admin job", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(200, code, "Get adminjob status should be 200")
|
||||
|
@ -44,7 +44,7 @@ func TestGetRepos(t *testing.T) {
|
||||
assert.Equal(int(1), len(repos), "the length of repositories should be 1")
|
||||
assert.Equal(repos[0].Name, "library/hello-world", "unexpected repository name")
|
||||
} else {
|
||||
t.Error("unexpected reponse")
|
||||
t.Error("unexpected response")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ func (sia *SystemInfoAPI) GetCert() {
|
||||
func (sia *SystemInfoAPI) GetGeneralInfo() {
|
||||
cfg, err := config.GetSystemCfg()
|
||||
if err != nil {
|
||||
log.Errorf("Error occured getting config: %v", err)
|
||||
log.Errorf("Error occurred getting config: %v", err)
|
||||
sia.CustomAbort(http.StatusInternalServerError, "Unexpected error")
|
||||
}
|
||||
var registryURL string
|
||||
@ -198,7 +198,7 @@ func (sia *SystemInfoAPI) GetGeneralInfo() {
|
||||
func (sia *SystemInfoAPI) getVersion() string {
|
||||
version, err := ioutil.ReadFile(harborVersionFile)
|
||||
if err != nil {
|
||||
log.Errorf("Error occured getting harbor version: %v", err)
|
||||
log.Errorf("Error occurred getting harbor version: %v", err)
|
||||
return ""
|
||||
}
|
||||
return string(version[:])
|
||||
|
@ -30,7 +30,7 @@ func TestGetVolumeInfo(t *testing.T) {
|
||||
CommonAddUser()
|
||||
code, _, err := apiTest.VolumeInfoGet(*testUser)
|
||||
if err != nil {
|
||||
t.Error("Error occured while get system volume info")
|
||||
t.Error("Error occurred while get system volume info")
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(403, code, "Get system volume info should be 403")
|
||||
@ -38,7 +38,7 @@ func TestGetVolumeInfo(t *testing.T) {
|
||||
//case 2: get volume info with admin role
|
||||
code, info, err := apiTest.VolumeInfoGet(*admin)
|
||||
if err != nil {
|
||||
t.Error("Error occured while get system volume info")
|
||||
t.Error("Error occurred while get system volume info")
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(200, code, "Get system volume info should be 200")
|
||||
@ -75,7 +75,7 @@ func TestGetCert(t *testing.T) {
|
||||
//case 1: get cert without admin role
|
||||
code, _, err := apiTest.CertGet(*testUser)
|
||||
if err != nil {
|
||||
t.Error("Error occured while get system cert")
|
||||
t.Error("Error occurred while get system cert")
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(403, code, "Get system cert should be 403")
|
||||
@ -83,7 +83,7 @@ func TestGetCert(t *testing.T) {
|
||||
//case 2: get cert with admin role
|
||||
code, content, err := apiTest.CertGet(*admin)
|
||||
if err != nil {
|
||||
t.Error("Error occured while get system cert")
|
||||
t.Error("Error occurred while get system cert")
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(200, code, "Get system cert should be 200")
|
||||
|
@ -44,7 +44,7 @@ func TestUsersPost(t *testing.T) {
|
||||
fmt.Println("Register user without admin auth")
|
||||
code, err := apiTest.UsersPost(testUser0002)
|
||||
if err != nil {
|
||||
t.Error("Error occured while add a test User", err.Error())
|
||||
t.Error("Error occurred while add a test User", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(400, code, "Add user status should be 400")
|
||||
@ -54,7 +54,7 @@ func TestUsersPost(t *testing.T) {
|
||||
fmt.Println("Register user with admin auth, but username is empty")
|
||||
code, err = apiTest.UsersPost(testUser0002, *admin)
|
||||
if err != nil {
|
||||
t.Error("Error occured while add a user", err.Error())
|
||||
t.Error("Error occurred while add a user", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(400, code, "Add user status should be 400")
|
||||
@ -65,7 +65,7 @@ func TestUsersPost(t *testing.T) {
|
||||
fmt.Println("Register user with admin auth, but bad username format")
|
||||
code, err = apiTest.UsersPost(testUser0002, *admin)
|
||||
if err != nil {
|
||||
t.Error("Error occured while add a user", err.Error())
|
||||
t.Error("Error occurred while add a user", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(400, code, "Add user status should be 400")
|
||||
@ -76,7 +76,7 @@ func TestUsersPost(t *testing.T) {
|
||||
fmt.Println("Register user with admin auth, but empty password.")
|
||||
code, err = apiTest.UsersPost(testUser0002, *admin)
|
||||
if err != nil {
|
||||
t.Error("Error occured while add a user", err.Error())
|
||||
t.Error("Error occurred while add a user", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(400, code, "Add user status should be 400")
|
||||
@ -87,7 +87,7 @@ func TestUsersPost(t *testing.T) {
|
||||
fmt.Println("Register user with admin auth, but email is empty")
|
||||
code, err = apiTest.UsersPost(testUser0002, *admin)
|
||||
if err != nil {
|
||||
t.Error("Error occured while add a user", err.Error())
|
||||
t.Error("Error occurred while add a user", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(400, code, "Add user status should be 400")
|
||||
@ -98,7 +98,7 @@ func TestUsersPost(t *testing.T) {
|
||||
fmt.Println("Register user with admin auth, but bad email format")
|
||||
code, err = apiTest.UsersPost(testUser0002, *admin)
|
||||
if err != nil {
|
||||
t.Error("Error occured while add a user", err.Error())
|
||||
t.Error("Error occurred while add a user", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(400, code, "Add user status should be 400")
|
||||
@ -110,7 +110,7 @@ func TestUsersPost(t *testing.T) {
|
||||
fmt.Println("Register user with admin auth, but user realname is empty")
|
||||
code, err = apiTest.UsersPost(testUser0002, *admin)
|
||||
if err != nil {
|
||||
t.Error("Error occured while add a user", err.Error())
|
||||
t.Error("Error occurred while add a user", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(400, code, "Add user status should be 400")
|
||||
@ -122,7 +122,7 @@ func TestUsersPost(t *testing.T) {
|
||||
fmt.Println("Register user with admin auth, but bad user realname format")
|
||||
code, err = apiTest.UsersPost(testUser0002, *admin)
|
||||
if err != nil {
|
||||
t.Error("Error occured while add a user", err.Error())
|
||||
t.Error("Error occurred while add a user", err.Error())
|
||||
t.Log(err)
|
||||
|
||||
} else {
|
||||
@ -135,7 +135,7 @@ func TestUsersPost(t *testing.T) {
|
||||
fmt.Println("Register user with admin auth, but user comment length is illegal")
|
||||
code, err = apiTest.UsersPost(testUser0002, *admin)
|
||||
if err != nil {
|
||||
t.Error("Error occured while add a user", err.Error())
|
||||
t.Error("Error occurred while add a user", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(400, code, "Add user status should be 400")
|
||||
@ -146,7 +146,7 @@ func TestUsersPost(t *testing.T) {
|
||||
testUser0002.Comment = "test user"
|
||||
code, err = apiTest.UsersPost(testUser0002, *admin)
|
||||
if err != nil {
|
||||
t.Error("Error occured while add a user", err.Error())
|
||||
t.Error("Error occurred while add a user", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(201, code, "Add user status should be 201")
|
||||
@ -156,7 +156,7 @@ func TestUsersPost(t *testing.T) {
|
||||
fmt.Println("Register duplicate user with admin auth")
|
||||
code, err = apiTest.UsersPost(testUser0002, *admin)
|
||||
if err != nil {
|
||||
t.Error("Error occured while add a user", err.Error())
|
||||
t.Error("Error occurred while add a user", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(409, code, "Add user status should be 409")
|
||||
@ -168,7 +168,7 @@ func TestUsersPost(t *testing.T) {
|
||||
testUser0002.Email = "testUser0002@mydomain.com"
|
||||
code, err = apiTest.UsersPost(testUser0002, *admin)
|
||||
if err != nil {
|
||||
t.Error("Error occured while add a user", err.Error())
|
||||
t.Error("Error occurred while add a user", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(409, code, "Add user status should be 409")
|
||||
@ -187,7 +187,7 @@ func TestUsersGet(t *testing.T) {
|
||||
testUser0002Auth = &usrInfo{"testUser0002", "testUser0002"}
|
||||
code, users, err := apiTest.UsersGet(testUser0002.Username, *testUser0002Auth)
|
||||
if err != nil {
|
||||
t.Error("Error occured while get users", err.Error())
|
||||
t.Error("Error occurred while get users", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(403, code, "Get users status should be 403")
|
||||
@ -195,7 +195,7 @@ func TestUsersGet(t *testing.T) {
|
||||
//case 2: Get user2 with admin auth, expect 200
|
||||
code, users, err = apiTest.UsersGet(testUser0002.Username, *admin)
|
||||
if err != nil {
|
||||
t.Error("Error occured while get users", err.Error())
|
||||
t.Error("Error occurred while get users", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(200, code, "Get users status should be 200")
|
||||
@ -213,7 +213,7 @@ func TestUsersGetByID(t *testing.T) {
|
||||
//case 1: Get user2 with userID and his own auth, expect 200
|
||||
code, user, err := apiTest.UsersGetByID(testUser0002.Username, *testUser0002Auth, testUser0002ID)
|
||||
if err != nil {
|
||||
t.Error("Error occured while get users", err.Error())
|
||||
t.Error("Error occurred while get users", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(200, code, "Get users status should be 200")
|
||||
@ -227,7 +227,7 @@ func TestUsersGetByID(t *testing.T) {
|
||||
testUser0003.Realname = "testUser0003"
|
||||
code, err = apiTest.UsersPost(testUser0003, *admin)
|
||||
if err != nil {
|
||||
t.Error("Error occured while add a user", err.Error())
|
||||
t.Error("Error occurred while add a user", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(201, code, "Add user status should be 201")
|
||||
@ -236,7 +236,7 @@ func TestUsersGetByID(t *testing.T) {
|
||||
testUser0003Auth = &usrInfo{"testUser0003", "testUser0003"}
|
||||
code, user, err = apiTest.UsersGetByID(testUser0002.Username, *testUser0003Auth, testUser0002ID)
|
||||
if err != nil {
|
||||
t.Error("Error occured while get users", err.Error())
|
||||
t.Error("Error occurred while get users", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(403, code, "Get users status should be 403")
|
||||
@ -244,7 +244,7 @@ func TestUsersGetByID(t *testing.T) {
|
||||
//case 3: Get user that does not exist with user2 auth, expect 404 not found.
|
||||
code, user, err = apiTest.UsersGetByID(testUser0002.Username, *testUser0002Auth, 1000)
|
||||
if err != nil {
|
||||
t.Error("Error occured while get users", err.Error())
|
||||
t.Error("Error occurred while get users", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(404, code, "Get users status should be 404")
|
||||
@ -252,7 +252,7 @@ func TestUsersGetByID(t *testing.T) {
|
||||
// Get user3ID in order to delete at the last of the test
|
||||
code, users, err := apiTest.UsersGet(testUser0003.Username, *admin)
|
||||
if err != nil {
|
||||
t.Error("Error occured while get users", err.Error())
|
||||
t.Error("Error occurred while get users", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(200, code, "Get users status should be 200")
|
||||
@ -269,7 +269,7 @@ func TestUsersPut(t *testing.T) {
|
||||
//case 1: change user2 profile with user3 auth
|
||||
code, err := apiTest.UsersPut(testUser0002ID, profile, *testUser0003Auth)
|
||||
if err != nil {
|
||||
t.Error("Error occured while change user profile", err.Error())
|
||||
t.Error("Error occurred while change user profile", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(403, code, "Change user profile status should be 403")
|
||||
@ -277,7 +277,7 @@ func TestUsersPut(t *testing.T) {
|
||||
//case 2: change user2 profile with user2 auth, but bad parameters format.
|
||||
code, err = apiTest.UsersPut(testUser0002ID, profile, *testUser0002Auth)
|
||||
if err != nil {
|
||||
t.Error("Error occured while change user profile", err.Error())
|
||||
t.Error("Error occurred while change user profile", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(400, code, "Change user profile status should be 400")
|
||||
@ -288,7 +288,7 @@ func TestUsersPut(t *testing.T) {
|
||||
profile.Comment = "change profile"
|
||||
code, err = apiTest.UsersPut(testUser0002ID, profile, *testUser0002Auth)
|
||||
if err != nil {
|
||||
t.Error("Error occured while change user profile", err.Error())
|
||||
t.Error("Error occurred while change user profile", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(409, code, "Change user profile status should be 409")
|
||||
@ -299,7 +299,7 @@ func TestUsersPut(t *testing.T) {
|
||||
profile.Comment = "change profile"
|
||||
code, err = apiTest.UsersPut(testUser0002ID, profile, *testUser0002Auth)
|
||||
if err != nil {
|
||||
t.Error("Error occured while change user profile", err.Error())
|
||||
t.Error("Error occurred while change user profile", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(200, code, "Change user profile status should be 200")
|
||||
@ -314,7 +314,7 @@ func TestUsersToggleAdminRole(t *testing.T) {
|
||||
//case 1: toggle user2 admin role without admin auth
|
||||
code, err := apiTest.UsersToggleAdminRole(testUser0002ID, *testUser0002Auth, true)
|
||||
if err != nil {
|
||||
t.Error("Error occured while toggle user admin role", err.Error())
|
||||
t.Error("Error occurred while toggle user admin role", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(403, code, "Toggle user admin role status should be 403")
|
||||
@ -322,7 +322,7 @@ func TestUsersToggleAdminRole(t *testing.T) {
|
||||
//case 2: toggle user2 admin role with admin auth
|
||||
code, err = apiTest.UsersToggleAdminRole(testUser0002ID, *admin, true)
|
||||
if err != nil {
|
||||
t.Error("Error occured while toggle user admin role", err.Error())
|
||||
t.Error("Error occurred while toggle user admin role", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(200, code, "Toggle user admin role status should be 200")
|
||||
@ -491,7 +491,7 @@ func TestUsersDelete(t *testing.T) {
|
||||
//case 1:delete user without admin auth
|
||||
code, err := apiTest.UsersDelete(testUser0002ID, *testUser0003Auth)
|
||||
if err != nil {
|
||||
t.Error("Error occured while delete test user", err.Error())
|
||||
t.Error("Error occurred while delete test user", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(403, code, "Delete test user status should be 403")
|
||||
@ -500,7 +500,7 @@ func TestUsersDelete(t *testing.T) {
|
||||
t.Log("delete user-case 2")
|
||||
code, err = apiTest.UsersDelete(testUser0002ID, *testUser0002Auth)
|
||||
if err != nil {
|
||||
t.Error("Error occured while delete test user", err.Error())
|
||||
t.Error("Error occurred while delete test user", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(403, code, "Delete test user status should be 403")
|
||||
@ -509,7 +509,7 @@ func TestUsersDelete(t *testing.T) {
|
||||
t.Log("delete user-case 3")
|
||||
code, err = apiTest.UsersDelete(testUser0002ID, *admin)
|
||||
if err != nil {
|
||||
t.Error("Error occured while delete test user", err.Error())
|
||||
t.Error("Error occurred while delete test user", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(200, code, "Delete test user status should be 200")
|
||||
@ -517,7 +517,7 @@ func TestUsersDelete(t *testing.T) {
|
||||
//delete user3 with admin auth
|
||||
code, err = apiTest.UsersDelete(testUser0003ID, *admin)
|
||||
if err != nil {
|
||||
t.Error("Error occured while delete test user", err.Error())
|
||||
t.Error("Error occurred while delete test user", err.Error())
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(200, code, "Delete test user status should be 200")
|
||||
|
@ -192,7 +192,7 @@ func (lrh listReposHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)
|
||||
}
|
||||
var entries []string
|
||||
for repo := range ctlg.Repositories {
|
||||
log.Debugf("the repo in the reponse %s", ctlg.Repositories[repo])
|
||||
log.Debugf("the repo in the response %s", ctlg.Repositories[repo])
|
||||
exist := dao.RepositoryExists(ctlg.Repositories[repo])
|
||||
if exist {
|
||||
entries = append(entries, ctlg.Repositories[repo])
|
||||
|
@ -29,7 +29,7 @@ type Handler struct {
|
||||
|
||||
// Get handles GET request, it checks the http header for user credentials
|
||||
// and parse service and scope based on docker registry v2 standard,
|
||||
// checkes the permission agains local DB and generates jwt token.
|
||||
// checkes the permission against local DB and generates jwt token.
|
||||
func (h *Handler) Get() {
|
||||
request := h.Ctx.Request
|
||||
log.Debugf("URL for token request: %s", request.URL.String())
|
||||
|
@ -59,7 +59,7 @@ type JobLogRespHandler struct {
|
||||
theAPI *api.BaseAPI
|
||||
}
|
||||
|
||||
//Handle will consume the response of job service and put the content of the job log in the reponse of the API.
|
||||
//Handle will consume the response of job service and put the content of the job log in the response of the API.
|
||||
func (h JobLogRespHandler) Handle(resp *http.Response) error {
|
||||
defer resp.Body.Close()
|
||||
if resp.StatusCode == http.StatusOK {
|
||||
@ -75,7 +75,7 @@ func (h JobLogRespHandler) Handle(resp *http.Response) error {
|
||||
|
||||
b, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
log.Errorf("failed to read reponse body: %v", err)
|
||||
log.Errorf("failed to read response body: %v", err)
|
||||
return err
|
||||
}
|
||||
h.theAPI.RenderError(resp.StatusCode, fmt.Sprintf("message from jobservice: %s", string(b)))
|
||||
|
Loading…
Reference in New Issue
Block a user