s3

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package s3 provides post-apply assertions for AWS S3 resources created by Terraform modules under test.

All assertions follow the paired-method shape established in INV-0001: a context-aware variant ending in Context and a shim that calls the *Context variant with tb.Context(). The shim exists so module authors writing straight-line assertion code don't have to thread ctx through every line:

s3assert.BucketExists(t, cfg, name)
s3assert.BucketExistsContext(t, ctx, cfg, name)

Every *Context assertion respects ctx cancellation — a cancelled ctx surfaces as a tb.Errorf call rather than a panic or a hang.

Import alias convention: callers typically alias this package as s3assert to avoid a naming collision with the AWS SDK's s3 package:

import (
    s3assert "github.com/donaldgifford/libtftest/assert/s3"
    s3sdk   "github.com/aws/aws-sdk-go-v2/service/s3"
)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BucketBlocksPublicAccess

func BucketBlocksPublicAccess(tb testing.TB, cfg aws.Config, name string)

BucketBlocksPublicAccess is a shim that calls BucketBlocksPublicAccessContext with tb.Context().

func BucketBlocksPublicAccessContext

func BucketBlocksPublicAccessContext(tb testing.TB, ctx context.Context, cfg aws.Config, name string)

BucketBlocksPublicAccessContext asserts that the named S3 bucket has all four public-access-block flags set to true.

func BucketExists

func BucketExists(tb testing.TB, cfg aws.Config, name string)

BucketExists is a shim that calls BucketExistsContext with tb.Context().

func BucketExistsContext

func BucketExistsContext(tb testing.TB, ctx context.Context, cfg aws.Config, name string)

BucketExistsContext asserts that the named S3 bucket exists.

func BucketHasEncryption

func BucketHasEncryption(tb testing.TB, cfg aws.Config, name, algo string)

BucketHasEncryption is a shim that calls BucketHasEncryptionContext with tb.Context().

func BucketHasEncryptionContext

func BucketHasEncryptionContext(tb testing.TB, ctx context.Context, cfg aws.Config, name, algo string)

BucketHasEncryptionContext asserts that the named S3 bucket has server-side encryption configured with the given algorithm.

func BucketHasTag

func BucketHasTag(tb testing.TB, cfg aws.Config, name, key, want string)

BucketHasTag is a shim that calls BucketHasTagContext with tb.Context().

func BucketHasTagContext

func BucketHasTagContext(tb testing.TB, ctx context.Context, cfg aws.Config, name, key, want string)

BucketHasTagContext asserts that the named S3 bucket carries the given tag key with the given value.

func BucketHasVersioning

func BucketHasVersioning(tb testing.TB, cfg aws.Config, name string)

BucketHasVersioning is a shim that calls BucketHasVersioningContext with tb.Context().

func BucketHasVersioningContext

func BucketHasVersioningContext(tb testing.TB, ctx context.Context, cfg aws.Config, name string)

BucketHasVersioningContext asserts that the named S3 bucket has versioning Enabled.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL