diff --git a/ctrd/client.go b/ctrd/client.go index 12a7bc9a2..8aa1d5968 100644 --- a/ctrd/client.go +++ b/ctrd/client.go @@ -85,7 +85,7 @@ func NewClient(cfg Config) (APIClient, error) { } // Get will reture an available containerd grpc client, -// Or occured an error +// Or occurred an error func (c *Client) Get(ctx context.Context) (*WrapperClient, error) { start := time.Now() @@ -106,7 +106,7 @@ func (c *Client) Get(ctx context.Context) (*WrapperClient, error) { end := time.Now() elapsed := end.Sub(start) logrus.WithFields(logrus.Fields{ - "elasped": elapsed, + "elapsed": elapsed, }).Debug("Get a grpc client") return wrapperCli, nil diff --git a/daemon/mgr/image.go b/daemon/mgr/image.go index bad587dc6..d27e54ece 100644 --- a/daemon/mgr/image.go +++ b/daemon/mgr/image.go @@ -114,11 +114,7 @@ func (mgr *ImageManager) ListImages(ctx context.Context, filters string) ([]type // SearchImages searches imaged from specified registry. func (mgr *ImageManager) SearchImages(ctx context.Context, name string, registry string) ([]types.SearchResultItem, error) { // Directly send API calls towards specified registry - if registry == "" { - registry = mgr.DefaultRegistry - } - - return nil, nil + return nil, errtypes.ErrNotImplemented } // GetImage gets image by image id or ref. diff --git a/pkg/errtypes/errors.go b/pkg/errtypes/errors.go index 06a5fb37f..816de7bf8 100644 --- a/pkg/errtypes/errors.go +++ b/pkg/errtypes/errors.go @@ -25,6 +25,9 @@ var ( // ErrLockfailed represents that failed to lock. ErrLockfailed = errorType{codeLockfailed, "lock failed"} + + // ErrNotImplemented represents that the function is not implemented. + ErrNotImplemented = errorType{codeNotImplemented, "not implemented"} ) const ( @@ -35,6 +38,7 @@ const ( codeInvalidType codeTimeout codeLockfailed + codeNotImplemented ) type errorType struct { diff --git a/pkg/quota/prjquota.go b/pkg/quota/prjquota.go index 8dab76471..68ce9c6d9 100644 --- a/pkg/quota/prjquota.go +++ b/pkg/quota/prjquota.go @@ -120,6 +120,9 @@ func (quota *PrjQuota) SetDiskQuota(dir string, size string, quotaID int) error } limit, err := bytefmt.ToKilobytes(size) + if err != nil { + return fmt.Errorf("invalid size: %s %v", size, err) + } // transfer limit from kbyte to byte if err := quota.checkDevLimit(dir, limit*1024); err != nil { diff --git a/test/environment/env.go b/test/environment/env.go index 869a4747c..bf070a0fc 100644 --- a/test/environment/env.go +++ b/test/environment/env.go @@ -42,7 +42,7 @@ var ( Subnet = "192.168.1.0/24" ) -// GetBusybox get image info from test envrionment variable. +// GetBusybox get image info from test environment variable. func GetBusybox() { if len(os.Getenv("POUCH_BUSYBOXREPO")) != 0 { BusyboxRepo = os.Getenv("POUCH_BUSYBOXREPO") @@ -52,7 +52,7 @@ func GetBusybox() { } } -// GetHelloWorld get image info from test envrionment variable. +// GetHelloWorld get image info from test environment variable. func GetHelloWorld() { if len(os.Getenv("POUCH_HELLOWORLDREPO")) != 0 { HelloworldRepo = os.Getenv("POUCH_HELLOWORLDREPO") diff --git a/test/util_api.go b/test/util_api.go index 687815290..99a2237d6 100644 --- a/test/util_api.go +++ b/test/util_api.go @@ -266,6 +266,7 @@ func PullImage(c *check.C, image string) { q.Add("fromImage", image) query := request.WithQuery(q) resp, err = request.Post("/images/create", query) + c.Assert(err, check.IsNil) c.Assert(resp.StatusCode, check.Equals, 200) } }