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 end to end tests to the "createCommandCmdF" mmctl command #15816

Open
mgdelacroix opened this issue Oct 6, 2020 · 3 comments
Open

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

mgdelacroix opened this issue Oct 6, 2020 · 3 comments

Comments

@mgdelacroix
Copy link
Member

mgdelacroix commented Oct 6, 2020

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
Copy link

/assign

@mgdelacroix
Copy link
Member Author

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

@isacikgoz
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants