added beta file locker; updates tests
This commit is contained in:
+28
-14
@@ -51,12 +51,12 @@ func cleanFilepath(filename string) (string, error) {
|
|||||||
return filepath.Clean(filename), nil
|
return filepath.Clean(filename), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (oper *Operator) FileInfo(ctx context.Context, operatorID string, param *FileInfoParams) (int, *FileInfoResult, error) {
|
func (oper *Operator) FileInfo(ctx context.Context, operatorID string, params *FileInfoParams) (int, *FileInfoResult, error) {
|
||||||
var err error
|
var err error
|
||||||
code := http.StatusOK
|
code := http.StatusOK
|
||||||
res := &FileInfoResult{}
|
res := &FileInfoResult{}
|
||||||
|
|
||||||
xfilepath, err := cleanFilepath(param.Filepath)
|
xfilepath, err := cleanFilepath(params.Filepath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code := http.StatusInternalServerError
|
code := http.StatusInternalServerError
|
||||||
return code, res, err
|
return code, res, err
|
||||||
@@ -65,6 +65,10 @@ func (oper *Operator) FileInfo(ctx context.Context, operatorID string, param *Fi
|
|||||||
filename := path.Base(xfilepath)
|
filename := path.Base(xfilepath)
|
||||||
collection := path.Dir(xfilepath)
|
collection := path.Dir(xfilepath)
|
||||||
|
|
||||||
|
resName := params.Filepath
|
||||||
|
oper.iLock.WaitAndLock(resName)
|
||||||
|
defer oper.iLock.Done(resName)
|
||||||
|
|
||||||
exist, fileDescr, err := oper.mdb.GetFileByCollectionName(ctx, collection, filename)
|
exist, fileDescr, err := oper.mdb.GetFileByCollectionName(ctx, collection, filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code := http.StatusInternalServerError
|
code := http.StatusInternalServerError
|
||||||
@@ -101,27 +105,31 @@ type PutFileResult struct{}
|
|||||||
const defaultContentType = "application/octet-stream"
|
const defaultContentType = "application/octet-stream"
|
||||||
|
|
||||||
// TODO: checking catalog and file names conflict
|
// TODO: checking catalog and file names conflict
|
||||||
func (oper *Operator) PutFile(ctx context.Context, operatorID string, param *PutFileParams) (int, *PutFileResult, error) {
|
func (oper *Operator) PutFile(ctx context.Context, operatorID string, params *PutFileParams) (int, *PutFileResult, error) {
|
||||||
var err error
|
var err error
|
||||||
res := &PutFileResult{}
|
res := &PutFileResult{}
|
||||||
|
|
||||||
if param.ContentSize == "" {
|
if params.ContentSize == "" {
|
||||||
code := http.StatusLengthRequired
|
code := http.StatusLengthRequired
|
||||||
err = fmt.Errorf("Required Content-Size header is empty")
|
err = fmt.Errorf("Required Content-Size header is empty")
|
||||||
return code, res, err
|
return code, res, err
|
||||||
}
|
}
|
||||||
size, err := strconv.ParseInt(param.ContentSize, 10, 64)
|
size, err := strconv.ParseInt(params.ContentSize, 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code := http.StatusLengthRequired
|
code := http.StatusLengthRequired
|
||||||
return code, res, err
|
return code, res, err
|
||||||
}
|
}
|
||||||
contentType := param.ContentType
|
contentType := params.ContentType
|
||||||
if contentType == "" {
|
if contentType == "" {
|
||||||
contentType = defaultContentType
|
contentType = defaultContentType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resName := params.Filepath
|
||||||
|
oper.iLock.WaitAndLock(resName)
|
||||||
|
defer oper.iLock.Done(resName)
|
||||||
|
|
||||||
// TODO: convert file path to a unified and secure state
|
// TODO: convert file path to a unified and secure state
|
||||||
xfilepath, err := cleanFilepath(param.Filepath)
|
xfilepath, err := cleanFilepath(params.Filepath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code := http.StatusInternalServerError
|
code := http.StatusInternalServerError
|
||||||
return code, res, err
|
return code, res, err
|
||||||
@@ -129,7 +137,7 @@ func (oper *Operator) PutFile(ctx context.Context, operatorID string, param *Put
|
|||||||
filename := path.Base(xfilepath)
|
filename := path.Base(xfilepath)
|
||||||
collection := path.Dir(xfilepath)
|
collection := path.Dir(xfilepath)
|
||||||
|
|
||||||
tmpname, size, checksum, err := oper.store.WriteTempFile(param.Source)
|
tmpname, size, checksum, err := oper.store.WriteTempFile(params.Source)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code := http.StatusInternalServerError
|
code := http.StatusInternalServerError
|
||||||
return code, res, err
|
return code, res, err
|
||||||
@@ -198,13 +206,11 @@ type GetFileResult struct {
|
|||||||
ContentUpdatedBy string
|
ContentUpdatedBy string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (oper *Operator) GetFile(ctx context.Context, operatorID string, param *GetFileParams) (int, *GetFileResult, error) {
|
func (oper *Operator) GetFile(ctx context.Context, operatorID string, params *GetFileParams) (int, *GetFileResult, error) {
|
||||||
var err error
|
var err error
|
||||||
res := &GetFileResult{}
|
res := &GetFileResult{}
|
||||||
|
|
||||||
// TODO: convert file path to a unified and secure state
|
xfilepath, err := cleanFilepath(params.Filepath)
|
||||||
|
|
||||||
xfilepath, err := cleanFilepath(param.Filepath)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code := http.StatusInternalServerError
|
code := http.StatusInternalServerError
|
||||||
return code, res, err
|
return code, res, err
|
||||||
@@ -212,6 +218,10 @@ func (oper *Operator) GetFile(ctx context.Context, operatorID string, param *Get
|
|||||||
filename := path.Base(xfilepath)
|
filename := path.Base(xfilepath)
|
||||||
collection := path.Dir(xfilepath)
|
collection := path.Dir(xfilepath)
|
||||||
|
|
||||||
|
resName := params.Filepath
|
||||||
|
oper.iLock.WaitAndLock(resName)
|
||||||
|
defer oper.iLock.Done(resName)
|
||||||
|
|
||||||
descrExists, fileDescr, err := oper.mdb.GetFileByCollectionName(ctx, collection, filename)
|
descrExists, fileDescr, err := oper.mdb.GetFileByCollectionName(ctx, collection, filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code := http.StatusInternalServerError
|
code := http.StatusInternalServerError
|
||||||
@@ -247,12 +257,12 @@ type DeleteFileParams struct {
|
|||||||
}
|
}
|
||||||
type DeleteFileResult struct{}
|
type DeleteFileResult struct{}
|
||||||
|
|
||||||
func (oper *Operator) DeleteFile(ctx context.Context, operatorID string, param *DeleteFileParams) (int, *DeleteFileResult, error) {
|
func (oper *Operator) DeleteFile(ctx context.Context, operatorID string, params *DeleteFileParams) (int, *DeleteFileResult, error) {
|
||||||
var err error
|
var err error
|
||||||
res := &DeleteFileResult{}
|
res := &DeleteFileResult{}
|
||||||
code := http.StatusOK
|
code := http.StatusOK
|
||||||
|
|
||||||
xfilepath, err := cleanFilepath(param.Filepath)
|
xfilepath, err := cleanFilepath(params.Filepath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code := http.StatusInternalServerError
|
code := http.StatusInternalServerError
|
||||||
return code, res, err
|
return code, res, err
|
||||||
@@ -260,6 +270,10 @@ func (oper *Operator) DeleteFile(ctx context.Context, operatorID string, param *
|
|||||||
filename := path.Base(xfilepath)
|
filename := path.Base(xfilepath)
|
||||||
collection := path.Dir(xfilepath)
|
collection := path.Dir(xfilepath)
|
||||||
|
|
||||||
|
resName := params.Filepath
|
||||||
|
oper.iLock.WaitAndLock(resName)
|
||||||
|
defer oper.iLock.Done(resName)
|
||||||
|
|
||||||
descrExists, _, err := oper.mdb.GetFileByCollectionName(ctx, collection, filename)
|
descrExists, _, err := oper.mdb.GetFileByCollectionName(ctx, collection, filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = http.StatusInternalServerError
|
code = http.StatusInternalServerError
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ type Operator struct {
|
|||||||
store *storage.Storage
|
store *storage.Storage
|
||||||
logg *logger.Logger
|
logg *logger.Logger
|
||||||
iLock *locker.Locker
|
iLock *locker.Locker
|
||||||
|
fLock *locker.Locker
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewOperator(params *OperatorParams) (*Operator, error) {
|
func NewOperator(params *OperatorParams) (*Operator, error) {
|
||||||
@@ -35,6 +36,7 @@ func NewOperator(params *OperatorParams) (*Operator, error) {
|
|||||||
store: params.Store,
|
store: params.Store,
|
||||||
}
|
}
|
||||||
oper.iLock = locker.NewLocker()
|
oper.iLock = locker.NewLocker()
|
||||||
|
oper.fLock = locker.NewLocker()
|
||||||
oper.logg = logger.NewLoggerWithSubject("operator")
|
oper.logg = logger.NewLoggerWithSubject("operator")
|
||||||
return oper, err
|
return oper, err
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-12
@@ -70,7 +70,7 @@ func TestAccountLife(t *testing.T) {
|
|||||||
{
|
{
|
||||||
// ServiceHello
|
// ServiceHello
|
||||||
fmt.Printf("=== ServiceHello ===\n")
|
fmt.Printf("=== ServiceHello ===\n")
|
||||||
cli := client.NewClient()
|
cli := client.NewClient(true)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
helloRes, err := cli.ServiceHello(ctx, srvaddr+"/hello", 1*time.Second)
|
helloRes, err := cli.ServiceHello(ctx, srvaddr+"/hello", 1*time.Second)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@@ -84,7 +84,7 @@ func TestAccountLife(t *testing.T) {
|
|||||||
{
|
{
|
||||||
// CreateAccount
|
// CreateAccount
|
||||||
fmt.Printf("=== CreateAccount ===\n")
|
fmt.Printf("=== CreateAccount ===\n")
|
||||||
cli := client.NewClient()
|
cli := client.NewClient(true)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ func TestAccountLife(t *testing.T) {
|
|||||||
{
|
{
|
||||||
// CreateGrant
|
// CreateGrant
|
||||||
fmt.Printf("=== CreateGrant ===\n")
|
fmt.Printf("=== CreateGrant ===\n")
|
||||||
cli := client.NewClient()
|
cli := client.NewClient(true)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ func TestAccountLife(t *testing.T) {
|
|||||||
{
|
{
|
||||||
// UpdateGrant
|
// UpdateGrant
|
||||||
fmt.Printf("=== UpdateGrant ===\n")
|
fmt.Printf("=== UpdateGrant ===\n")
|
||||||
cli := client.NewClient()
|
cli := client.NewClient(true)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ func TestAccountLife(t *testing.T) {
|
|||||||
{
|
{
|
||||||
// CreateGrant
|
// CreateGrant
|
||||||
fmt.Printf("=== CreateGrant ===\n")
|
fmt.Printf("=== CreateGrant ===\n")
|
||||||
cli := client.NewClient()
|
cli := client.NewClient(true)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ func TestAccountLife(t *testing.T) {
|
|||||||
{
|
{
|
||||||
// GetGrant
|
// GetGrant
|
||||||
fmt.Printf("=== GetGrant ===\n")
|
fmt.Printf("=== GetGrant ===\n")
|
||||||
cli := client.NewClient()
|
cli := client.NewClient(true)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ func TestAccountLife(t *testing.T) {
|
|||||||
{
|
{
|
||||||
// UpdateGrant
|
// UpdateGrant
|
||||||
fmt.Printf("=== UpdateGrant ===\n")
|
fmt.Printf("=== UpdateGrant ===\n")
|
||||||
cli := client.NewClient()
|
cli := client.NewClient(true)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
||||||
|
|
||||||
@@ -153,7 +153,7 @@ func TestAccountLife(t *testing.T) {
|
|||||||
{
|
{
|
||||||
// GetGrant
|
// GetGrant
|
||||||
fmt.Printf("=== GetGrant ===\n")
|
fmt.Printf("=== GetGrant ===\n")
|
||||||
cli := client.NewClient()
|
cli := client.NewClient(true)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
||||||
|
|
||||||
@@ -168,7 +168,7 @@ func TestAccountLife(t *testing.T) {
|
|||||||
{
|
{
|
||||||
// DeleteGrant
|
// DeleteGrant
|
||||||
fmt.Printf("=== DeleteGrant ===\n")
|
fmt.Printf("=== DeleteGrant ===\n")
|
||||||
cli := client.NewClient()
|
cli := client.NewClient(true)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
||||||
|
|
||||||
@@ -178,7 +178,7 @@ func TestAccountLife(t *testing.T) {
|
|||||||
{
|
{
|
||||||
// GetAccount
|
// GetAccount
|
||||||
fmt.Printf("=== GetAccount ===\n")
|
fmt.Printf("=== GetAccount ===\n")
|
||||||
cli := client.NewClient()
|
cli := client.NewClient(true)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
||||||
|
|
||||||
@@ -191,7 +191,7 @@ func TestAccountLife(t *testing.T) {
|
|||||||
{
|
{
|
||||||
// ListAccounts
|
// ListAccounts
|
||||||
fmt.Printf("=== ListAccounts ===\n")
|
fmt.Printf("=== ListAccounts ===\n")
|
||||||
cli := client.NewClient()
|
cli := client.NewClient(true)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
||||||
|
|
||||||
@@ -209,7 +209,7 @@ func TestAccountLife(t *testing.T) {
|
|||||||
{
|
{
|
||||||
// DeleteAccount
|
// DeleteAccount
|
||||||
fmt.Printf("=== DeleteAccount ===\n")
|
fmt.Printf("=== DeleteAccount ===\n")
|
||||||
cli := client.NewClient()
|
cli := client.NewClient(true)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
||||||
|
|
||||||
|
|||||||
+7
-7
@@ -72,7 +72,7 @@ func TestFileLife(t *testing.T) {
|
|||||||
{
|
{
|
||||||
// ServiceHello
|
// ServiceHello
|
||||||
fmt.Printf("=== ServiceHello ===\n")
|
fmt.Printf("=== ServiceHello ===\n")
|
||||||
cli := client.NewClient()
|
cli := client.NewClient(true)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
helloRes, err := cli.ServiceHello(ctx, srvaddr+"/hello", 1*time.Second)
|
helloRes, err := cli.ServiceHello(ctx, srvaddr+"/hello", 1*time.Second)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@@ -93,7 +93,7 @@ func TestFileLife(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
fmt.Printf("=== PutFile ===\n")
|
fmt.Printf("=== PutFile ===\n")
|
||||||
cli := client.NewClient()
|
cli := client.NewClient(true)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ func TestFileLife(t *testing.T) {
|
|||||||
{
|
{
|
||||||
// FileInfo
|
// FileInfo
|
||||||
fmt.Printf("=== FileInfo ===\n")
|
fmt.Printf("=== FileInfo ===\n")
|
||||||
cli := client.NewClient()
|
cli := client.NewClient(true)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ func TestFileLife(t *testing.T) {
|
|||||||
{
|
{
|
||||||
// GetFile
|
// GetFile
|
||||||
fmt.Printf("=== GetFile ===\n")
|
fmt.Printf("=== GetFile ===\n")
|
||||||
cli := client.NewClient()
|
cli := client.NewClient(true)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
||||||
|
|
||||||
@@ -129,7 +129,7 @@ func TestFileLife(t *testing.T) {
|
|||||||
{
|
{
|
||||||
// ListFiles
|
// ListFiles
|
||||||
fmt.Printf("=== ListFiles ===\n")
|
fmt.Printf("=== ListFiles ===\n")
|
||||||
cli := client.NewClient()
|
cli := client.NewClient(true)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ func TestFileLife(t *testing.T) {
|
|||||||
{
|
{
|
||||||
// DeleteFile
|
// DeleteFile
|
||||||
fmt.Printf("=== DeleteFile ===\n")
|
fmt.Printf("=== DeleteFile ===\n")
|
||||||
cli := client.NewClient()
|
cli := client.NewClient(true)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
||||||
|
|
||||||
@@ -150,7 +150,7 @@ func TestFileLife(t *testing.T) {
|
|||||||
{
|
{
|
||||||
// !FileInfo
|
// !FileInfo
|
||||||
fmt.Printf("=== FileInfo ===\n")
|
fmt.Printf("=== FileInfo ===\n")
|
||||||
cli := client.NewClient()
|
cli := client.NewClient(true)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
ctx, _ = context.WithTimeout(ctx, 1*time.Second)
|
||||||
|
|
||||||
|
|||||||
+8
-8
@@ -70,7 +70,7 @@ func TestImageLife(t *testing.T) {
|
|||||||
{
|
{
|
||||||
// ServiceHello
|
// ServiceHello
|
||||||
fmt.Printf("=== ServiceHello ===\n")
|
fmt.Printf("=== ServiceHello ===\n")
|
||||||
cli := client.NewClient()
|
cli := client.NewClient(true)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
helloRes, err := cli.ServiceHello(ctx, srvaddr+"/hello", 1*time.Second)
|
helloRes, err := cli.ServiceHello(ctx, srvaddr+"/hello", 1*time.Second)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@@ -79,26 +79,26 @@ func TestImageLife(t *testing.T) {
|
|||||||
{
|
{
|
||||||
// PishImage
|
// PishImage
|
||||||
fmt.Printf("=== PushImage ===\n")
|
fmt.Printf("=== PushImage ===\n")
|
||||||
cli := client.NewClient()
|
cli := client.NewClient(true)
|
||||||
ctx, _ := context.WithTimeout(context.Background(), 1*time.Second)
|
ctx, _ := context.WithTimeout(context.Background(), 1*time.Second)
|
||||||
err := cli.PushImage(ctx, "test-oci.tar", srvaddr+"/foo/test:123")
|
err := cli.PushImage(ctx, "test-oci.tar", srvaddr+"/foo/test:123")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
// ImageInfo
|
// ImageAmnifest
|
||||||
fmt.Printf("=== ImageInfo ===\n")
|
fmt.Printf("=== ImageManifest ===\n")
|
||||||
cli := client.NewClient()
|
cli := client.NewClient(true)
|
||||||
ctx, _ := context.WithTimeout(context.Background(), 1*time.Second)
|
ctx, _ := context.WithTimeout(context.Background(), 1*time.Second)
|
||||||
info, err := cli.ImageInfo(ctx, srvaddr+"/foo/test:123")
|
info, err := cli.ImageManifest(ctx, srvaddr+"/foo/test:123")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
infoYaml, err := yaml.Marshal(info)
|
infoYaml, err := yaml.Marshal(info)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
fmt.Printf("imageInfo:\n%s\n", string(infoYaml))
|
fmt.Printf("imagemanifest:\n%s\n", string(infoYaml))
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
// DeleteImage
|
// DeleteImage
|
||||||
fmt.Printf("=== DeleteImage ===\n")
|
fmt.Printf("=== DeleteImage ===\n")
|
||||||
cli := client.NewClient()
|
cli := client.NewClient(true)
|
||||||
ctx, _ := context.WithTimeout(context.Background(), 1*time.Second)
|
ctx, _ := context.WithTimeout(context.Background(), 1*time.Second)
|
||||||
err := cli.DeleteImage(ctx, srvaddr+"/foo/test:123")
|
err := cli.DeleteImage(ctx, srvaddr+"/foo/test:123")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|||||||
Reference in New Issue
Block a user