Commit Graph

366 Commits

Author SHA1 Message Date
Jesús Espino
7c3e651a7b Not skiping tests on commands, and removing unnecesary main_test.go files (#14032) 2020-03-11 16:25:45 +01:00
Jesús Espino
27d536b212 MM-21552: Adding SaveMultiple to posts (#13766)
* Adding SaveMultiple to posts

* Improving tests

* fixing i18n

* Fixing tests

* Improving testing on top of Save and SaveMultiple

* Fixing shadow variables

* Addressing some PR comments

* More clear update post test

* Addressing some PR comments

* Addressing some PR comments and simplifying the code

* Improting replies in bulk too

* Fixing reply count and processing last imported replies

* Adding OverwriteMultiple to posts aggregating everything in the same transaction

* Adding 2 pending tests to implement

* Adding tests for overwrite multiple posts

* Adding tests for TeamStore.GetByNames method

* Fixing shadow variables

* Addressing PR comments

* Extracting i18n strings

* Fixing tests

* Fixing tests

* Adding more test cases

* Using a variable instead of a fake timestamp
2020-03-11 14:29:32 +01:00
Jesús Espino
7035e09fe9 Adding changes to separate unit tests and integration tests (#13670)
* Introducing unit (not integration) tests for the app layer

* Initial support for unit tests at the API

* Adding unit tests support to the store layer

* Add unit tests support in commands

* Adding last tests needed for run unit tests properly

* Fixing govet

* Removing some duplication

* Fixing tests

* Fixing tests

* Not compiling test helpers with the main module for api

* Revert "Not compiling test helpers with the main module for api"

This reverts commit 36a199bbe0.

* Fixing tests

* Fixing unit tests

* More consistency between api4/apiteslib.go and app/helper_test.go

* Renaming things to make more obvious the new Setup functions purpose

* Reverting change in go.sum

* Start with empty mock for app layer

* Start with empty mock for api layer

* Start with empty mock for web layer

* Renaming SetupWithStoreMockConfig to SetupConfigWithStoreMock

* Fixing tests on web package

* Removing unnecesary function
2020-03-02 08:13:39 -08:00
JtheBAB
cd36c9f041 MM-22355 - Fix typos detected by goreportcad.com (#13842)
* Update webhook_test.go

* Update user_test.go

* Update filesstore_test.go

* Update plugin_requests.go

* Update syncables.go

* Update helper.go

* Update html_entities.go

* Update user.go

* Update team.go

* Update notification.go

* Update notification_test.go

* Update plugin_api_test.go

* Update post_metadata.go

* Update channel_test.go

* Update database.go

* Update channel.go

* Update user_store.go

* Update team_test.go

* revert andd

* Revert back to infintie

Co-authored-by: Jesús Espino <jespinog@gmail.com>
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-03-02 17:10:40 +01:00
Arianna Vespri
146afedd51 Add output indicating success for restore channel command (#13802)
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-02-27 09:15:21 -05:00
catalintomai
2ec03766a2 MM-22372: fix unhandled exception when exporting to CSV. (#13864)
* MM-23272: fix unhandled exception

* MM-22372: removed extra log command

* MM-22372: fix merge conflict
2020-02-18 23:29:44 +05:30
Eli Yukelzon
17523fa5d9 MM-21898 - Part 1: Generate and use an interface instead of *A… (#13840)
* Generate and use an interface instead of *App
2020-02-13 13:26:58 +01:00
Shota Gvinepadze
a7854f1b97 [MM-22037] Enable uppercase letters in the email (#13794)
* Enable uppercase letters in the email

* Lowercase email on every input

* Remove invalid test
2020-02-12 08:51:45 -05:00
Jesús Espino
1d1ab03c38 Passing t to all tests setup functions (#13841)
* Passing t to all tests setup functions

* Fixing build
2020-02-10 19:31:41 +01:00
Jesús Espino
596f986755 Switch to Postgres when running tests and turn off the fsync setting (#13678)
* Run all tests fasts in postgres

* Moving postgres config to a file

* Addressing PR review comments

* Testing against mysql in the CI to keep things less changed

* Revert "Testing against mysql in the CI to keep things less changed"

This reverts commit fc940c111d.

* Fixing a test broken in postgres but working in mysql

* Fixing some tests

* Fixing some config tests with postgres

* Fixing the rest of config tests

* Fixing govet error

* Fixing search tests for postgres
2020-02-06 15:15:18 +01:00
Shota Gvinepadze
71ceb7f18f [MM-18121] Fix config set panic (#13350)
* Fix config set panic

* Add test

* Fix golint issues

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-01-23 11:20:36 -04:00
Andy Librian
3865bc501e golint fix (#13613) 2020-01-20 12:32:20 +01:00
Christopher Speller
45565cb81f Fix CLI nil pointer panic (#13359) 2020-01-06 11:17:19 -08:00
Rajat Varyani
e27969adbc [MM-12374] Add CLI command for moving outgoing webhook (#12538) 2020-01-06 10:58:56 +01:00
Miguel de la Cruz
f41c90657e Remove bad update user email example (#13356) 2019-12-20 04:37:45 -08:00
Scott Bishel
3bccc03df3 MM-19872: Update dependencies for enterprise implementation of new SAML2 golib. (#13298)
* Update dependencies for enterprise implementation of new SAML2 golib.

* add indirect
2019-12-19 08:27:34 -07:00
Martin Kraft
75ffd0b69e MM-14675: Eliminates implicit GroupChannel/GroupTeam associations. (#13199)
* MM-14675: Upserts GroupTeam when GroupChannel is linked.
MM-14675: Delete all associated GroupChannels when deleting a GroupTeam.
MM-14675: Using replica DB where possible.
MM-14675: Updates create method used in tests.

* MM-14675: Removes unnecessary DB retrieval of GroupSyncable record.
2019-12-18 08:54:09 -05:00
Claudio Costa
72f3bb10c7 [MM-20761] Fix and improve integrity check tool (#13246)
* Fix query and add tests

* Support NULL values and improve output
2019-12-04 16:56:08 +01:00
Jesús Espino
a63684fcb5 Consistent license message for all the go files (#13235)
* Consistent license message for all the go files

* Fixing the last set of unconsistencies with the license headers

* Addressing PR review comments

* Fixing busy.go and busy_test.go license header
2019-11-29 12:59:40 +01:00
Miguel de la Cruz
2259b7f2a8 [MM-19948] Set version on module file and internal paths (#13186)
* [MM-19948] Set version on module file and internal paths

* Fixes after merge

* Fix i18n checker error
2019-11-28 14:39:38 +01:00
Martin Kraft
14bcd1f0a1 MM-18357: Adds pagination to team search. (#12910)
* MM-18357: Adds pagination to team search.

* MM-18357: Adds new client method for paginated requests.

* MM-18357: Adds feedback about non-supported pagination-permissions combo.

* MM-18357: Removes unnecessary conversion.

* MM-18357: Removes paginate parameter and uses nil on page and perpage instead.
2019-11-28 08:11:02 -05:00
Christopher Speller
3cb3d874b8 MM-19980 Allowing user delete command to delete bot accounts. (#13155)
Automatic Merge
2019-11-27 15:36:51 -05:00
Ben Schumacher
c68f021809 Fix naming for CLI plugin list command (#13065) 2019-11-26 09:41:44 +01:00
Miguel de la Cruz
f7e93db512 [MM-16768] Add support for Elasticsearch v7 (#12537)
* [MM-16768] Add support for Elasticsearch v7

* Fix i18n

* Adds external services tracking to the telemetry

* Rebuild elasticsearch interface mock

* Rename diagnostics keys

* Fix merge change
2019-11-21 13:04:21 +01:00
Ali Farooq
a6e992ae74 MM-16368 - Plugin Signing (#13017)
* [MM-18757] POST handler for `/plugins/marketplace` (#12372)

* Implement installMarketplacePlugin

* Add InstallMarketplacePlugin endpoint

* Fix go.mod

* merge with master

* Fix go.mod

* Fix plugin tests

* Move get plugin to marketplace client

* Fix stylistic concerns

* Add trailing newline to the go.mod

* [MM-16586] Add plugin signature settings (#12390)

* MM-17149 - Extend config.json for marketplace settings (#11933)

* MM-17149 - Extend config.json for marketplace settings

* Renamed MarketplaceUrl, tracking default marketplace url

* Added EnableMarketplace to the client config

* Revert "Added EnableMarketplace to the client config"

This reverts commit 0f982c4c66.

* MM-17149 - Added EnableMarketplace to the client config (#11958)

* Added EnableMarketplace to the client config

* Moved EnableMarketplace setting out of limited client configuration

* Add public key settings to the config.json

* Rename PublicKeys to SignaturePublicKeyFiles

* Change filepath.Split to Base

* Remove additional prints

* Force extention of a public key file

* Remove config validation

* Remove error on delete

* Remove config cloning

* Add error messages

* Add plugin public key tests

* Rename extension to PluginSignaturePublicKeyFileExtention

* Remove EnforceVerification

* Change []*PublicKeyDescription to []string

* Change .asc extension to .plugin.asc

* Change ordering of public methods

* Change plugin key commands

* Update examples in the plugin key commands

* Remove forcing extention

* Add verify signature in settings

* Fix tabbing

* Fix naming

* Remove unused text

* Remove unused text

* Update command examples

* Fix unit tests

* Change errors.New to errors.Wrap

* Fix verbose flag

* Change .asc to .gpg

* Fix }

* Change AddPublicKey signature

* Change public.key extension

* Add plugin public key command tests

* Update en.json

* Bootstrap the public keys

* Update en.json

* Fix en.json

* Fix en.json

* Bootstrap hard-coded public key

* Remove unused texts in en.json

* Change file to name

* Add license header

* Update development public key

* Remove writeFile method

* Remove .plugin.asc extension

* Rename publiKey to mattermostPublicKey

* Remove init_public_keys string

* GolangCI

* Closing file handlers

* Fixed test that was installing nps plugin

* [MM-19798] Implement plugin signature verification (#12768)

* MM-17149 - Extend config.json for marketplace settings (#11933)

* MM-17149 - Extend config.json for marketplace settings

* Renamed MarketplaceUrl, tracking default marketplace url

* Added EnableMarketplace to the client config

* Revert "Added EnableMarketplace to the client config"

This reverts commit 0f982c4c66.

* MM-17149 - Added EnableMarketplace to the client config (#11958)

* Added EnableMarketplace to the client config

* Moved EnableMarketplace setting out of limited client configuration

* Add public key settings to the config.json

* Rename PublicKeys to SignaturePublicKeyFiles

* Change filepath.Split to Base

* Remove additional prints

* Force extention of a public key file

* Remove config validation

* Remove error on delete

* Remove config cloning

* Add error messages

* Add plugin public key tests

* Rename extension to PluginSignaturePublicKeyFileExtention

* Remove EnforceVerification

* Change []*PublicKeyDescription to []string

* Change .asc extension to .plugin.asc

* Change ordering of public methods

* Change plugin key commands

* Update examples in the plugin key commands

* Remove forcing extention

* Add verify signature in settings

* Fix tabbing

* Fix naming

* Remove unused text

* Remove unused text

* Update command examples

* Fix unit tests

* Change errors.New to errors.Wrap

* Fix verbose flag

* Change .asc to .gpg

* Fix }

* Change AddPublicKey signature

* Change public.key extension

* Add plugin public key command tests

* Update en.json

* Bootstrap the public keys

* Update en.json

* Fix en.json

* Fix en.json

* Bootstrap hard-coded public key

* Remove unused texts in en.json

* Change file to name

* Add license header

* Implement plugin signature verification

* Remove benburker openpgp

* Update en.json

* Update development public key

* Add support of multiple signatures in filestore

* Update en.json

* Run go mod vendor

* Fix style

* Remove writeFile method

* Remove .plugin.asc extension

* Rename publiKey to mattermostPublicKey

* Verify plugin with mattermost public key

* Remove init_public_keys string

* Add InstallPluginWithSignature method and  Refactor

* Add signature verification on claster notification

* Remove armored signature headers

* Add error strings

* Fix en.json

* Change signatureStorePath

* Implement minor fixes

* Refactor plugin install methods

* Add installPlugin method to uploadPlugin

* Update en.json

* Refactor installPlugin

* Limit number of signatures

* Close signatures

* Fix helper function

* Fix fromReadCloseSeekerToReadSeeker

* Cleaned up ReadCloseSeeker for signatures

* Remove signature truncation on FS

* GolangCI

* Add tests for armored signatures and plugin uploads

* Fix nil slice issue

* Fix TestPluginSync

* Fixed tests

* Return io.ReadSeeker from downloadFromUrl

* Add log for the found plugins in the file store

* Remove logging plugin detection info

* [MM-20134] Consume and store single-signature for each plugin (#13081)

* Consume and store single-signature for each plugin

* Fix en.json

* Remove saveSignature method

* Remove public key hash

* PR Feedback

* refactored config

* PR feedback
2019-11-18 19:02:41 -05:00
Claudio Costa
c0c47df3f0 Fix data race on server startup (#13006) 2019-11-08 20:37:15 +01:00
Rajat Varyani
ac8e3a853c Add gorilla/handlers dependency as it is used in enterprise version (#12991)
* Add gorilla/handlers dependency as it is used in enterprise version

* Remove unused dependencies
2019-11-04 09:48:25 -08:00
Joshua Bezaleel Abednego
63a28700f5 [MM-12623] Create CLI command "config reset" (#10296) 2019-11-01 19:29:02 +01:00
Ben Schumacher
7a665aacdd Run gosimple against codebase (#12928) 2019-10-29 07:45:09 +01:00
Ben Schumacher
71d5f7dc64 Remove unused struct fields (#12924) 2019-10-28 18:04:50 +01:00
Ben Schumacher
e61340c54e Run gofmt -s against codebase (#12943) 2019-10-28 06:08:08 -07:00
Ben Schumacher
8a72ed2833 Fix unnecessary type conversions (#12927) 2019-10-28 10:57:21 +01:00
chahat arora
cf6496bb8f Migrate tests from app/command_test.go to use testify (#12659)
* Migrate tests from app/command_test.go to use testify

* minor fix

* minor fix

* minor fix
2019-10-27 11:42:21 +01:00
Saturnino Abril
65dc760f01 add option to generate deactivated users via sampledata (#12772) 2019-10-15 21:25:31 +08:00
Raghubendra Singh
f167a39abe Update command_test.go (#12654) 2019-10-11 15:08:18 +02:00
Phillip Ahereza
d290534297 Migrate tests from "cmd/mattermost/commands/roles_test.go" to… (#12421)
* migrated tests in roles_test.go to use testify

* format file

* format file and edit some test statements

* change some require statements to assert

* remove extra t.Fatal

* test error on response

* use require.NotEmpty
2019-10-08 09:39:44 -05:00
Ogundele Olumide
f21b7618a4 MM-19015 Migrate tests from "cmd/mattermost/commands/config_te… (#12627)
- change t.fatal to require package of the testify toolkit
2019-10-08 00:09:39 -06:00
Ogundele Olumide
fa166f13bf chore: migrate test to testify (#12507)
- replace calls to t.fatal with require assertion of testify toolkit
2019-10-04 07:43:29 -07:00
Agniva De Sarker
20ff7032a6 Fixed some ineffective assignments (#12543) 2019-10-03 15:45:27 +03:00
Aliaksandr Kantsevoi
f010346945 Migrate tests from "cmd/mattermost/commands/team_test.go" to use test… (#12509)
* Migrate tests from "cmd/mattermost/commands/team_test.go" to use testify #12410

* #12410: Simplify if checks

Migrate tests from "cmd/mattermost/commands/team_test.go" to use testify #12410
2019-10-03 16:38:41 +08:00
Ogundele Olumide
714a5c3c29 chore: convert calls to t.fatal to testify (#12506)
- use require testfify assertions to replace calls to t.fatal
2019-10-03 10:09:29 +02:00
Aliaksandr Kantsevoi
80633ef475 Migrate tests from "cmd/mattermost/commands/webhook_test.go" to use t… (#12510) 2019-10-02 11:03:37 +02:00
Jesse Hallam
beef13ae46 MM-18721: disable SIGPIPE handling (#12394)
We recently added support for handling SIGPIPE cleanly, in order to safely shutdown plugins in the event that the STDOUT/STDERR had been closed unexpectedly. Unfortunately, this signal is also emitted when writing to a closed socket connection: an event that occurs frequently for a webserver. Normally, if no signal handler is registered for same, the Go subsystem distinguishes the file descriptor and ignores those from the network. But once a handler is registered, all SIGPIPEs are passed through: and sadly there is no way to distinguish the original file descriptor.

We don't strictly need the SIGPIPE handling for development any longer since `make stop-server` no longer shuts down the logrus process which explained the majority of hanging plugin processes. It remains suboptimal that a signal can terminate the server and leave plugin processes hanging, but the current symptoms are worse.
2019-09-30 15:44:56 -03:00
Jesse Hallam
993947c70a MM-18741: clarify error message (#12357)
Clarify the error message that is emitted by the server when failing to parse the configuration.

Fixes: MM-18741
2019-09-26 23:47:13 -03:00
Shota Gvinepadze
32bc585446 [MM-18121] Fix config set panic (#12083)
* Fix config set panic

* Change error message

* Add a test case

* Update error string
2019-09-20 17:48:19 +04:00
Nikhil Ranjan
3a3676eb12 Converting to structured logging the file cmd/mattermost/commands/utils.go (#12091) 2019-09-17 12:54:43 -07:00
Paulo Bittencourt
5b79fc4110 [MM-17889] Implement validation of plugin API version comments (#11941) 2019-09-17 08:03:28 +02:00
Jesús Espino
5cf578f486 Migrating to our ldap fork (#12149) 2019-09-12 21:11:05 +02:00
scott lee davis
98f7bdcb43 MM-14827 don't kill STDOUT for the server process (#10828) 2019-09-06 19:08:39 +02:00
Claudio Costa
e1eb839636 Add integrity check command to CLI (#11599)
* Add integrity command

* Add structures and implementation for basic referential integrity check

* Use a channel to receive integrity check reports as they generates

* Setup unit testing

* Add confirm prompt to integrity command and make verbose output optional

* Add more integrity checks

* Use wrapper functions to simplify behaviour and tests

* Improve extensibility of IntegrityCheckResult

* Improve CheckIntegrity tests performance

* Use a config structure for relational integrity checks

* Add more relational integrity checks

* Add more checks and do some cleanup

* Add more relational integrity checks with proper tests

* Fix tests to use sync functions

* Add more info to integrity command help

* Add more relational integrity checks

* Add more relational integrity checks

* Add missing checks

* Show more information about missing records

* Fix to use new sync function

* Change integrity check functions to accept a SqlSupplier

* Fix code duplication

* Use squirrel for query building
2019-08-30 09:44:55 -03:00