@@ -5,29 +5,31 @@ import (
5
5
"os"
6
6
"testing"
7
7
8
+ matlas "go.mongodb.org/atlas/mongodbatlas"
9
+
8
10
"github.com/hashicorp/terraform-plugin-testing/helper/acctest"
9
11
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
10
12
"github.com/hashicorp/terraform-plugin-testing/plancheck"
11
- matlas "go.mongodb.org/atlas/mongodbatlas"
12
13
)
13
14
14
- func TestAccConfigRSAlertConfiguration_Migration_NotificationsWithMetricThreshold (t * testing.T ) {
15
+ func TestAccMigrationConfigRSAlertConfiguration_NotificationsWithMetricThreshold (t * testing.T ) {
15
16
var (
16
- resourceName = "mongodbatlas_alert_configuration.test"
17
- orgID = os .Getenv ("MONGODB_ATLAS_ORG_ID" )
18
- projectName = acctest .RandomWithPrefix ("test-acc" )
19
- alert = & matlas.AlertConfiguration {}
20
- config = testAccMongoDBAtlasAlertConfigurationConfig (orgID , projectName , true )
17
+ resourceName = "mongodbatlas_alert_configuration.test"
18
+ orgID = os .Getenv ("MONGODB_ATLAS_ORG_ID" )
19
+ projectName = acctest .RandomWithPrefix ("test-acc" )
20
+ alert = & matlas.AlertConfiguration {}
21
+ config = testAccMongoDBAtlasAlertConfigurationConfig (orgID , projectName , true )
22
+ lastVersionConstraint = os .Getenv ("MONGODB_ATLAS_LAST_VERSION" )
21
23
)
22
24
23
25
resource .ParallelTest (t , resource.TestCase {
24
- PreCheck : func () { testAccPreCheckBasic (t ) },
26
+ PreCheck : func () { testAccMigrationPreCheckBasic (t ) },
25
27
CheckDestroy : testAccCheckMongoDBAtlasAlertConfigurationDestroy ,
26
28
Steps : []resource.TestStep {
27
29
{
28
30
ExternalProviders : map [string ]resource.ExternalProvider {
29
31
"mongodbatlas" : {
30
- VersionConstraint : "1.11.0" ,
32
+ VersionConstraint : lastVersionConstraint ,
31
33
Source : "mongodb/mongodbatlas" ,
32
34
},
33
35
},
@@ -52,23 +54,24 @@ func TestAccConfigRSAlertConfiguration_Migration_NotificationsWithMetricThreshol
52
54
})
53
55
}
54
56
55
- func TestAccConfigRSAlertConfiguration_Migration_WithThreshold (t * testing.T ) {
57
+ func TestAccMigrationConfigRSAlertConfiguration_WithThreshold (t * testing.T ) {
56
58
var (
57
- resourceName = "mongodbatlas_alert_configuration.test"
58
- orgID = os .Getenv ("MONGODB_ATLAS_ORG_ID" )
59
- projectName = acctest .RandomWithPrefix ("test-acc" )
60
- alert = & matlas.AlertConfiguration {}
61
- config = testAccMongoDBAtlasAlertConfigurationConfigWithThresholdUpdated (orgID , projectName , true , 1 )
59
+ resourceName = "mongodbatlas_alert_configuration.test"
60
+ orgID = os .Getenv ("MONGODB_ATLAS_ORG_ID" )
61
+ projectName = acctest .RandomWithPrefix ("test-acc" )
62
+ alert = & matlas.AlertConfiguration {}
63
+ config = testAccMongoDBAtlasAlertConfigurationConfigWithThresholdUpdated (orgID , projectName , true , 1 )
64
+ lastVersionConstraint = os .Getenv ("MONGODB_ATLAS_LAST_VERSION" )
62
65
)
63
66
64
67
resource .ParallelTest (t , resource.TestCase {
65
- PreCheck : func () { testAccPreCheckBasic (t ) },
68
+ PreCheck : func () { testAccMigrationPreCheckBasic (t ) },
66
69
CheckDestroy : testAccCheckMongoDBAtlasAlertConfigurationDestroy ,
67
70
Steps : []resource.TestStep {
68
71
{
69
72
ExternalProviders : map [string ]resource.ExternalProvider {
70
73
"mongodbatlas" : {
71
- VersionConstraint : "1.11.0" ,
74
+ VersionConstraint : lastVersionConstraint ,
72
75
Source : "mongodb/mongodbatlas" ,
73
76
},
74
77
},
@@ -95,23 +98,24 @@ func TestAccConfigRSAlertConfiguration_Migration_WithThreshold(t *testing.T) {
95
98
})
96
99
}
97
100
98
- func TestAccConfigRSAlertConfiguration_Migration_EmptyOptionalBlocks (t * testing.T ) {
101
+ func TestAccMigrationConfigRSAlertConfiguration_EmptyOptionalBlocks (t * testing.T ) {
99
102
var (
100
- resourceName = "mongodbatlas_alert_configuration.test"
101
- orgID = os .Getenv ("MONGODB_ATLAS_ORG_ID" )
102
- projectName = acctest .RandomWithPrefix ("test-acc" )
103
- alert = & matlas.AlertConfiguration {}
104
- config = testAccMongoDBAtlasAlertConfigurationConfigEmptyOptionalBlocks (orgID , projectName )
103
+ resourceName = "mongodbatlas_alert_configuration.test"
104
+ orgID = os .Getenv ("MONGODB_ATLAS_ORG_ID" )
105
+ projectName = acctest .RandomWithPrefix ("test-acc" )
106
+ alert = & matlas.AlertConfiguration {}
107
+ config = testAccMongoDBAtlasAlertConfigurationConfigEmptyOptionalBlocks (orgID , projectName )
108
+ lastVersionConstraint = os .Getenv ("MONGODB_ATLAS_LAST_VERSION" )
105
109
)
106
110
107
111
resource .ParallelTest (t , resource.TestCase {
108
- PreCheck : func () { testAccPreCheckBasic (t ) },
112
+ PreCheck : func () { testAccMigrationPreCheckBasic (t ) },
109
113
CheckDestroy : testAccCheckMongoDBAtlasAlertConfigurationDestroy ,
110
114
Steps : []resource.TestStep {
111
115
{
112
116
ExternalProviders : map [string ]resource.ExternalProvider {
113
117
"mongodbatlas" : {
114
- VersionConstraint : "1.11.0" ,
118
+ VersionConstraint : lastVersionConstraint ,
115
119
Source : "mongodb/mongodbatlas" ,
116
120
},
117
121
},
@@ -139,7 +143,7 @@ func TestAccConfigRSAlertConfiguration_Migration_EmptyOptionalBlocks(t *testing.
139
143
})
140
144
}
141
145
142
- func TestAccConfigRSAlertConfiguration_Migration_MultipleMatchers (t * testing.T ) {
146
+ func TestAccMigrationConfigRSAlertConfiguration_MultipleMatchers (t * testing.T ) {
143
147
var (
144
148
resourceName = "mongodbatlas_alert_configuration.test"
145
149
orgID = os .Getenv ("MONGODB_ATLAS_ORG_ID" )
@@ -156,16 +160,17 @@ func TestAccConfigRSAlertConfiguration_Migration_MultipleMatchers(t *testing.T)
156
160
Operator : "CONTAINS" ,
157
161
Value : "MONGOS" ,
158
162
})
163
+ lastVersionConstraint = os .Getenv ("MONGODB_ATLAS_LAST_VERSION" )
159
164
)
160
165
161
166
resource .ParallelTest (t , resource.TestCase {
162
- PreCheck : func () { testAccPreCheckBasic (t ) },
167
+ PreCheck : func () { testAccMigrationPreCheckBasic (t ) },
163
168
CheckDestroy : testAccCheckMongoDBAtlasAlertConfigurationDestroy ,
164
169
Steps : []resource.TestStep {
165
170
{
166
171
ExternalProviders : map [string ]resource.ExternalProvider {
167
172
"mongodbatlas" : {
168
- VersionConstraint : "1.11.0" ,
173
+ VersionConstraint : lastVersionConstraint ,
169
174
Source : "mongodb/mongodbatlas" ,
170
175
},
171
176
},
@@ -190,23 +195,24 @@ func TestAccConfigRSAlertConfiguration_Migration_MultipleMatchers(t *testing.T)
190
195
})
191
196
}
192
197
193
- func TestAccConfigRSAlertConfiguration_Migration_EmptyOptionalAttributes (t * testing.T ) {
198
+ func TestAccMigrationConfigRSAlertConfiguration_EmptyOptionalAttributes (t * testing.T ) {
194
199
var (
195
- resourceName = "mongodbatlas_alert_configuration.test"
196
- orgID = os .Getenv ("MONGODB_ATLAS_ORG_ID" )
197
- projectName = acctest .RandomWithPrefix ("test-acc" )
198
- alert = & matlas.AlertConfiguration {}
199
- config = testAccMongoDBAtlasAlertConfigurationConfigWithEmptyOptionalAttributes (orgID , projectName )
200
+ resourceName = "mongodbatlas_alert_configuration.test"
201
+ orgID = os .Getenv ("MONGODB_ATLAS_ORG_ID" )
202
+ projectName = acctest .RandomWithPrefix ("test-acc" )
203
+ alert = & matlas.AlertConfiguration {}
204
+ config = testAccMongoDBAtlasAlertConfigurationConfigWithEmptyOptionalAttributes (orgID , projectName )
205
+ lastVersionConstraint = os .Getenv ("MONGODB_ATLAS_LAST_VERSION" )
200
206
)
201
207
202
208
resource .ParallelTest (t , resource.TestCase {
203
- PreCheck : func () { testAccPreCheckBasic (t ) },
209
+ PreCheck : func () { testAccMigrationPreCheckBasic (t ) },
204
210
CheckDestroy : testAccCheckMongoDBAtlasAlertConfigurationDestroy ,
205
211
Steps : []resource.TestStep {
206
212
{
207
213
ExternalProviders : map [string ]resource.ExternalProvider {
208
214
"mongodbatlas" : {
209
- VersionConstraint : "1.11.0" ,
215
+ VersionConstraint : lastVersionConstraint ,
210
216
Source : "mongodb/mongodbatlas" ,
211
217
},
212
218
},
0 commit comments