Skip to content

Commit

Permalink
fix(tests): review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
dabcoder committed May 3, 2024
1 parent c79f375 commit 5a23120
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions exporter/awss3exporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/otelcol/otelcoltest"
"go.uber.org/multierr"

"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awss3exporter/internal/metadata"
)
Expand Down Expand Up @@ -107,10 +108,8 @@ func TestConfig_Validate(t *testing.T) {
config *Config
errExpected error
}{
// Valid config with endpoint provided
{
// endpoint should contain region and bucket name
// https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html
// endpoint overrides bucket name.
name: "valid with endpoint and region",
config: func() *Config {
c := createDefaultConfig().(*Config)
Expand All @@ -121,6 +120,8 @@ func TestConfig_Validate(t *testing.T) {
errExpected: nil,
},
{
// Endpoint will be built from bucket and region.
// https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html
name: "valid with S3Bucket and region",
config: func() *Config {
c := createDefaultConfig().(*Config)
Expand All @@ -139,7 +140,8 @@ func TestConfig_Validate(t *testing.T) {
c.S3Uploader.Endpoint = ""
return c
}(),
errExpected: errors.New("endpoint and region should be provided, or bucket amd region"),
errExpected: multierr.Append(errors.New("region is required"),
errors.New("bucket or endpoint is required")),
},
{
name: "region only",
Expand Down

0 comments on commit 5a23120

Please sign in to comment.