Documentation
¶
Index ¶
- Variables
- func CreatePostgres(t *testing.T) *pgxpool.Pool
- func CreateS3(t *testing.T) *url.URL
- func DeriveBlobProvider(t *testing.T, digest multihash.Multihash) ucan.Issuer
- func IsDockerAvailable(t testing.TB) bool
- func IsRunningInCI(t testing.TB) bool
- func Must[T any](val T, err error) func(*testing.T) T
- func NewMockPiriServer(t *testing.T, storageProvider ucan.Issuer, uploadService identity.Identity, ...) *httptest.Server
- func NewS3Client(t *testing.T, endpoint *url.URL) *s3.Client
- func ProviderProofs(t *testing.T, storageProvider, uploadService ucan.Issuer) ucan.Container
- func RandomCID(t *testing.T) cid.Cid
Constants ¶
This section is empty.
Variables ¶
var ( Alice = testutil.Alice Bob = testutil.Bob Carol = testutil.Carol Mallory = testutil.Mallory Service = testutil.Service WebService = identity.Identity{Issuer: testutil.WebService} WebServiceSigner = testutil.WebServiceSigner RandomBytes = testutil.RandomBytes RandomDID = testutil.RandomDID RandomMultihash = testutil.RandomMultihash RandomIssuer = testutil.RandomIssuer RandomMultikeyIssuer = testutil.RandomMultikeyIssuer )
Functions ¶
func CreatePostgres ¶
CreatePostgres starts a throwaway Postgres container, runs the sprue migrations against it, and returns a connection pool. The container is cleaned up when the test finishes.
func DeriveBlobProvider ¶
DeriveBlobProvider mirrors the production handler's logic for deriving a signer from a blob's digest, used to sign /http/put invocations and receipts.
func IsDockerAvailable ¶
IsDockerAvailable returns true if the docker daemon is available, useful for skipping tests when docker isn't running
func IsRunningInCI ¶
IsRunningInCI returns true of process is running in CI environment.
func NewMockPiriServer ¶
func NewMockPiriServer( t *testing.T, storageProvider ucan.Issuer, uploadService identity.Identity, allocateOK *blobcmds.AllocateOK, acceptOK *blobcmds.AcceptOK, ) *httptest.Server
NewMockPiriServer stands up a UCAN HTTP server that handles /blob/allocate & /blob/accept by returning the canned responses. Wraps the upload service's did:web identity so signatures verify against the underlying did:key.
func ProviderProofs ¶
ProviderProofs builds the proof container a storage provider grants the upload service at registration: self-issued delegations (subject = provider) authorizing `/blob/allocate` and `/blob/accept`.
Types ¶
This section is empty.