S3

The framework contains local S3 provider. Currently, we support MinIO.

Configuration

[local_s3]
host = "minio"
port = 9000
console_port = 9001
access_key = "(default:random)"
secret_key = "(default:random)"
bucket = "test-bucket"
region = "us-east-1"

Example values are defaults.

Usage

package my_test

import (
	"fmt"
	"os"
	"testing"

	"github.com/smartcontractkit/chainlink-testing-framework/framework/components/s3provider"
	"github.com/smartcontractkit/chainlink-testing-framework/framework"
	"github.com/stretchr/testify/require"
)

type Config struct {
	S3Config *s3provider.Input `toml:"local_s3" validate:"required"`
}

func TestLocalS3(t *testing.T) {
	in, err := framework.Load[Config](t)
	require.NoError(t, err)

	output, err := NewMinioFactory().NewFrom(in)
	require.NoError(t, err)

	t.log(fmt.Printf("%#v", output))
}

Alternatively, the component supports Options pattern and can be created from code:

    // ...
    s3provider, err := NewMinioFactory().New(
        WithPort(port),
        WithConsolePort(consolePort),
        WithAccessKey(accessKey),
        WithSecretKey(secretKey),
    )
    require.NoError(t, err)

    output := s3provider.Output()
	// ...