mattermost / mattermost

Mattermost is an open source platform for secure collaboration across the entire software development lifecycle..
https://mattermost.com
Other
30.84k stars 7.4k forks source link

Add end to end tests to the "createCommandCmdF" mmctl command #15816

Open mgdelacroix opened 4 years ago

mgdelacroix commented 4 years ago

Mattermost is increasing the end to end test coverage for the mmctl CLI tool. The goal is to create a suite of tests that check the main logic paths of each command and ensure that they work against a running server.

This Help Wanted issue covers the addition of end to end tests to the createCommandCmdF command, in the commands/command.go file. The expected way to add these tests is to create a test function in the commands/command_e2e_test.go file and add one s.Run block for each possible test case.

Thanks to the good amount of already existing unit tests that the commands have, it is not necessary to write an end to end test for every possible logic path of the command; the main focus should be in covering the happy path, the error path and the cases where the user doesn't have permissions to perform an action.

To help with the test process, there are some helpers that can be used. The s.SetupTestHelper().InitBasic() chain will create a set of default users, teams and channels to be used during the tests, s.RunForAllClients is useful when a test case should be valid for a sysadmin user, a local mode user and an unprivileged user, and s.RunForSystemAdminAndLocal will test a block for both a sysadmin user and a local mode user. Please take a look at the example pull request to see how all these work.

Example: mattermost/mmctl#202

For instructions on how to set up the end to end tests, take a look at the corresponding section of the mmctl README.

If you have questions about the ticket or you need any help, feel free to post your question in the community CLI channel or contact miguel.delacruz in https://community.mattermost.com/


If you're interested please comment here and come join our "Contributors" community channel on our daily build server, where you can discuss questions with community members and the Mattermost core team. For technical advice or questions, please join our "Developers" community channel.

New contributors please see our Developer's Guide.

JIRA: https://mattermost.atlassian.net/browse/MM-29341

m3talsmith commented 4 years ago

/assign

mgdelacroix commented 3 years ago

Hi @m3talsmith! Are you still planning to work on this issue? Is there anything we can help with?

isacikgoz commented 3 years ago

Hey @m3talsmith! Let us know if you need anything, we'd be happy to help :)