Commit Graph

429 Commits

Author SHA1 Message Date
Sudheer
1b95b82b18 MM-25723 Add an experimental setting for data prefetching (#14731)
* MM-25723 Add an experimental setting for data prefetching

* Fix formatting

* Fix bool error

* Fix lint error

* Change default to true
2020-06-03 14:43:59 +05:30
shred86
c35a18d15c Add ShowFullName property (#14189) 2020-05-27 18:23:51 +02:00
Jesús Espino
ae328153d5 Fixing behavior of Replicas and SearchReplicas in canary environments (#14576)
* Fixing behavior of Replicas and SearchReplicas in canary environments

* Trying to fix tests

* Revert "Trying to fix tests"

This reverts commit 3531da9618.

* Revert "Fixing behavior of Replicas and SearchReplicas in canary environments"

This reverts commit 0c05901c84.

* Revert "Disable read/search db replicas in TE/E0 (#14400)"

This reverts commit ef5ac519d9.

* Making the store aware of the license

* Readding the unit tests

* Fixing sqlstor supplier tests

* Adding mutex to ensure license write consistency and fixing tests

* Fixing tests

* Fixing tests

* Shuting down server properly during tests

* Trying to fix tests

* Trying to fix the tests

* Skipping flaky tests

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-27 15:42:48 +02:00
Jesse Hallam
ee8bd4ece4 MM-23250: improve config.Migrate tests (#14479)
* MM-23250: improve config.Migrate tests

The config.Migrate tests were not running in isolation, but wrote over the "local" config. The test coverage for both directions was not exhaustive, and lacked coverage for the recently added plugin signature files.

Rewrite the unit tests as such, fixing a minor issue closing the stores after migration.

Fixes: https://mattermost.atlassian.net/browse/MM-23250

* idiomatic err checking

* clarify random file contents

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-19 21:03:02 -03:00
Scott Bishel
e6bbb4bd7a MM-24082: Add PictureAttribute to LDAP Settings in config (#14506)
* add new config setting for profile picture attribute

* update attribute names

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-14 13:25:23 -06:00
Doug Lauder
e27b86cae0 expose ServiceSettings.ExtendSessionLengthWithActivity config to clients (#14516) 2020-05-13 12:31:43 -04:00
Jesús Espino
ef5ac519d9 Disable read/search db replicas in TE/E0 (#14400)
* Disable read/search db replicas in TE/E0

* fixing tests

* Removing unnecesary text.

* Updating without-license read-replicas config before store initialization

* Reconnecting to database after remove read replicas
2020-05-07 14:11:05 +02:00
Agniva De Sarker
03a55367d9 MM-24312: Fix Dependency updates (#14391)
Automatic Merge
2020-04-29 14:06:09 -07:00
Jesse Hallam
29fae242e1 Revert "Dependency updates. (#14033)" (#14304)
This reverts commit f14c79f170.
2020-04-17 14:26:29 -03:00
George Goldberg
f14c79f170 Dependency updates. (#14033)
* Update dependencies.

* Fix tests.
2020-04-08 10:51:04 +01:00
Agniva De Sarker
125ed3a4cf MM-23817: Use auto-vendoring (#14231)
With Go 1.14 (https://tip.golang.org/doc/go1.14#go-command),
it now automatically checks for the existence of a vendor directory.

So there is no need to explicitly set the `-mod=vendor` flag.
2020-04-07 09:01:06 +05:30
Devin Binnie
1cde88f147 Setting to enable new experimental channel sidebar (#14036)
* Merge upstream

* [MM-20881] Server changes for new experimental channel sidebar setting (#13434)

* Remove report.xml

Co-authored-by: Jason Deland <jaydeland@gmail.com>
Co-authored-by: Devin Binnie <devin@Devins-MacBook-Pro.local>
Co-authored-by: Harrison Healey <harrisonmhealey@gmail.com>
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-03-17 12:01:59 -04:00
upwell
058f235050 [GH-13931] Return error in parseDSN func #13931 (#13947)
Automatic Merge
2020-03-03 11:42:17 -05: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
Miguel de la Cruz
84f45634a8 Remove remaining t.Fatal from the codebase (#13876)
* Remove remaining t.Fatal from the codebase

* Fix job_store test

* Address review comments

* Remove comments
2020-02-13 17:53:23 +01: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
Andy Librian
3865bc501e golint fix (#13613) 2020-01-20 12:32:20 +01:00
Patryk Pomykalski
5f7ca55b13 MM-21520: Remove temporary databases after tests run (#13572)
* MM-21520: Remove temorary databases after tests run

* accidental test name change

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-01-13 16:54:07 +01:00
Agniva De Sarker
ecb41c6eb5 MM-21285: Remove environment overrides before config broadcast (#13527)
While sending the config broadcast message across a cluster, we would
include the environment overrides in the config.

We fix this by exposing a config config store method to remove the overrides,
and then calling that before saving the config across the cluster.

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-01-07 23:21:28 +05:30
Andy Librian
a4c4437681 Golint fix config (#13544) 2020-01-07 17:00:56 +01:00
Christopher Speller
fdd1ae974f Fix encoding on configuration tables. (#13296) 2019-12-20 15:31:03 -08:00
Claudio Costa
2b7916e08f [MM-21119] Update config files permissions (#13386)
* Update config files permissions

* Add error check

* Update permissions for persist
2019-12-13 19:53:42 +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
Jesse Hallam
98bc2b1077 MM-19551: Add IsDefaultMarketplace to client config (#13183)
This exposes the necessary data to the webapp to know when to send more
detailed telemetry events.
2019-11-27 16:33:37 -04: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
Hossein Ahmadian-Yazdi
2880a0af50 [MM-19309] Name Display Lock (#13018)
* WIP

* [MM-19309] Updated params

* Updated boolean value

* [MM-19309] add new struct

* Updated en.json

* Fixed golangci error

* Address PR comments
2019-11-14 08:32:20 -05:00
Agniva De Sarker
2db6823f5d Refactor more code to use testutils.WasCalled (#13054)
* Refactor more code to use testutils.WasCalled

* incorporate review comments

* Revert watcher_test.go changes

The file is in config package and the other tests use config_test.
So it is not visible.
2019-11-13 16:11:26 +08:00
Ben Schumacher
a2adf7b3f5 Run unused against codebase (#12968)
* Remove unused methods

* Fix missed issues
2019-11-01 23:08:01 +01:00
Ben Schumacher
fdcda20fe4 Cleanup dead code (#12929)
* Cleanup dead code

* Remove unneeded translation string
2019-10-28 19:12:50 +01:00
Ben Schumacher
e61340c54e Run gofmt -s against codebase (#12943) 2019-10-28 06:08:08 -07:00
Guillermo Vayá
f58e2ffd0f [MM-19344] add option to render latex (#12907) 2019-10-25 13:58:48 -04:00
Mike Vanbuskirk
705090999b migrate t.Fatal to require.Fail (#12530)
* migrate t.Fatal to require.Fail

* remove nested if/else logic in tests, use bool

* correct bool eval on plugin tests
2019-10-13 21:38:06 +02:00
Matt Hartenbower
3dfcbccc15 Migrate tests from "config/main_test.go" to use testify (#12533)
Resolves MM-19021
2019-10-11 14:59:42 +02:00
Agniva De Sarker
20ff7032a6 Fixed some ineffective assignments (#12543) 2019-10-03 15:45:27 +03:00
Dennis Nguyen
c19bddb51b update config/file test to use testify (#12534) 2019-10-02 19:24:10 +02:00
Agniva De Sarker
8ab0e80b77 MM-19022: Convert config/watcher_test.go t.Fatal calls into require calls (#12524)
* Convert config/watcher_test.go t.Fatal calls into require calls

* Moved wasCalled to a public helper function

Now the testutils package has a new function WasCalled
that can be used by anywhere.
2019-10-02 18:57:43 +02:00
Dennis Nguyen
013a81a33d migrate memory_test to use testify (#12531) 2019-10-02 18:43:16 +02:00
Dennis Nguyen
c859807b70 update database test to use testify (#12532) 2019-10-02 08:51:13 -04:00
Jesse Hallam
841099194d MM-18636: fix wrong merge conflict (#12386)
I resolved a merge conflict incorrectly when submitting MM-18636, and
want to remove the unused code I left behind.
2019-09-30 14:23:00 -03:00
Jesse Hallam
340287890a MM-18636: limit configuration writes to 4Mb (#12266)
* MM-18636: limit configuration writes to 4Mb

By default, MySQL silently truncates writes that exceed the column type in question. Change the column type from `TEXT` to `MEDIUMTEXT` to allow writes to the `Configurations` and `ConfigurationFiles` table to exceed 65535 bytes.  This is a backwards compatible migration, but does require a rewrite of the table.

However, MySQL is further constrained by the default `max_allowed_packet` value of 4Mb, so limit writes accordingly.

Fixes: https://mattermost.atlassian.net/browse/MM-18636

* simplify unit tests

* fix import
2019-09-27 09:10:38 -03:00
Ben Schumacher
9a363f559e [MM-18625] Make config.DatabaseStore.String() more robust (#12309) 2019-09-26 07:17:39 +02:00
Christopher Speller
7966397f1f Defaulting to using go modules vendored (#12040) 2019-09-24 22:01:53 +02:00
Scott Bishel
d6b134aecc MM-18344 Honour absolute paths to SAML certificates (#12237)
* MM-18344 Honour absolute paths to SAML certificates

* fixes from code review

* update text
2019-09-24 06:44:12 -06:00
Ben Schumacher
05fae599b8 [MM-18625] Fix database source parsing on go 1.12.8 (#12250) 2019-09-20 06:22:40 +02:00
Jesse Hallam
4ce7b92283 MM-17023: Plugin Marketplace (#12183)
* 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

* MM-17150, MM-17545, MM-18100 - Implement GET /api/v4/plugins/m… (#11977)

* MM-17150 - Implement GET /api/v4/plugins/marketplace proxying upstream
MM-17545 - Merge locally installed plugins into GET /api/v4/plugins/marketplace

* Replaced MarketplacePluginState with Installed

* Setting InstalledVersion instead of Installed

* marketplace client setting per_page if non zero

* Creating insecure client for marketplace url

* Fixed trailing slash for default marketplace url

* Adding filtering

* Fixed function names

* Renamed Manifest() to GetManifest(), added godoc for BaseMarketplacePlugin

* Handling plugin.ErrNotFound correctly

* Checking err == nil instead when a plugin is installed

* MM-18450 - Local-only plugin search (#12152)

* MM-17846: plugin icons (#12157)

* MM-17846: add support for plugin icons

Extend the model definitions to support plugin icons from the marketplace.

* s/IconURL/IconData

* MM-18475 - Converge on snake_case responses from the marketplace (#12179)

* MM-18520 - MM-Server should forward server version to marketplace server (#12181)

* Renamed request to filter client4.GetMarketplacePlugins

* Renamed request to filter

* Guarding against bad marketplace server response
2019-09-17 15:02:26 -04:00
Harrison Healey
23ef7d9a62 MM-17609 Add EnableSVGs setting (#11874)
* MM-17609 Add EnableSVGs setting

* MM-17609 Return SVG images in post metadata
2019-08-14 13:40:40 -04:00
Joram Wilander
404c49f62f MM-16725 Respect env var overrides when setting config (#11821)
* Respect env var overrides when setting config

* Use strings.NewReader
2019-08-09 11:33:59 -04:00