Skip to content

Commit

Permalink
[MM-61693] Only check for LDAP info if LDAP is enabled during Support…
Browse files Browse the repository at this point in the history
… Packet generation (mattermost#29185)
  • Loading branch information
hanzei authored Nov 20, 2024
1 parent b986f39 commit 11b66de
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/channels/app/support_packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func (a *App) generateSupportPacketYaml(c request.CTX) (*model.FileData, error)
/* LDAP */

var vendorName, vendorVersion string
if ldap := a.Ldap(); ldap != nil {
if ldap := a.Ldap(); ldap != nil && (*a.Config().LdapSettings.Enable || *a.Config().LdapSettings.EnableSync) {
vendorName, vendorVersion, err = ldap.GetVendorNameAndVendorVersion(c)
if err != nil {
rErr = multierror.Append(errors.Wrap(err, "error while getting LDAP vendor info"))
Expand Down
16 changes: 15 additions & 1 deletion server/channels/app/support_packet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,21 @@ func TestGenerateSupportPacketYaml(t *testing.T) {
assert.Equal(t, "FAIL: all broken", packet.FileStatus)
})

t.Run("no LDAP vendor info", func(t *testing.T) {
t.Run("no LDAP info if LDAP sync is disabled", func(t *testing.T) {
ldapMock := &emocks.LdapInterface{}
th.App.Channels().Ldap = ldapMock

packet := generateSupportPacket(t)

assert.Equal(t, "", packet.LdapVendorName)
assert.Equal(t, "", packet.LdapVendorVersion)
})

th.App.UpdateConfig(func(cfg *model.Config) {
cfg.LdapSettings.EnableSync = model.NewPointer(true)
})

t.Run("no LDAP vendor info found", func(t *testing.T) {
ldapMock := &emocks.LdapInterface{}
ldapMock.On(
"GetVendorNameAndVendorVersion",
Expand Down

0 comments on commit 11b66de

Please sign in to comment.