...

Source file src/golang.conradwood.net/tests/objstore/objstore-test.go

Documentation: golang.conradwood.net/tests/objstore

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"golang.conradwood.net/go-easyops/authremote"
     6  	"golang.conradwood.net/go-easyops/client"
     7  	"golang.conradwood.net/go-easyops/utils"
     8  	"time"
     9  )
    10  
    11  func main() {
    12  	fmt.Printf("objstore test\n")
    13  	key := "FOOKEYOBJSTORETEST"
    14  	blobs := [][]byte{
    15  		make([]byte, 10000),
    16  		make([]byte, 20000),
    17  		make([]byte, 100000),
    18  		make([]byte, 1000000),
    19  		make([]byte, 10000000),
    20  		make([]byte, 100000000),
    21  	}
    22  	for _, blob := range blobs {
    23  		ctx := authremote.Context()
    24  		exp := time.Now().Add(time.Duration(10) * time.Minute)
    25  		fmt.Printf("Using blob with %d bytes\n", len(blob))
    26  		err := client.PutWithIDAndExpiry(ctx, key, blob, exp)
    27  		utils.Bail("failed to put", err)
    28  		err = client.EvictNoResult(ctx, key)
    29  		utils.Bail("failed to evict", err)
    30  	}
    31  }
    32  

View as plain text