Documentation
¶
Overview ¶
Package smeltery provides a simple API for spinning up the complete Storacha network in Go tests using testcontainers-go.
Example usage:
func TestUploadFlow(t *testing.T) {
stack := smeltery.MustNewStack(t,
smeltery.WithPiriImage("my-piri:test"),
)
resp, _ := http.Get(stack.PiriEndpoint() + "/readyz")
assert.Equal(t, 200, resp.StatusCode)
}
Index ¶
- type Option
- func WithBlockchainImage(image string) Option
- func WithDelegatorImage(image string) Option
- func WithGuppyImage(image string) Option
- func WithIPNIImage(image string) Option
- func WithIndexerImage(image string) Option
- func WithKeepOnFailure() Option
- func WithPiriBinary(path string) Option
- func WithPiriImage(image string) Option
- func WithSignerImage(image string) Option
- func WithTimeout(d time.Duration) Option
- func WithUploadImage(image string) Option
- type Stack
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*config)
Option configures a Stack.
func WithBlockchainImage ¶
WithBlockchainImage sets the blockchain (Anvil) container image.
func WithDelegatorImage ¶
WithDelegatorImage sets the delegator container image.
func WithGuppyImage ¶
WithGuppyImage sets the guppy container image.
func WithIPNIImage ¶
WithIPNIImage sets the IPNI container image.
func WithIndexerImage ¶
WithIndexerImage sets the indexer container image.
func WithKeepOnFailure ¶
func WithKeepOnFailure() Option
WithKeepOnFailure prevents cleanup when a test fails, useful for debugging.
func WithPiriBinary ¶
WithPiriBinary mounts a local piri binary into the container, replacing the image's binary. This enables rapid iteration without rebuilding the container image. The binary must be compiled for Linux (use BuildPiriBinary helper).
Example:
piriBin := stack.BuildPiriBinary(t, "/path/to/piri/repo") s := stack.MustNewStack(t, stack.WithPiriBinary(piriBin))
func WithPiriImage ¶
WithPiriImage sets the piri container image.
func WithSignerImage ¶
WithSignerImage sets the signing service container image.
func WithTimeout ¶
WithTimeout sets the maximum time to wait for the stack to start.
func WithUploadImage ¶
WithUploadImage sets the upload service container image.
type Stack ¶
type Stack struct {
// contains filtered or unexported fields
}
Stack represents a running Storacha network.
func MustNewStack ¶
MustNewStack creates and starts a network, calling t.Fatal on error.
func NewStack ¶
NewStack creates and starts a complete Storacha network. Returns error if startup fails. Cleanup is automatically registered via t.Cleanup().
func (*Stack) Close ¶
Close shuts down the stack and cleans up resources. This is called automatically via t.Cleanup(), but can be called manually.