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
1 change: 0 additions & 1 deletion mongodbatlas/advanced_clusters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const (
func TestAdvancedClusters_List(t *testing.T) {
client, mux, teardown := setup()
defer teardown()

mux.HandleFunc(fmt.Sprintf("/api/atlas/v1.5/groups/%s/clusters", groupID), func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodGet)
fmt.Fprint(w, `{
Expand Down
2 changes: 0 additions & 2 deletions mongodbatlas/alert_configurations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ func TestAlertConfiguration_Create(t *testing.T) {
client, mux, teardown := setup()
defer teardown()

groupID := "6d2065c687d9d64ae7acdg41"

mux.HandleFunc(fmt.Sprintf("/api/atlas/v1.0/groups/%s/alertConfigs", groupID), func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodPost)

Expand Down
2 changes: 0 additions & 2 deletions mongodbatlas/alerts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ func TestAlert_Get(t *testing.T) {
client, mux, teardown := setup()
defer teardown()

groupID := "535683b3794d371327b"
alertID := "57b76ddc96e8215c017ceafb"

mux.HandleFunc(fmt.Sprintf("/api/atlas/v1.0/groups/%s/alerts/%s", groupID, alertID), func(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -261,7 +260,6 @@ func TestAlert_Acknowledge(t *testing.T) {
client, mux, teardown := setup()
defer teardown()

groupID := "535683b3794d371327b"
alertID := "533dc40ae4b00835ff81eaee"
acknowledgedUntil := "2026-10-01T00:00:00-0400"

Expand Down
6 changes: 0 additions & 6 deletions mongodbatlas/cloud_provider_snapshot_backup_policies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ func TestCloudProviderSnapshotBackupPolicies_Get(t *testing.T) {
client, mux, teardown := setup()
defer teardown()

groupID := "5b6212af90dc76637950a2c6"
clusterName := "myCluster"

var aws = "AWS"
var regionName = "testRegion"
var replicationSpecID = "5e2f1bcaf38990fab9227c9"
Expand Down Expand Up @@ -450,9 +447,6 @@ func TestCloudProviderSnapshotBackupPolicies_Delete(t *testing.T) {
client, mux, teardown := setup()
defer teardown()

groupID := "5b6212af90dc76637950a2c6"
clusterName := "myCluster"

var aws = "AWS"
var regionName = "testRegion"
var replicationSpecID = "5e2f1bcaf38990fab9227c9"
Expand Down
22 changes: 8 additions & 14 deletions mongodbatlas/cloud_provider_snapshot_export_buckets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ func TestCloudProviderSnapshotExportBuckets_List(t *testing.T) {
client, mux, teardown := setup()
defer teardown()

projectID := "test-project-id"

path := fmt.Sprintf("/api/atlas/v1.0/groups/%s/backup/exportBuckets", projectID)
path := fmt.Sprintf("/api/atlas/v1.0/groups/%s/backup/exportBuckets", groupID)

mux.HandleFunc(path, func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodGet)
Expand All @@ -52,7 +50,7 @@ func TestCloudProviderSnapshotExportBuckets_List(t *testing.T) {
}`)
})

cloudProviderSnapshots, _, err := client.CloudProviderSnapshotExportBuckets.List(ctx, projectID, nil)
cloudProviderSnapshots, _, err := client.CloudProviderSnapshotExportBuckets.List(ctx, groupID, nil)
if err != nil {
t.Fatalf("CloudProviderSnapshotExportBuckets.List returned error: %v", err)
}
Expand Down Expand Up @@ -84,10 +82,9 @@ func TestCloudProviderSnapshotExportBuckets_Get(t *testing.T) {
client, mux, teardown := setup()
defer teardown()

projectID := "test-project-id"
bucketID := "bucket-id-test"

path := fmt.Sprintf("/api/atlas/v1.0/groups/%s/backup/exportBuckets/%s", projectID, bucketID)
path := fmt.Sprintf("/api/atlas/v1.0/groups/%s/backup/exportBuckets/%s", groupID, bucketID)

mux.HandleFunc(path, func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodGet)
Expand All @@ -99,7 +96,7 @@ func TestCloudProviderSnapshotExportBuckets_Get(t *testing.T) {
}`)
})

cloudProviderSnapshotBucket, _, err := client.CloudProviderSnapshotExportBuckets.Get(ctx, projectID, bucketID)
cloudProviderSnapshotBucket, _, err := client.CloudProviderSnapshotExportBuckets.Get(ctx, groupID, bucketID)
if err != nil {
t.Fatalf("CloudProviderSnapshotExportBuckets.Get returned error: %v", err)
}
Expand All @@ -120,16 +117,14 @@ func TestCloudProviderSnapshotExportBuckets_Create(t *testing.T) {
client, mux, teardown := setup()
defer teardown()

projectID := "test-project-id"

createRequest := &CloudProviderSnapshotExportBucket{
ID: "{BUCKET-ID}",
BucketName: "example-bucket",
CloudProvider: "AWS",
IAMRoleID: "12345678f901a234dbdb00ca",
}

path := fmt.Sprintf("/api/atlas/v1.0/groups/%s/backup/exportBuckets", projectID)
path := fmt.Sprintf("/api/atlas/v1.0/groups/%s/backup/exportBuckets", groupID)

mux.HandleFunc(path, func(w http.ResponseWriter, r *http.Request) {
expected := map[string]interface{}{
Expand Down Expand Up @@ -157,7 +152,7 @@ func TestCloudProviderSnapshotExportBuckets_Create(t *testing.T) {
}`)
})

cloudProviderSnapshot, _, err := client.CloudProviderSnapshotExportBuckets.Create(ctx, projectID, createRequest)
cloudProviderSnapshot, _, err := client.CloudProviderSnapshotExportBuckets.Create(ctx, groupID, createRequest)
if err != nil {
t.Fatalf("CloudProviderSnapshotExportBuckets.Create returned error: %v", err)
}
Expand All @@ -178,16 +173,15 @@ func TestCloudProviderSnapshotExportBuckets_Delete(t *testing.T) {
client, mux, teardown := setup()
defer teardown()

projectID := "project-id"
bucketID := "bucket-id"

path := fmt.Sprintf("/api/atlas/v1.0/groups/%s/backup/exportBuckets/%s", projectID, bucketID)
path := fmt.Sprintf("/api/atlas/v1.0/groups/%s/backup/exportBuckets/%s", groupID, bucketID)

mux.HandleFunc(path, func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodDelete)
})

_, err := client.CloudProviderSnapshotExportBuckets.Delete(ctx, projectID, bucketID)
_, err := client.CloudProviderSnapshotExportBuckets.Delete(ctx, groupID, bucketID)
if err != nil {
t.Fatalf("CloudProviderSnapshotExportBuckets.Delete returned error: %v", err)
}
Expand Down
20 changes: 6 additions & 14 deletions mongodbatlas/cloud_provider_snapshot_export_jobs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ func TestCloudProviderSnapshotExportJobs_List(t *testing.T) {
client, mux, teardown := setup()
defer teardown()

projectID := "test-project-id"
clusterName := "test-cluster-name"

path := fmt.Sprintf("/api/atlas/v1.0/groups/%s/clusters/%s/backup/exports", projectID, clusterName)
path := fmt.Sprintf("/api/atlas/v1.0/groups/%s/clusters/%s/backup/exports", groupID, clusterName)

mux.HandleFunc(path, func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodGet)
Expand Down Expand Up @@ -84,7 +81,7 @@ func TestCloudProviderSnapshotExportJobs_List(t *testing.T) {
}`)
})

cloudProviderSnapshots, _, err := client.CloudProviderSnapshotExportJobs.List(ctx, projectID, clusterName, nil)
cloudProviderSnapshots, _, err := client.CloudProviderSnapshotExportJobs.List(ctx, groupID, clusterName, nil)
if err != nil {
t.Fatalf("CloudProviderSnapshotExportJobs.List returned error: %v", err)
}
Expand Down Expand Up @@ -148,11 +145,9 @@ func TestCloudProviderSnapshotExportJobs_Get(t *testing.T) {
client, mux, teardown := setup()
defer teardown()

projectID := "test-project-id"
clusterName := "test-cluster-name"
exportID := "job-id-test"

path := fmt.Sprintf("/api/atlas/v1.0/groups/%s/clusters/%s/backup/exports/%s", projectID, clusterName, exportID)
path := fmt.Sprintf("/api/atlas/v1.0/groups/%s/clusters/%s/backup/exports/%s", groupID, clusterName, exportID)

mux.HandleFunc(path, func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodGet)
Expand All @@ -167,7 +162,7 @@ func TestCloudProviderSnapshotExportJobs_Get(t *testing.T) {
}`)
})

cloudProviderSnapshotBucket, _, err := client.CloudProviderSnapshotExportJobs.Get(ctx, projectID, clusterName, exportID)
cloudProviderSnapshotBucket, _, err := client.CloudProviderSnapshotExportJobs.Get(ctx, groupID, clusterName, exportID)
if err != nil {
t.Fatalf("CloudProviderSnapshotExportJobs.Get returned error: %v", err)
}
Expand All @@ -191,9 +186,6 @@ func TestCloudProviderSnapshotExportJobs_Create(t *testing.T) {
client, mux, teardown := setup()
defer teardown()

projectID := "test-project-id"
clusterName := "test-cluster-name"

createRequest := &CloudProviderSnapshotExportJob{
SnapshotID: "{SNAPSHOT-ID}",
ExportBucketID: "{BUCKET-ID}",
Expand All @@ -205,7 +197,7 @@ func TestCloudProviderSnapshotExportJobs_Create(t *testing.T) {
},
}

path := fmt.Sprintf("/api/atlas/v1.0/groups/%s/clusters/%s/backup/exports", projectID, clusterName)
path := fmt.Sprintf("/api/atlas/v1.0/groups/%s/clusters/%s/backup/exports", groupID, clusterName)

mux.HandleFunc(path, func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, `{
Expand All @@ -228,7 +220,7 @@ func TestCloudProviderSnapshotExportJobs_Create(t *testing.T) {
}`)
})

cloudProviderSnapshot, _, err := client.CloudProviderSnapshotExportJobs.Create(ctx, projectID, clusterName, createRequest)
cloudProviderSnapshot, _, err := client.CloudProviderSnapshotExportJobs.Create(ctx, groupID, clusterName, createRequest)
if err != nil {
t.Fatalf("CloudProviderSnapshotExportBuckets.Create returned error: %v", err)
}
Expand Down
39 changes: 7 additions & 32 deletions mongodbatlas/clusters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,6 @@ func TestClusters_Create(t *testing.T) {
client, mux, teardown := setup()
defer teardown()

groupID := "1"

createRequest := &Cluster{
ID: "1",
AutoScaling: &AutoScaling{DiskGBEnabled: pointy.Bool(true),
Expand Down Expand Up @@ -536,9 +534,6 @@ func TestClusters_Update(t *testing.T) {
client, mux, teardown := setup()
defer teardown()

groupID := "1"
clusterName := "AppData"

updateRequest := &Cluster{
ID: "1",
AutoScaling: &AutoScaling{DiskGBEnabled: pointy.Bool(true),
Expand Down Expand Up @@ -601,7 +596,7 @@ func TestClusters_Update(t *testing.T) {
"mongoURI": "mongodb://mongo-shard-00-00.mongodb.net:27017,mongo-shard-00-01.mongodb.net:27017,mongo-shard-00-02.mongodb.net:27017",
"mongoURIUpdated": "2017-10-23T21:26:17Z",
"mongoURIWithOptions": "mongodb://mongo-shard-00-00.mongodb.net:27017,mongo-shard-00-01.mongodb.net:27017,mongo-shard-00-02.mongodb.net:27017/?ssl=true&authSource=admin&replicaSet=mongo-shard-0",
"name": "AppData",
"name": clusterName,
"numShards": float64(1),
"paused": false,
"providerSettings": map[string]interface{}{
Expand Down Expand Up @@ -652,7 +647,7 @@ func TestClusters_Update(t *testing.T) {
"mongoURI": "mongodb://mongo-shard-00-00.mongodb.net:27017,mongo-shard-00-01.mongodb.net:27017,mongo-shard-00-02.mongodb.net:27017",
"mongoURIUpdated": "2017-10-23T21:26:17Z",
"mongoURIWithOptions": "mongodb://mongo-shard-00-00.mongodb.net:27017,mongo-shard-00-01.mongodb.net:27017,mongo-shard-00-02.mongodb.net:27017/?ssl=true&authSource=admin&replicaSet=mongo-shard-0",
"name": "AppData",
"name": "globalCluster",
"numShards": 1,
"paused": false,
"pitEnabled": false,
Expand Down Expand Up @@ -731,8 +726,6 @@ func TestClusters_UpdateProcessArgs(t *testing.T) {
client, mux, teardown := setup()
defer teardown()

groupID := "1"
clusterName := "AppData"
tlsProtocol := "TLS1_2"
defaultReadConcern := "available"
defaultWriteConcern := "1"
Expand Down Expand Up @@ -812,9 +805,6 @@ func TestClusters_GetProcessArgs(t *testing.T) {
client, mux, teardown := setup()
defer teardown()

groupID := "1"
clusterName := "test-cluster"

mux.HandleFunc(fmt.Sprintf("/api/atlas/v1.0/groups/%s/clusters/%s/processArgs", groupID, clusterName), func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodGet)
fmt.Fprint(w, `{
Expand Down Expand Up @@ -862,9 +852,6 @@ func TestClusters_Get(t *testing.T) {
client, mux, teardown := setup()
defer teardown()

groupID := "1"
clusterName := "appData"

mux.HandleFunc(fmt.Sprintf("/api/atlas/v1.0/groups/%s/clusters/%s", groupID, clusterName), func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodGet)
fmt.Fprint(w, `{
Expand Down Expand Up @@ -911,7 +898,7 @@ func TestClusters_Get(t *testing.T) {
"mongoURI": "mongodb://mongo-shard-00-00.mongodb.net:27017,mongo-shard-00-01.mongodb.net:27017,mongo-shard-00-02.mongodb.net:27017",
"mongoURIUpdated": "2017-10-23T21:26:17Z",
"mongoURIWithOptions": "mongodb://mongo-shard-00-00.mongodb.net:27017,mongo-shard-00-01.mongodb.net:27017,mongo-shard-00-02.mongodb.net:27017/?ssl=true&authSource=admin&replicaSet=mongo-shard-0",
"name": "AppData",
"name": "globalCluster",
"numShards": 1,
"paused": false,
"pitEnabled": false,
Expand Down Expand Up @@ -977,7 +964,7 @@ func TestClusters_Get(t *testing.T) {
MongoURI: "mongodb://mongo-shard-00-00.mongodb.net:27017,mongo-shard-00-01.mongodb.net:27017,mongo-shard-00-02.mongodb.net:27017",
MongoURIUpdated: "2017-10-23T21:26:17Z",
MongoURIWithOptions: "mongodb://mongo-shard-00-00.mongodb.net:27017,mongo-shard-00-01.mongodb.net:27017,mongo-shard-00-02.mongodb.net:27017/?ssl=true&authSource=admin&replicaSet=mongo-shard-0",
Name: "AppData",
Name: clusterName,
NumShards: pointy.Int64(1),
Paused: pointy.Bool(false),
PitEnabled: pointy.Bool(false),
Expand Down Expand Up @@ -1012,9 +999,6 @@ func TestClusters_Status(t *testing.T) {
client, mux, teardown := setup()
defer teardown()

groupID := "1"
clusterName := "appData"

mux.HandleFunc(fmt.Sprintf("/api/atlas/v1.0/groups/%s/clusters/%s/status", groupID, clusterName), func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodGet)
fmt.Fprint(w, `{ "changeStatus": "PENDING" }`)
Expand All @@ -1036,14 +1020,11 @@ func TestClusters_LoadSampleDataset(t *testing.T) {
client, mux, teardown := setup()
defer teardown()

groupID := "1"
clusterName := "appData"

mux.HandleFunc(fmt.Sprintf("/api/atlas/v1.0/groups/%s/sampleDatasetLoad/%s", groupID, clusterName), func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodPost)
fmt.Fprint(w, `{
"_id": "1",
"clusterName": "appData",
"clusterName": "globalCluster",
"completeDate": null,
"createDate": "2021-03-26T16:30:47Z",
"errorMessage": null,
Expand Down Expand Up @@ -1071,7 +1052,6 @@ func TestClusters_GetSampleDatasetStatus(t *testing.T) {
client, mux, teardown := setup()
defer teardown()

groupID := "1"
jobID := "1"

mux.HandleFunc(fmt.Sprintf("/api/atlas/v1.0/groups/%s/sampleDatasetLoad/%s", groupID, jobID), func(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -1106,8 +1086,6 @@ func TestCloudProviderRegions_Get(t *testing.T) {
client, mux, teardown := setup()
defer teardown()

groupID := "5b6212af90dc76637950a2c6"

path := fmt.Sprintf("/api/atlas/v1.0/groups/%s/clusters/provider/regions", groupID)

mux.HandleFunc(path, func(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -1313,9 +1291,6 @@ func TestClusters_Upgrade(t *testing.T) {
client, mux, teardown := setup()
defer teardown()

groupID := "1"
clusterName := "AppData"

upgradeRequest := &Cluster{
ID: "1",
AutoScaling: &AutoScaling{DiskGBEnabled: pointy.Bool(true),
Expand Down Expand Up @@ -1378,7 +1353,7 @@ func TestClusters_Upgrade(t *testing.T) {
"mongoURI": "mongodb://mongo-shard-00-00.mongodb.net:27017,mongo-shard-00-01.mongodb.net:27017,mongo-shard-00-02.mongodb.net:27017",
"mongoURIUpdated": "2017-10-23T21:26:17Z",
"mongoURIWithOptions": "mongodb://mongo-shard-00-00.mongodb.net:27017,mongo-shard-00-01.mongodb.net:27017,mongo-shard-00-02.mongodb.net:27017/?ssl=true&authSource=admin&replicaSet=mongo-shard-0",
"name": "AppData",
"name": clusterName,
"numShards": float64(1),
"paused": false,
"providerSettings": map[string]interface{}{
Expand Down Expand Up @@ -1429,7 +1404,7 @@ func TestClusters_Upgrade(t *testing.T) {
"mongoURI": "mongodb://mongo-shard-00-00.mongodb.net:27017,mongo-shard-00-01.mongodb.net:27017,mongo-shard-00-02.mongodb.net:27017",
"mongoURIUpdated": "2017-10-23T21:26:17Z",
"mongoURIWithOptions": "mongodb://mongo-shard-00-00.mongodb.net:27017,mongo-shard-00-01.mongodb.net:27017,mongo-shard-00-02.mongodb.net:27017/?ssl=true&authSource=admin&replicaSet=mongo-shard-0",
"name": "AppData",
"name": "globalCluster",
"numShards": 1,
"paused": false,
"pitEnabled": false,
Expand Down
8 changes: 4 additions & 4 deletions mongodbatlas/performance_advisor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,11 @@ func TestPerformanceAdvisor_EnableManagedSlowOperationThreshold(t *testing.T) {
client, mux, teardown := setup()
defer teardown()

mux.HandleFunc(fmt.Sprintf("/"+performanceAdvisorManagedSlowMs+"/enable", projectID), func(w http.ResponseWriter, r *http.Request) {
mux.HandleFunc(fmt.Sprintf("/"+performanceAdvisorManagedSlowMs+"/enable", groupID), func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodPost)
})

_, err := client.PerformanceAdvisor.EnableManagedSlowOperationThreshold(ctx, projectID)
_, err := client.PerformanceAdvisor.EnableManagedSlowOperationThreshold(ctx, groupID)
if err != nil {
t.Fatalf("PerformanceAdvisor.EnableManagedSlowOperationThreshold returned error: %v", err)
}
Expand All @@ -260,11 +260,11 @@ func TestPerformanceAdvisor_DisableManagedSlowOperationThreshold(t *testing.T) {
client, mux, teardown := setup()
defer teardown()

mux.HandleFunc(fmt.Sprintf("/"+performanceAdvisorManagedSlowMs+"/disable", projectID), func(w http.ResponseWriter, r *http.Request) {
mux.HandleFunc(fmt.Sprintf("/"+performanceAdvisorManagedSlowMs+"/disable", groupID), func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodDelete)
})

_, err := client.PerformanceAdvisor.DisableManagedSlowOperationThreshold(ctx, projectID)
_, err := client.PerformanceAdvisor.DisableManagedSlowOperationThreshold(ctx, groupID)
if err != nil {
t.Fatalf("PerformanceAdvisor.DisableManagedSlowOperationThreshold returned error: %v", err)
}
Expand Down
Loading