[MM-51330] - Sentry Crash: nil pointer dereference in getSelfHostedProducts (#22569)

* [MM-51330] - Sentry Crash: nil pointer dereference in getSelfHostedProducts

* feedback impl

* fix bool

* remove double check

* fix failing tests

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Allan Guwatudde
2023-03-29 18:11:45 +03:00
коммит произвёл GitHub
родитель c78d6d47ac
Коммит c70d85c9bc
3 изменённых файлов: 122 добавлений и 7 удалений

Просмотреть файл

@@ -20,6 +20,15 @@ func Test_getCloudLimits(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
cloud := &mocks.CloudInterface{}
cloud.Mock.On("GetCloudLimits", mock.Anything).Return(nil, errors.New("Unable to get limits"))
cloudImpl := th.App.Srv().Cloud
defer func() {
th.App.Srv().Cloud = cloudImpl
}()
th.App.Srv().Cloud = cloud
th.App.Srv().RemoveLicense()
th.Client.Login(th.BasicUser.Email, th.BasicUser.Password)
@@ -34,6 +43,15 @@ func Test_getCloudLimits(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
cloud := &mocks.CloudInterface{}
cloud.Mock.On("GetCloudLimits", mock.Anything).Return(nil, errors.New("Unable to get limits"))
cloudImpl := th.App.Srv().Cloud
defer func() {
th.App.Srv().Cloud = cloudImpl
}()
th.App.Srv().Cloud = cloud
th.App.Srv().SetLicense(model.NewTestLicense())
th.Client.Login(th.BasicUser.Email, th.BasicUser.Password)