Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
github.com/elgohr/go-localstack
Go Wrapper for using localstack in go testing
Please make sure that you have Docker installed.
go get github.com/elgohr/go-localstack
With SDK V2 (using EndpointResolverV2). Please have a look at resolvers for a complete list of resolvers.
func ExampleLocalstackSdkV2EndpointResolverV2(t *testing.T) {
l, err := localstack.NewInstance()
if err != nil {
t.Fatalf("Could not connect to Docker %v", err)
}
if err := l.Start(); err != nil {
t.Fatalf("Could not start localstack %v", err)
}
t.Cleanup(func() {
if err := l.Stop(); err != nil {
t.Fatalf("Could not stop localstack %v", err)
}
})
cfg, err := config.LoadDefaultConfig(ctx,
config.WithRegion("us-east-1"),
config.WithCredentialsProvider(credentials.NewStaticCredentialsProvider("dummy", "dummy", "dummy")),
)
if err != nil {
t.Fatalf("Could not get config %v", err)
}
resolver := localstack.NewDynamoDbResolverV2(i)
client := dynamodb.NewFromConfig(cfg, dynamodb.WithEndpointResolverV2(resolver))
myTestWithV2Client(client)
}
With SDK V2 (using EndpointResolverV1)
func ExampleLocalstackSdkV2(t *testing.T) {
l, err := localstack.NewInstance()
if err != nil {
t.Fatalf("Could not connect to Docker %v", err)
}
if err := l.Start(); err != nil {
t.Fatalf("Could not start localstack %v", err)
}
t.Cleanup(func() {
if err := l.Stop(); err != nil {
t.Fatalf("Could not stop localstack %v", err)
}
})
cfg, err := config.LoadDefaultConfig(ctx,
config.WithRegion("us-east-1"),
config.WithEndpointResolverWithOptions(aws.EndpointResolverWithOptionsFunc(func(_, _ string, _ ...interface{}) (aws.Endpoint, error) {
return aws.Endpoint{
PartitionID: "aws",
URL: l.EndpointV2(localstack.SQS),
SigningRegion: "us-east-1",
HostnameImmutable: true,
}, nil
})),
config.WithCredentialsProvider(credentials.NewStaticCredentialsProvider("dummy", "dummy", "dummy")),
)
if err != nil {
t.Fatalf("Could not get config %v", err)
}
myTestWithV2(cfg)
}
With SDK V1
func TestWithLocalStack(t *testing.T) {
l, err := localstack.NewInstance()
if err != nil {
t.Fatalf("Could not connect to Docker %v", err)
}
if err := l.Start(); err != nil {
t.Fatalf("Could not start localstack %v", err)
}
t.Cleanup(func() {
if err := l.Stop(); err != nil {
t.Fatalf("Could not stop localstack %v", err)
}
})
myTestWith(&aws.Config{
Credentials: credentials.NewStaticCredentials("not", "empty", ""),
DisableSSL: aws.Bool(true),
Region: aws.String(endpoints.UsWest1RegionID),
Endpoint: aws.String(l.Endpoint(localstack.SQS)),
})
}
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.