commit
4e452bf2b0
|
@ -2,8 +2,12 @@ package aws_test
|
|||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/cloudskiff/driftctl/pkg/remote/aws/repository"
|
||||
"github.com/cloudskiff/driftctl/test/acceptance"
|
||||
"github.com/cloudskiff/driftctl/test/acceptance/awsutils"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func TestAcc_AwsSNSTopicPolicy(t *testing.T) {
|
||||
|
@ -15,6 +19,23 @@ func TestAcc_AwsSNSTopicPolicy(t *testing.T) {
|
|||
Env: map[string]string{
|
||||
"AWS_REGION": "us-east-1",
|
||||
},
|
||||
PreExec: func() {
|
||||
err := acceptance.RetryFor(60*time.Second, func(doneCh chan struct{}) error {
|
||||
client := repository.NewSNSClient(awsutils.Session())
|
||||
topics, err := client.ListAllTopics()
|
||||
if err != nil {
|
||||
logrus.Warnf("Cannot list topics: %+v", err)
|
||||
return err
|
||||
}
|
||||
if len(topics) == 3 {
|
||||
doneCh <- struct{}{}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal("Timeout while fetching SNS TOPIC")
|
||||
}
|
||||
},
|
||||
Check: func(result *acceptance.ScanResult, stdout string, err error) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
|
|
@ -2,8 +2,12 @@ package aws_test
|
|||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/cloudskiff/driftctl/pkg/remote/aws/repository"
|
||||
"github.com/cloudskiff/driftctl/test/acceptance"
|
||||
"github.com/cloudskiff/driftctl/test/acceptance/awsutils"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func TestAcc_AwsSNSTopicSubscription(t *testing.T) {
|
||||
|
@ -15,6 +19,23 @@ func TestAcc_AwsSNSTopicSubscription(t *testing.T) {
|
|||
Env: map[string]string{
|
||||
"AWS_REGION": "us-east-1",
|
||||
},
|
||||
PreExec: func() {
|
||||
err := acceptance.RetryFor(60*time.Second, func(doneCh chan struct{}) error {
|
||||
client := repository.NewSNSClient(awsutils.Session())
|
||||
topics, err := client.ListAllSubscriptions()
|
||||
if err != nil {
|
||||
logrus.Warnf("Cannot list Subscriptions: %+v", err)
|
||||
return err
|
||||
}
|
||||
if len(topics) == 2 {
|
||||
doneCh <- struct{}{}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal("Timeout while fetching SNS Subscriptions")
|
||||
}
|
||||
},
|
||||
Check: func(result *acceptance.ScanResult, stdout string, err error) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
|
|
@ -3,6 +3,11 @@ package aws_test
|
|||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/cloudskiff/driftctl/pkg/remote/aws/repository"
|
||||
|
||||
"github.com/aws/aws-sdk-go/service/sns"
|
||||
|
||||
|
@ -24,6 +29,23 @@ func TestAcc_AwsSNSTopic(t *testing.T) {
|
|||
Env: map[string]string{
|
||||
"AWS_REGION": "us-east-1",
|
||||
},
|
||||
PreExec: func() {
|
||||
err := acceptance.RetryFor(60*time.Second, func(doneCh chan struct{}) error {
|
||||
client := repository.NewSNSClient(awsutils.Session())
|
||||
topics, err := client.ListAllTopics()
|
||||
if err != nil {
|
||||
logrus.Warnf("Cannot list topics: %+v", err)
|
||||
return err
|
||||
}
|
||||
if len(topics) == 3 {
|
||||
doneCh <- struct{}{}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal("Timeout while fetching SNS TOPIC")
|
||||
}
|
||||
},
|
||||
Check: func(result *acceptance.ScanResult, stdout string, err error) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
|
Loading…
Reference in New Issue