Skip to content
This repository was archived by the owner on Dec 12, 2025. It is now read-only.
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
4 changes: 2 additions & 2 deletions pkg/agent/replica_set_port_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (r *ReplicaSetPortManager) calculateExpectedPorts() (processPortMap map[str
for _, podState := range r.currentPodStates {
if !podState.ReachedGoalState {
r.log.Debugf("Port change required but not all pods reached goal state, abandoning port change")
return processPortMap, portChangeRequired, oldPort
return processPortMap, true, oldPort
}
}

Expand All @@ -143,5 +143,5 @@ func (r *ReplicaSetPortManager) calculateExpectedPorts() (processPortMap map[str
}
}

return processPortMap, portChangeRequired, oldPort
return processPortMap, true, oldPort
}
18 changes: 14 additions & 4 deletions test/e2e/util/mongotester/mongotester.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,14 +307,24 @@ func (m *Tester) WaitForRotatedCertificate(mdb mdbv1.MongoDBCommunity, initialCe
}
}

// EnsureMongodConfig is mostly used for checking port changes. Port changes take some until they finish.
// We cannot fully rely on the statefulset or resource being ready/running since it will change its state multiple
// times during a port change. That means a resource might leave, go into and leave running multiple times until
// it truly finished its port change.
func (m *Tester) EnsureMongodConfig(selector string, expected interface{}) func(*testing.T) {
return func(t *testing.T) {
opts, err := m.getCommandLineOptions()
connectivityOpts := defaults()
err := wait.Poll(connectivityOpts.IntervalTime, connectivityOpts.TimeoutTime, func() (done bool, err error) {
opts, err := m.getCommandLineOptions()
assert.NoError(t, err)

parsed := objx.New(bsonToMap(opts)).Get("parsed").ObjxMap()

return expected == parsed.Get(selector).Data(), nil
})

assert.NoError(t, err)

// The options are stored under the key "parsed"
parsed := objx.New(bsonToMap(opts)).Get("parsed").ObjxMap()
assert.Equal(t, expected, parsed.Get(selector).Data())
}
}

Expand Down