Skip to content

Commit 46c04ca

Browse files
authored
CLOUDP-263807: process disabled flag (#3134)
1 parent b50a762 commit 46c04ca

File tree

2 files changed

+62
-2
lines changed

2 files changed

+62
-2
lines changed

internal/convert/automation_config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ func FromAutomationConfig(c *opsmngr.AutomationConfig) []*ClusterConfig {
4848
p := c.Processes[k]
4949
if p.Name == m.Host {
5050
newRS.Processes[j] = newReplicaSetProcessConfig(&rs.Members[j], p)
51+
newRS.Processes[j].Disabled = p.Disabled
5152
newRS.addToMongoURI(p)
5253
c.Processes = removeProcess(c.Processes, k)
5354
}

internal/convert/automation_config_test.go

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ import (
2626

2727
func TestFromAutomationConfig(t *testing.T) {
2828
name := "cluster_1"
29+
pName := name + "_0"
2930
fipsMode := true
30-
t.Run("replica set", func(t *testing.T) {
31+
t.Run("replica set all enabled", func(t *testing.T) {
3132
t.Parallel()
3233
config := fixture.AutomationConfigWithOneReplicaSet(name, false)
3334
expected := []*ClusterConfig{
@@ -54,7 +55,65 @@ func TestFromAutomationConfig(t *testing.T) {
5455
Votes: pointer.Get[float64](1),
5556
FeatureCompatibilityVersion: "4.2",
5657
Version: "4.2.2",
57-
Name: name + "_0",
58+
Name: pName,
59+
OplogSizeMB: pointer.Get(10),
60+
TLS: &TLS{
61+
CAFile: "CAFile",
62+
CertificateKeyFile: "CertificateKeyFile",
63+
CertificateKeyFilePassword: "CertificateKeyFilePassword",
64+
CertificateSelector: "CertificateSelector",
65+
ClusterCertificateSelector: "ClusterCertificateSelector",
66+
ClusterFile: "ClusterFile",
67+
ClusterPassword: "ClusterPassword",
68+
CRLFile: "CRLFile",
69+
DisabledProtocols: "DisabledProtocols",
70+
FIPSMode: &fipsMode,
71+
Mode: "Mode",
72+
PEMKeyFile: "PEMKeyFile",
73+
},
74+
Security: &map[string]interface{}{
75+
"test": "test",
76+
},
77+
},
78+
},
79+
},
80+
MongoURI: "mongodb://host0:27017",
81+
},
82+
}
83+
84+
result := FromAutomationConfig(config)
85+
if diff := deep.Equal(result, expected); diff != nil {
86+
t.Error(diff)
87+
}
88+
})
89+
t.Run("replica set with disabled members", func(t *testing.T) {
90+
t.Parallel()
91+
config := fixture.AutomationConfigWithOneReplicaSet(name, true)
92+
expected := []*ClusterConfig{
93+
{
94+
RSConfig: RSConfig{
95+
Name: name,
96+
Processes: []*ProcessConfig{
97+
{
98+
ArbiterOnly: pointer.Get(false),
99+
BuildIndexes: pointer.Get(true),
100+
DBPath: "/data/db/",
101+
Disabled: true,
102+
Hidden: pointer.Get(false),
103+
Hostname: "host0",
104+
LogPath: "/data/db/mongodb.log",
105+
LogDestination: file,
106+
AuditLogDestination: file,
107+
AuditLogPath: "/data/db/audit.log",
108+
Port: 27017,
109+
Priority: pointer.Get[float64](1),
110+
ProcessType: mongod,
111+
SlaveDelay: pointer.Get[float64](1),
112+
SecondaryDelaySecs: pointer.Get[float64](1),
113+
Votes: pointer.Get[float64](1),
114+
FeatureCompatibilityVersion: "4.2",
115+
Version: "4.2.2",
116+
Name: pName,
58117
OplogSizeMB: pointer.Get(10),
59118
TLS: &TLS{
60119
CAFile: "CAFile",

0 commit comments

Comments
 (0)