Skip to content

Commit 535a60b

Browse files
committed
fix: initial pass into enabling tagliatelle
1 parent b5c20fe commit 535a60b

File tree

9 files changed

+317
-317
lines changed

9 files changed

+317
-317
lines changed

e2e/cloud_manager/helper_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ func generateRSConfig(filename, hostname, clusterName, version, fcVersion string
9898

9999
downloadArchive := &convert.ClusterConfig{
100100
RSConfig: convert.RSConfig{
101-
FCVersion: fcVersion,
102-
Name: clusterName,
103-
Version: version,
104-
ProcessConfigs: []*convert.ProcessConfig{
101+
FeatureCompatibilityVersion: fcVersion,
102+
Name: clusterName,
103+
Version: version,
104+
Processes: []*convert.ProcessConfig{
105105
{
106106
DBPath: fmt.Sprintf("/data/%s/27000", clusterName),
107107
Hostname: hostname,
@@ -165,13 +165,13 @@ func generateShardedConfig(filename, hostname, clusterName, version, fcVersion s
165165

166166
downloadArchive := &convert.ClusterConfig{
167167
RSConfig: convert.RSConfig{
168-
FCVersion: fcVersion,
169-
Name: clusterName,
170-
Version: version,
168+
FeatureCompatibilityVersion: fcVersion,
169+
Name: clusterName,
170+
Version: version,
171171
},
172172
Config: &convert.RSConfig{
173173
Name: "configRS",
174-
ProcessConfigs: []*convert.ProcessConfig{
174+
Processes: []*convert.ProcessConfig{
175175
{
176176
DBPath: fmt.Sprintf("/data/%s/29000", clusterName),
177177
Hostname: hostname,
@@ -229,7 +229,7 @@ func generateShardedConfig(filename, hostname, clusterName, version, fcVersion s
229229
Shards: []*convert.RSConfig{
230230
{
231231
Name: "myShard_0",
232-
ProcessConfigs: []*convert.ProcessConfig{
232+
Processes: []*convert.ProcessConfig{
233233
{
234234
DBPath: fmt.Sprintf("/data/%s/27000", clusterName),
235235
Hostname: hostname,
@@ -279,7 +279,7 @@ func generateShardedConfig(filename, hostname, clusterName, version, fcVersion s
279279
},
280280
{
281281
Name: "myShard_1",
282-
ProcessConfigs: []*convert.ProcessConfig{
282+
Processes: []*convert.ProcessConfig{
283283
{
284284
DBPath: fmt.Sprintf("/data/%s/28000", clusterName),
285285
Hostname: hostname,

internal/convert/automation_config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func FromAutomationConfig(c *opsmngr.AutomationConfig) []*ClusterConfig {
4646
for j, m := range rs.Members {
4747
for k, p := range c.Processes {
4848
if p.Name == m.Host {
49-
newRS.ProcessConfigs[j] = newReplicaSetProcessConfig(m, p)
49+
newRS.Processes[j] = newReplicaSetProcessConfig(m, p)
5050
newRS.addToMongoURI(p)
5151
c.Processes = removeProcess(c.Processes, k)
5252
break

internal/convert/automation_config_test.go

Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -33,28 +33,28 @@ func TestFromAutomationConfig(t *testing.T) {
3333
{
3434
RSConfig: RSConfig{
3535
Name: name,
36-
ProcessConfigs: []*ProcessConfig{
36+
Processes: []*ProcessConfig{
3737
{
38-
ArbiterOnly: pointy.Bool(false),
39-
BuildIndexes: pointy.Bool(true),
40-
DBPath: "/data/db/",
41-
Disabled: false,
42-
Hidden: pointy.Bool(false),
43-
Hostname: "host0",
44-
LogPath: "/data/db/mongodb.log",
45-
LogDestination: file,
46-
AuditLogDestination: file,
47-
AuditLogPath: "/data/db/audit.log",
48-
Port: 27017,
49-
Priority: pointy.Float64(1),
50-
ProcessType: mongod,
51-
SlaveDelay: pointy.Float64(1),
52-
SecondaryDelaySecs: pointy.Float64(1),
53-
Votes: pointy.Float64(1),
54-
FCVersion: "4.2",
55-
Version: "4.2.2",
56-
Name: name + "_0",
57-
OplogSizeMB: pointy.Int(10),
38+
ArbiterOnly: pointy.Bool(false),
39+
BuildIndexes: pointy.Bool(true),
40+
DBPath: "/data/db/",
41+
Disabled: false,
42+
Hidden: pointy.Bool(false),
43+
Hostname: "host0",
44+
LogPath: "/data/db/mongodb.log",
45+
LogDestination: file,
46+
AuditLogDestination: file,
47+
AuditLogPath: "/data/db/audit.log",
48+
Port: 27017,
49+
Priority: pointy.Float64(1),
50+
ProcessType: mongod,
51+
SlaveDelay: pointy.Float64(1),
52+
SecondaryDelaySecs: pointy.Float64(1),
53+
Votes: pointy.Float64(1),
54+
FeatureCompatibilityVersion: "4.2",
55+
Version: "4.2.2",
56+
Name: name + "_0",
57+
OplogSizeMB: pointy.Int(10),
5858
TLS: &TLS{
5959
CAFile: "CAFile",
6060
CertificateKeyFile: "CertificateKeyFile",
@@ -96,64 +96,64 @@ func TestFromAutomationConfig(t *testing.T) {
9696
Shards: []*RSConfig{
9797
{
9898
Name: "myShard_0",
99-
ProcessConfigs: []*ProcessConfig{
99+
Processes: []*ProcessConfig{
100100
{
101-
ArbiterOnly: pointy.Bool(false),
102-
BuildIndexes: pointy.Bool(true),
103-
DBPath: "/data/myShard_0",
104-
Disabled: false,
105-
Hidden: pointy.Bool(false),
106-
Hostname: "example",
107-
LogPath: "/log/myShard_0",
108-
LogDestination: file,
109-
Port: 1,
110-
Priority: pointy.Float64(1),
111-
ProcessType: mongod,
112-
SlaveDelay: pointy.Float64(1),
113-
SecondaryDelaySecs: pointy.Float64(1),
114-
Votes: pointy.Float64(1),
115-
FCVersion: "4.2",
116-
Version: "4.2.2",
117-
Name: name + "_myShard_0_0",
101+
ArbiterOnly: pointy.Bool(false),
102+
BuildIndexes: pointy.Bool(true),
103+
DBPath: "/data/myShard_0",
104+
Disabled: false,
105+
Hidden: pointy.Bool(false),
106+
Hostname: "example",
107+
LogPath: "/log/myShard_0",
108+
LogDestination: file,
109+
Port: 1,
110+
Priority: pointy.Float64(1),
111+
ProcessType: mongod,
112+
SlaveDelay: pointy.Float64(1),
113+
SecondaryDelaySecs: pointy.Float64(1),
114+
Votes: pointy.Float64(1),
115+
FeatureCompatibilityVersion: "4.2",
116+
Version: "4.2.2",
117+
Name: name + "_myShard_0_0",
118118
},
119119
},
120120
},
121121
},
122122
Config: &RSConfig{
123123
Name: "configRS",
124-
ProcessConfigs: []*ProcessConfig{
124+
Processes: []*ProcessConfig{
125125
{
126-
ArbiterOnly: pointy.Bool(false),
127-
BuildIndexes: pointy.Bool(true),
128-
DBPath: "/data/configRS",
129-
Disabled: false,
130-
Hidden: pointy.Bool(false),
131-
Hostname: "example",
132-
LogPath: "/log/configRS",
133-
LogDestination: file,
134-
Port: 2,
135-
Priority: pointy.Float64(1),
136-
ProcessType: mongod,
137-
SlaveDelay: pointy.Float64(1),
138-
SecondaryDelaySecs: pointy.Float64(1),
139-
Votes: pointy.Float64(1),
140-
FCVersion: "4.2",
141-
Version: "4.2.2",
142-
Name: name + "_configRS_1",
126+
ArbiterOnly: pointy.Bool(false),
127+
BuildIndexes: pointy.Bool(true),
128+
DBPath: "/data/configRS",
129+
Disabled: false,
130+
Hidden: pointy.Bool(false),
131+
Hostname: "example",
132+
LogPath: "/log/configRS",
133+
LogDestination: file,
134+
Port: 2,
135+
Priority: pointy.Float64(1),
136+
ProcessType: mongod,
137+
SlaveDelay: pointy.Float64(1),
138+
SecondaryDelaySecs: pointy.Float64(1),
139+
Votes: pointy.Float64(1),
140+
FeatureCompatibilityVersion: "4.2",
141+
Version: "4.2.2",
142+
Name: name + "_configRS_1",
143143
},
144144
},
145145
},
146146
Mongos: []*ProcessConfig{
147147
{
148-
Disabled: false,
149-
Hostname: "example",
150-
LogPath: "/log/mongos",
151-
LogDestination: file,
152-
Port: 3,
153-
ProcessType: "mongos",
154-
FCVersion: "4.2",
155-
Version: "4.2.2",
156-
Name: name + "_mongos_2",
148+
Disabled: false,
149+
Hostname: "example",
150+
LogPath: "/log/mongos",
151+
LogDestination: file,
152+
Port: 3,
153+
ProcessType: "mongos",
154+
FeatureCompatibilityVersion: "4.2",
155+
Version: "4.2.2",
156+
Name: name + "_mongos_2",
157157
},
158158
},
159159
},

internal/convert/cluster_config.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type ClusterConfig struct {
4545
func newReplicaSetCluster(name string, s int) *ClusterConfig {
4646
rs := &ClusterConfig{}
4747
rs.Name = name
48-
rs.ProcessConfigs = make([]*ProcessConfig, s)
48+
rs.Processes = make([]*ProcessConfig, s)
4949

5050
return rs
5151
}
@@ -65,13 +65,13 @@ func newShardedCluster(s *opsmngr.ShardingConfig) *ClusterConfig {
6565
// this method will modify the given AutomationConfig to add the new replica set or sharded cluster information.
6666
func (c *ClusterConfig) PatchAutomationConfig(out *opsmngr.AutomationConfig) error {
6767
// A replica set should be just a list of processes
68-
if c.ProcessConfigs != nil && c.Mongos == nil && c.Shards == nil && c.Config == nil {
68+
if c.Processes != nil && c.Mongos == nil && c.Shards == nil && c.Config == nil {
6969
return c.patchReplicaSet(out)
7070
}
7171
// a sharded cluster will be a list of mongos (processes),
7272
// shards, each with a list of process (replica sets)
7373
// one (1) config server, with a list of process (replica set)
74-
if c.ProcessConfigs == nil && c.Mongos != nil && c.Shards != nil && c.Config != nil {
74+
if c.Processes == nil && c.Mongos != nil && c.Shards != nil && c.Config != nil {
7575
return c.patchSharding(out)
7676
}
7777

@@ -83,14 +83,14 @@ func (c *ClusterConfig) patchSharding(out *opsmngr.AutomationConfig) error {
8383
// transform cli config to automation config
8484
for i, s := range c.Shards {
8585
s.Version = c.Version
86-
s.FCVersion = c.FCVersion
86+
s.FeatureCompatibilityVersion = c.FeatureCompatibilityVersion
8787
if err := s.patchShard(out, c.Name); err != nil {
8888
return err
8989
}
9090
newCluster.Shards[i] = newShard(s)
9191
}
9292
c.Config.Version = c.Version
93-
c.Config.FCVersion = c.FCVersion
93+
c.Config.FeatureCompatibilityVersion = c.FeatureCompatibilityVersion
9494
if err := c.Config.patchConfigServer(out, c.Name); err != nil {
9595
return err
9696
}

internal/convert/cluster_config_test.go

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ func TestClusterConfig_PatchAutomationConfig(t *testing.T) {
3535
current: fixture.EmptyAutomationConfig(),
3636
changes: &ClusterConfig{
3737
RSConfig: RSConfig{
38-
FCVersion: "4.2",
39-
Name: "test_config",
40-
Version: "4.2.2",
41-
ProcessConfigs: []*ProcessConfig{
38+
FeatureCompatibilityVersion: "4.2",
39+
Name: "test_config",
40+
Version: "4.2.2",
41+
Processes: []*ProcessConfig{
4242
{
4343
DBPath: "/data",
4444
Hostname: "example",
@@ -113,10 +113,10 @@ func TestClusterConfig_PatchAutomationConfig(t *testing.T) {
113113
current: fixture.AutomationConfigWithOneReplicaSet("replica_set_1", false),
114114
changes: &ClusterConfig{
115115
RSConfig: RSConfig{
116-
FCVersion: "4.2",
117-
Name: "test_config",
118-
Version: "4.2.2",
119-
ProcessConfigs: []*ProcessConfig{
116+
FeatureCompatibilityVersion: "4.2",
117+
Name: "test_config",
118+
Version: "4.2.2",
119+
Processes: []*ProcessConfig{
120120
{
121121
DBPath: "/data",
122122
Hostname: "example",
@@ -284,10 +284,10 @@ func TestClusterConfig_PatchAutomationConfig(t *testing.T) {
284284
current: fixture.AutomationConfigWithOneReplicaSet("replica_set_1", false),
285285
changes: &ClusterConfig{
286286
RSConfig: RSConfig{
287-
FCVersion: "4.2",
288-
Name: "replica_set_1",
289-
Version: "4.2.2",
290-
ProcessConfigs: []*ProcessConfig{
287+
FeatureCompatibilityVersion: "4.2",
288+
Name: "replica_set_1",
289+
Version: "4.2.2",
290+
Processes: []*ProcessConfig{
291291
{
292292
DBPath: "/data/db/",
293293
Hostname: "host0",
@@ -414,10 +414,10 @@ func TestClusterConfig_PatchAutomationConfig(t *testing.T) {
414414
current: fixture.AutomationConfigWithOneReplicaSet("replica_set_1", false),
415415
changes: &ClusterConfig{
416416
RSConfig: RSConfig{
417-
FCVersion: "4.2",
418-
Name: "replica_set_1",
419-
Version: "4.2.2",
420-
ProcessConfigs: []*ProcessConfig{
417+
FeatureCompatibilityVersion: "4.2",
418+
Name: "replica_set_1",
419+
Version: "4.2.2",
420+
Processes: []*ProcessConfig{
421421
{
422422
DBPath: "/data/db/",
423423
Hostname: "host1",
@@ -536,14 +536,14 @@ func TestClusterConfig_PatchAutomationConfig(t *testing.T) {
536536
current: fixture.EmptyAutomationConfig(),
537537
changes: &ClusterConfig{
538538
RSConfig: RSConfig{
539-
FCVersion: "4.2",
540-
Name: "test_config",
541-
Version: "4.2.2",
539+
FeatureCompatibilityVersion: "4.2",
540+
Name: "test_config",
541+
Version: "4.2.2",
542542
},
543543
Shards: []*RSConfig{
544544
{
545545
Name: "myShard_0",
546-
ProcessConfigs: []*ProcessConfig{
546+
Processes: []*ProcessConfig{
547547
{
548548
DBPath: "/data/myShard_0",
549549
Hostname: "example",
@@ -557,7 +557,7 @@ func TestClusterConfig_PatchAutomationConfig(t *testing.T) {
557557
},
558558
Config: &RSConfig{
559559
Name: "configRS",
560-
ProcessConfigs: []*ProcessConfig{
560+
Processes: []*ProcessConfig{
561561
{
562562
DBPath: "/data/configRS",
563563
Hostname: "example",
@@ -713,15 +713,15 @@ func TestClusterConfig_PatchAutomationConfig(t *testing.T) {
713713
current: fixture.AutomationConfigWithOneShardedCluster("test_config", false),
714714
changes: &ClusterConfig{
715715
RSConfig: RSConfig{
716-
FCVersion: "4.2",
717-
Name: "test_config",
718-
Version: "4.2.2",
716+
FeatureCompatibilityVersion: "4.2",
717+
Name: "test_config",
718+
Version: "4.2.2",
719719
},
720720
Shards: []*RSConfig{
721721
// Old
722722
{
723723
Name: "myShard_0",
724-
ProcessConfigs: []*ProcessConfig{
724+
Processes: []*ProcessConfig{
725725
{
726726
DBPath: "/data/myShard_0",
727727
Hostname: "example",
@@ -735,7 +735,7 @@ func TestClusterConfig_PatchAutomationConfig(t *testing.T) {
735735
// New
736736
{
737737
Name: "myShard_1",
738-
ProcessConfigs: []*ProcessConfig{
738+
Processes: []*ProcessConfig{
739739
{
740740
DBPath: "/data/myShard_1",
741741
Hostname: "example",
@@ -749,7 +749,7 @@ func TestClusterConfig_PatchAutomationConfig(t *testing.T) {
749749
},
750750
Config: &RSConfig{
751751
Name: "configRS",
752-
ProcessConfigs: []*ProcessConfig{
752+
Processes: []*ProcessConfig{
753753
{
754754
DBPath: "/data/configRS",
755755
Hostname: "example",

0 commit comments

Comments
 (0)