-
Notifications
You must be signed in to change notification settings - Fork 9
/
integrations_test.go
81 lines (61 loc) · 2.03 KB
/
integrations_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package rockset_test
import (
"fmt"
"testing"
"github.com/stretchr/testify/suite"
"github.com/rockset/rockset-go-client"
"github.com/rockset/rockset-go-client/internal/test"
"github.com/rockset/rockset-go-client/option"
)
type IntegrationTestSuite struct {
suite.Suite
rc *rockset.RockClient
s3Integration string
gcsIntegration string
}
func TestIntegrationTestSuite(t *testing.T) {
_, randomName := vcrTestClient(t, t.Name())
suite.Run(t, &IntegrationTestSuite{
s3Integration: randomName("s3"),
gcsIntegration: randomName("gcs"),
})
}
func (s *IntegrationTestSuite) BeforeTest(suiteName, testName string) {
s.rc, _ = vcrTestClient(s.T(), fmt.Sprintf("%s/%s", suiteName, testName))
}
func (s *IntegrationTestSuite) TearDown() {
ctx := test.Context()
// clean up any lingering integrations
_ = s.rc.DeleteIntegration(ctx, s.s3Integration)
_ = s.rc.DeleteIntegration(ctx, s.gcsIntegration)
}
func (s *IntegrationTestSuite) TestGetIntegration() {
ctx := test.Context()
const iName = "acc-kafka-integration"
integration, err := s.rc.GetIntegration(ctx, iName)
s.NoError(err)
s.Assert().Equal(iName, integration.GetName())
}
func (s *IntegrationTestSuite) TestListIntegrations() {
ctx := test.Context()
_, err := s.rc.ListIntegrations(ctx)
s.NoError(err)
}
func (s *IntegrationTestSuite) TestCreateS3Integration() {
ctx := test.Context()
_, err := s.rc.CreateS3Integration(ctx, s.s3Integration,
option.AWSRole("arn:aws:iam::469279130686:role/rockset-s3-integration"),
option.WithS3IntegrationDescription(test.Description()))
s.Require().NoError(err)
err = s.rc.DeleteIntegration(ctx, s.s3Integration)
s.Require().NoError(err)
}
func (s *IntegrationTestSuite) TestCreateGCSIntegration() {
saKeyFile := test.SkipUnlessEnvSet(s.T(), "GCP_SA_KEY_JSON")
ctx := test.Context()
_, err := s.rc.CreateGCSIntegration(ctx, s.gcsIntegration, saKeyFile,
option.WithGCSIntegrationDescription(test.Description()))
s.Require().NoError(err)
err = s.rc.DeleteIntegration(ctx, s.gcsIntegration)
s.Require().NoError(err)
}