working commit
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"testing"
|
||||
"fmt"
|
||||
"time"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"bytes"
|
||||
)
|
||||
|
||||
|
||||
func TestClientGetManigest(t *testing.T) {
|
||||
rawrefs := []string{
|
||||
"mirror.gcr.io/alpine:3.20.0",
|
||||
"mirror.gcr.io/alpine:sha256:29e5ba63e79337818e6c63cfcc68e2ab4e9ca483853b2de303bfbfba9372426c",
|
||||
}
|
||||
for _, rawref := range rawrefs {
|
||||
cli := NewClient(true)
|
||||
ctx, _ := context.WithTimeout(context.Background(), 10 * time.Second)
|
||||
exist, mime, man, err := cli.GetManifest(ctx, rawref)
|
||||
require.NoError(t, err)
|
||||
require.True(t, exist)
|
||||
|
||||
fmt.Printf("MIME: %s\n", mime)
|
||||
buffer := bytes.NewBuffer(nil)
|
||||
err = json.Indent(buffer, man, " ", " ")
|
||||
require.NoError(t, err)
|
||||
fmt.Printf("%s\n", buffer.String())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user