752fb2e2c0
Text Extraction Clean Up + Parallelization * merged_Call * directchildren * bitofimprovements * go * parallel * fixfullsuite * pondforconcurrency * comments * muchdone * bitsofclean * stabilisedtests * snappy * threadpooltests * childelements * testspassed
145 lines
3.0 KiB
Go
145 lines
3.0 KiB
Go
package aws_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"queryorchestration/internal/serviceconfig/aws"
|
|
|
|
awsc "github.com/aws/aws-sdk-go-v2/aws"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestGetAWSKeyID(t *testing.T) {
|
|
cfg := aws.AWSConfig{}
|
|
|
|
name := cfg.GetAWSKeyID()
|
|
assert.Equal(t, "", name)
|
|
|
|
cfg.AWSKeyID = "name"
|
|
name = cfg.GetAWSKeyID()
|
|
assert.Equal(t, "name", name)
|
|
assert.Equal(t, cfg.AWSKeyID, name)
|
|
}
|
|
|
|
func TestSetAWSKeyID(t *testing.T) {
|
|
cfg := aws.AWSConfig{}
|
|
|
|
assert.Equal(t, "", cfg.AWSKeyID)
|
|
newVal := "val"
|
|
cfg.SetAWSKeyID(newVal)
|
|
assert.Equal(t, "val", cfg.AWSKeyID)
|
|
}
|
|
|
|
func TestGetAWSSecretKey(t *testing.T) {
|
|
cfg := aws.AWSConfig{}
|
|
|
|
name := cfg.GetAWSSecretKey()
|
|
assert.Equal(t, "", name)
|
|
|
|
cfg.AWSSecretKey = "name"
|
|
name = cfg.GetAWSSecretKey()
|
|
assert.Equal(t, "name", name)
|
|
assert.Equal(t, cfg.AWSSecretKey, name)
|
|
}
|
|
|
|
func TestSetAWSSecretKey(t *testing.T) {
|
|
cfg := aws.AWSConfig{}
|
|
|
|
assert.Equal(t, "", cfg.AWSSecretKey)
|
|
newVal := "val"
|
|
cfg.SetAWSSecretKey(newVal)
|
|
assert.Equal(t, "val", cfg.AWSSecretKey)
|
|
}
|
|
|
|
func TestGetAWSRegion(t *testing.T) {
|
|
cfg := aws.AWSConfig{}
|
|
|
|
name := cfg.GetAWSRegion()
|
|
assert.Equal(t, "", name)
|
|
|
|
cfg.AWSRegion = "name"
|
|
name = cfg.GetAWSRegion()
|
|
assert.Equal(t, "name", name)
|
|
assert.Equal(t, cfg.AWSRegion, name)
|
|
}
|
|
|
|
func TestSetAWSRegion(t *testing.T) {
|
|
cfg := aws.AWSConfig{}
|
|
|
|
assert.Equal(t, "", cfg.AWSRegion)
|
|
newVal := "val"
|
|
cfg.SetAWSRegion(newVal)
|
|
assert.Equal(t, "val", cfg.AWSRegion)
|
|
}
|
|
|
|
func TestGetAWSSessionToken(t *testing.T) {
|
|
cfg := aws.AWSConfig{}
|
|
|
|
name := cfg.GetAWSSessionToken()
|
|
assert.Equal(t, "", name)
|
|
|
|
cfg.AWSSessionToken = "name"
|
|
name = cfg.GetAWSSessionToken()
|
|
assert.Equal(t, "name", name)
|
|
assert.Equal(t, cfg.AWSSessionToken, name)
|
|
}
|
|
|
|
func TestSetAWSSessionToken(t *testing.T) {
|
|
cfg := aws.AWSConfig{}
|
|
|
|
assert.Equal(t, "", cfg.AWSSessionToken)
|
|
newVal := "val"
|
|
cfg.SetAWSSessionToken(newVal)
|
|
assert.Equal(t, "val", cfg.AWSSessionToken)
|
|
}
|
|
|
|
func TestGetAWSEndpoint(t *testing.T) {
|
|
cfg := aws.AWSConfig{}
|
|
|
|
name := cfg.GetAWSEndpoint()
|
|
assert.Equal(t, "", name)
|
|
|
|
cfg.AWSEndpointUrl = "name"
|
|
name = cfg.GetAWSEndpoint()
|
|
assert.Equal(t, "name", name)
|
|
assert.Equal(t, cfg.AWSEndpointUrl, name)
|
|
}
|
|
|
|
func TestSetAWSEndpoint(t *testing.T) {
|
|
cfg := aws.AWSConfig{}
|
|
|
|
assert.Equal(t, "", cfg.AWSEndpointUrl)
|
|
url := "/i/am/here"
|
|
cfg.SetAWSEndpoint(url)
|
|
assert.Equal(t, url, cfg.AWSEndpointUrl)
|
|
}
|
|
|
|
func TestGetAWSProfile(t *testing.T) {
|
|
cfg := aws.AWSConfig{}
|
|
|
|
name := cfg.GetAWSProfile()
|
|
assert.Equal(t, aws.Profile(""), name)
|
|
|
|
cfg.AWSProfile = "name"
|
|
name = cfg.GetAWSProfile()
|
|
assert.Equal(t, aws.Profile("name"), name)
|
|
assert.Equal(t, cfg.AWSProfile, aws.Profile(name))
|
|
}
|
|
|
|
func TestSetAWSProfile(t *testing.T) {
|
|
cfg := aws.AWSConfig{}
|
|
|
|
assert.Equal(t, aws.Profile(""), cfg.AWSProfile)
|
|
newVal := aws.Profile("val")
|
|
cfg.SetAWSProfile(newVal)
|
|
assert.Equal(t, aws.Profile("val"), cfg.AWSProfile)
|
|
}
|
|
|
|
func TestGetAWSConfig(t *testing.T) {
|
|
c, err := aws.GetAWSConfig(t.Context())
|
|
require.NoError(t, err)
|
|
assert.IsType(t, awsc.Config{}, c)
|
|
}
|