Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Channel bookmarks to loadtest #828

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Add Channel bookmarks to loadtest #828

wants to merge 10 commits into from

Conversation

enahum
Copy link

@enahum enahum commented Oct 14, 2024

Summary

This PR adds some actions for the Channel Bookmarks feature

Ticket Link

https://mattermost.atlassian.net/browse/MM-59997

@enahum enahum added the 2: Dev Review Requires review by a core committer label Oct 14, 2024
@agnivade agnivade requested review from agarciamontoro and removed request for streamer45 October 14, 2024 14:06
Copy link
Member

@agnivade agnivade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work on this Elias. Really appreciate this PR.

I've left a few comments to make them more consistent with how we add feature coverage.

Totally understand this is not where you usually contribute code, so things might not be very familiar. Me or Alejandro are happy to fix things ourselves if it gets too difficult. I think most of the stuff is nearly done, just some small things to fix here and there.

Comment on lines 36 to 37
maxUsers := 10000
mmCfg.TeamSettings.MaxUsersPerTeam = &maxUsers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohhh my dear ..

https://hub.mattermost.com/private-core/pl/hih74enmn7bwunmy6eamgct67r

Let's fix it everywhere else as well :)

I also mentioned this additionally in the dev meeting, but probably I could have done a better job.

@@ -220,7 +220,7 @@ func collect(config deployment.Config, deploymentId string, outputName string) e
if err := json.Unmarshal(input, &cfg); err != nil {
return nil, fmt.Errorf("failed to unmarshal MM configuration: %w", err)
}
cfg.Sanitize()
cfg.Sanitize([]*model.Manifest{})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can just be nil

loadtest/control/simulcontroller/bookmarks.go Show resolved Hide resolved
@@ -264,6 +264,30 @@ func getActionList(c *SimulController) []userAction {
frequency: 1.41,
minServerVersion: control.MinSupportedVersion, // 7.7.0
},
{
name: "AddChannelBookmark",
run: c.AddChannelBookmark,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small thing: we don't export the method names for the actions. Let's unexport them.

{
name: "AddChannelBookmark",
run: c.AddChannelBookmark,
frequency: 0.0003,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes and no.. basically following the frequency we get 0 as the value, now the reality is we have customers that based on their feedback they will rely on this feature way more than what we do on community and/or hub, thus giving it a bit of a bump.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have typically taken data from our large cloud customer, not community/hub. I realize that it's not enabled in cloud yet, but that is the process we follow. It is fine to work with estimates for now, but we should track this future update in the ticket and paste the link in a comment.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess in this case once deployed we can actually ask p1 instead out largest cloud customer as they will be the one using the feature the most, at least that is my understanding

currentBookmarks := u.Store().ChannelBookmarks(channel.Id)
if len(currentBookmarks) > 0 {
bookmark := currentBookmarks[rand.Intn(len(currentBookmarks))]
if bookmark != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above

}
}

return control.UserActionResponse{Info: "no channel bookmarks deleted"}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a better string would be "no channel bookmarks found"?

Comment on lines 294 to 300
filenames := []string{"test_upload.png", "test_upload.jpg", "test_upload.mp4", "test_upload.txt"}
file := filenames[rand.Intn(len(filenames))]
data := MustAsset(file)
resp, err := u.UploadFile(data, bookmark.ChannelId, file)
if err != nil {
return err
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this logic can be refactored into _attachFilesToObj with a little bit of work to simply upload a single file. And then we can just call _attachFilesToObj(u, bookmark.ChannelId, 1).

Comment on lines 11 to 14
_, err := ue.getUserFromStore()
if err != nil {
return err
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is necessary here, or in any of the methods. We can remove this.

loadtest/store/memstore/store.go Show resolved Hide resolved
@enahum enahum requested a review from agnivade October 16, 2024 09:03
Copy link
Member

@agnivade agnivade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done. Left a small comment, but non-blocking.

Comment on lines 314 to 317
upload := rand.Intn(2) == 0 && qtyToUpload > count
if upload {
count += 1
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if it would be simpler to break it into two?

upload := rand.Intn(2) == 0
if upload {
	count += 1
}
files[filename] = &file{
	data:   MustAsset(filename),
	upload: upload,
}
if count == qtyToUpload {
  break
}

@agnivade
Copy link
Member

@agarciamontoro - please take a look whenever.

Copy link
Member

@agarciamontoro agarciamontoro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for this PR, @enahum, really appreciate all the work! I've left a bunch of comments, mostly nits, but this is fantastic!

go.mod Show resolved Hide resolved
loadtest/control/actions.go Outdated Show resolved Hide resolved
loadtest/control/simulcontroller/bookmarks.go Show resolved Hide resolved
loadtest/control/simulcontroller/bookmarks.go Outdated Show resolved Hide resolved
loadtest/control/simulcontroller/bookmarks.go Outdated Show resolved Hide resolved
loadtest/control/utils.go Outdated Show resolved Hide resolved
loadtest/store/memstore/store.go Outdated Show resolved Hide resolved
loadtest/store/memstore/store.go Outdated Show resolved Hide resolved
loadtest/user/userentity/actions.go Outdated Show resolved Hide resolved
loadtest/user/userentity/bookmarks.go Show resolved Hide resolved
Copy link
Member

@agarciamontoro agarciamontoro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for addressing all my nits, @enahum! Something that was missed and I think we're good to go :)

loadtest/control/utils.go Outdated Show resolved Hide resolved
loadtest/control/utils.go Outdated Show resolved Hide resolved
Copy link
Member

@agarciamontoro agarciamontoro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Thank you!

@agarciamontoro agarciamontoro added 3: QA Review Requires review by a QA tester and removed 2: Dev Review Requires review by a core committer labels Oct 24, 2024
@agarciamontoro
Copy link
Member

@DHaussermann, do you have some spare cycles to test a simple deployment with this version to double-check all is good?

@DHaussermann
Copy link
Contributor

DHaussermann commented Oct 25, 2024

@agarciamontoro Sorry, I only intened to add myself as a reviewer to get this visible in my GitHub work queue. I accidentally requested yours too 🤦

Copy link
Member

@agarciamontoro agarciamontoro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, no worries! Approved again 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3: QA Review Requires review by a QA tester
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants