-
Notifications
You must be signed in to change notification settings - Fork 213
Expand file tree
/
Copy pathresource_compatibility_test.go
More file actions
42 lines (38 loc) · 969 Bytes
/
resource_compatibility_test.go
File metadata and controls
42 lines (38 loc) · 969 Bytes
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
package advancedcluster_test
import (
"testing"
"github.com/mongodb/terraform-provider-mongodbatlas/internal/service/advancedcluster"
"github.com/stretchr/testify/assert"
)
func TestAdvancedCluster_ShouldUsePreviousMongoDBMajorVersion(t *testing.T) {
testCases := []struct {
name string
before string
after string
expected bool
}{
{
name: "keeps previous version when only formatting differs",
before: "8",
after: "8.0",
expected: true,
},
{
name: "uses API value when major version actually changed",
before: "7.0",
after: "8.0",
expected: false,
},
{
name: "keeps previous version when minor version differs within same major",
before: "8.0",
after: "8.2",
expected: true,
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
assert.Equal(t, tc.expected, advancedcluster.ShouldUsePreviousMongoDBMajorVersion(tc.before, tc.after))
})
}
}