Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion test/e2e/atlas/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,10 @@ func integrationExists(name string, thirdPartyIntegrations mongodbatlas.ThirdPar
return false
}

func Gov() bool {
return os.Getenv("MCLI_SERVICE") == "cloudgov"
}

func createProject(projectName string) (string, error) {
cliPath, err := e2e.AtlasCLIBin()
if err != nil {
Expand All @@ -290,7 +294,7 @@ func createProject(projectName string) (string, error) {
projectName,
"-o=json",
}
if os.Getenv("MCLI_SERVICE") == "cloudgov" {
if Gov() {
args = append(args, "--govCloudRegionsOnly")
}
cmd := exec.Command(cliPath, args...)
Expand Down
52 changes: 27 additions & 25 deletions test/e2e/atlas/integrations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,29 @@ func TestIntegrations(t *testing.T) {
cliPath, err := e2e.AtlasCLIBin()
require.NoError(t, err)

t.Run("Create DATADOG", func(t *testing.T) {
cmd := exec.Command(cliPath,
integrationsEntity,
"create",
datadogEntity,
"--apiKey",
key,
"--projectId",
g.projectID,
"-o=json")
cmd.Env = os.Environ()
resp, err := cmd.CombinedOutput()

a := assert.New(t)
a.NoError(err, string(resp))

var thirdPartyIntegrations mongodbatlas.ThirdPartyIntegrations
if err := json.Unmarshal(resp, &thirdPartyIntegrations); a.NoError(err) {
a.True(integrationExists(datadogEntity, thirdPartyIntegrations))
}
})
if !Gov() { // cloudgov does not have an available datadog region
t.Run("Create DATADOG", func(t *testing.T) {
cmd := exec.Command(cliPath,
integrationsEntity,
"create",
datadogEntity,
"--apiKey",
key,
"--projectId",
g.projectID,
"-o=json")
cmd.Env = os.Environ()
resp, err := cmd.CombinedOutput()

a := assert.New(t)
a.NoError(err, string(resp))

var thirdPartyIntegrations mongodbatlas.ThirdPartyIntegrations
if err := json.Unmarshal(resp, &thirdPartyIntegrations); a.NoError(err) {
a.True(integrationExists(datadogEntity, thirdPartyIntegrations))
}
})
}
Comment on lines +51 to +73
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

t.Skip("Skipping testing becuase of gov")


t.Run("Create NEW_RELIC", func(t *testing.T) {
cmd := exec.Command(cliPath,
Expand Down Expand Up @@ -212,7 +214,7 @@ func TestIntegrations(t *testing.T) {
cmd := exec.Command(cliPath,
integrationsEntity,
"describe",
datadogEntity,
newRelicEntity,
"--projectId",
g.projectID,
"-o=json")
Expand All @@ -223,15 +225,15 @@ func TestIntegrations(t *testing.T) {
a.NoError(err, string(resp))
var thirdPartyIntegration mongodbatlas.ThirdPartyIntegration
if err := json.Unmarshal(resp, &thirdPartyIntegration); a.NoError(err) {
a.Equal(datadogEntity, thirdPartyIntegration.Type)
a.Equal(newRelicEntity, thirdPartyIntegration.Type)
}
})

t.Run("Delete", func(t *testing.T) {
cmd := exec.Command(cliPath,
integrationsEntity,
"delete",
datadogEntity,
newRelicEntity,
"--force",
"--projectId",
g.projectID)
Expand All @@ -241,7 +243,7 @@ func TestIntegrations(t *testing.T) {
a := assert.New(t)
a.NoError(err, string(resp))

expected := fmt.Sprintf("Integration '%s' deleted\n", datadogEntity)
expected := fmt.Sprintf("Integration '%s' deleted\n", newRelicEntity)
a.Equal(expected, string(resp))
})
}