Commit Graph

77 Commits

Author SHA1 Message Date
Ibrahim Serdar Acikgoz
1fadfa9f33 app/testEmail: remove a setting that blocks testEmail (#15022)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-08-15 00:43:42 +03:00
Agniva De Sarker
4a2715974d MM-27149: optimize initBasic (#15063)
* MM-27149: optimize initBasic

Mostly, all tests just needed the user initialization part and not
the channel and group creation. So we move the user initialization inside
the Setup call. This avoids unnecessary DB calls which take around 250-300ms
on average.

And we make the login requests concurrently to shave off a few more ms.
According to my tests, the 2 login calls take 140 ms on average, which
shaves off 70ms.

So approximately, we shave off 350ms per test. And there are 114 occurences
of these. So around 39 seconds.

* make initlogin only for Setup/SetupEnterprise

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-07-22 13:50:33 +05:30
Miguel de la Cruz
5ddf8d4099 [MM-25089] Migrate server busy endpoints to local mode (#14883) 2020-07-16 10:26:46 +02:00
Dušan Panić
83a80a2422 Implemented AmazonS3PathPrefix (#14917)
* Implemented AmazonS3PathPrefix

* Remove unecessary method

* fix for test

* fix for test which are failing

* fix for test which are failing

* fix for test

Co-authored-by: Dusan Panic <dusan@salestrekker.com>
2020-07-07 00:20:13 +02:00
Ashish Bhate
8de5dd9022 MM-25075: local mode for getLogs (#14760) 2020-06-12 15:02:57 +05:30
Doug Lauder
398a12329a MM-20913 add client API Client.GetServerBusy to fetch server busy state and timeout. (#13986)
* MM-20913 add client API to fetch server busy state and timeout

* deprecate current API that only returns timeout
* required for mmctl MM-20913

* restore deleted unit test for GetServerBusyExpires

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-03-06 11:37:07 +01:00
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
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
Mario de Frutos Dieguez
682a1d5d15 Avoid panic when push messages are empty or nil (#13751) 2020-01-29 10:08:27 +01:00
Jesús Espino
b8ef62e502 Adding structuredLogging check and fix inconsistencies (#13370)
* Adding structuredLogging check and fix inconsistencies

* Addressing PR review comments

* Addressing PR review comments

* Addressing PR review comments

* Addressing PR review comments

* Addressing PR review comments
2019-12-16 13:57:21 +01:00
Jesús Espino
0d735042d9 Fixing flaky test around websocket counts in analytics API endpoint (#13314) 2019-12-05 22:06:15 +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
Doug Lauder
5abbe50258 MM-8607 Add ability to turn off non-critical services when under load (#13212)
* MM-8607: add ability to turn off non-critical services under load

* server busy invalid param unit tests

* MM-8607: rename server busy endpoints

* MM-8607: handle case where App not initialized

* MM-8607: additional unit test cases per feedback.

* MM-8607: use decorator to check isbusy when adding endpoint route

* MM-8607: rename endpoints, use struct for json

* Update api4/system.go

Fix misspelled log output

Co-Authored-By: Saturnino Abril <saturnino.abril@gmail.com>

* MM-8607: fix i18n order; max seconds for server busy expiry
2019-11-27 20:41:09 -05:00
larkox
d3c607f5c6 Fix error: Tests fail due to changes in MinIO default port (#13108)
Automatic Merge
2019-11-22 09:06:51 -05:00
Daniel Schalla
501da809f3 [CR-458] Enhance Logs Endpoint Message (#12984)
* Make it possible to identify log entries created via the post API endpoints

* Clarify wording
2019-11-04 10:03:59 -08:00
Rohan Julka
b8f6b2022e Migrate tests from api4/system_test.go to use testify (#12812) 2019-10-17 17:25:13 +02:00
Michael Kochell
467141ab69 [MM-19004] Change assertion in client4/system_test.go to be less flaky (#12586)
* avoid swallowing errors from websocket_client.SendMessage

* Revert "avoid swallowing errors from websocket_client.SendMessage"

This reverts commit 5f223e0996.

* test against app.TotalWebsocketConnections instead of hardcoding assertion
2019-10-13 20:37:34 +02:00
threepwood-mm
f9d9dd8b60 [MM-14521] New endpoint to validate site urls (#11944) 2019-09-06 12:52:14 +02:00
scott lee davis
2fa63b10ec MM 7971 dockerhost -> localhost && docker -> docker-compose (#10872)
* replace dockerhost with localhost

* remove uneeded setup-max build step (no more dockerhost)

* changes as recommended by @cpanato

* make clean-docker with docker-compose

* added ports to docker-compose.yml (needed for osx).   ignore error for ldapadd (when already exists)

* add clean-old-docker to legacy.mk

* docker-compose stop instead of down for `make stop-docker`
2019-08-02 11:53:00 -03:00
Gabe Jackson
41e5ec3c5e [MM-16032] Add system ping endpoint health checks (#11267)
* Add system ping endpoint health checks

This change adds the option for additional server health checks
to be performed when the system ping endpoint is hit. An additional
field 'getserverstatus' is required to run the enhanced health
checks to ensure previous default ping behavior is not modified.

* Use snake_casing
2019-06-20 16:06:04 -04:00
Eli Yukelzon
6cc36ab176 [MM-14890] Logs endpoint always returns an empty line (#10559)
* fixed new line being returned in logs, improved the test

* improved the EOL check

* Fixed var shadowning
2019-04-18 10:16:49 +01:00
Jesse Hallam
9ef8c1e8b1 MM-14439: experimental restrict system admin (#10414)
* api4: break out license and config from system

* app: move some config functions from admin.go to config.go

* add ExperimentalSettings.RestrictSystemAdmin

* forbid various actions to restricted system admin

* update default.json

* fix function names in errors
2019-03-08 13:15:28 -05:00
Jesse Hallam
3a71709103 MM-13893: refactor config (#10230)
* refactor utils/config* to config/

* pull validateLdapFilter into app

* clean up Config/GetConfig/GetSanitizedConfig usage

Eliminate app.GetConfig() in favour of just using app.Config() directly,
but expose app.GetSanitizedConfig() for when the old behaviour was
required.

* web: isolate config setup

* TestInvitePeopleProvider: make config explicit

* regenerateClientConfig: avoid racey map access

* integrate watch flag into app.ConfigFile option

* make app.Option return an error

* release.mk: only cp static files from config/

* release.mk: fix cp static files from config/

* api4: TestPlugin cleanup

* s/c/cfg/ for clarity

* fix merge conflict

* testlib: allow customization of testlib driver name
2019-02-12 08:37:54 -05:00
Martin Kraft
afcb224a79 Adds configuration for separate reply-to email header. (#10144)
* Adds configuration for separate reply-to email header.

* Changes config setting name.

* Using a separate variable and value in test.

* Updates for config pointer changes in another PR.

* Adds new key to test config. Adds default value.
2019-02-04 17:01:05 -05:00
Christopher Speller
4e0840969b MM-13923 Fixing pulling from incorect cache. (#10216)
* Fixing pulling from incorect cache.

* Adding caching test.
2019-02-01 08:13:51 -08:00
Joram Wilander
2ca222033c MM-10658 Change config fields to pointers (#9033)
* MM 10658 Change config fields to pointers (#8898)

* Change fields of config structs to pointers and set defaults

MM-10658 https://github.com/mattermost/mattermost-server/issues/8841

* Fix tests that go broken during switching config structs to pointers

MM-10658 https://github.com/mattermost/mattermost-server/issues/8841

* Apply changes of current master while switching config structs to pointers

MM-10658 https://github.com/mattermost/mattermost-server/issues/8841

* Fix new config pointer uses

* Fix app tests

* Fix mail test

* remove debugging statement

* fix TestUpdateConfig

* assign config consistently

* initialize AmazonS3Region in TestS3TestConnection

* initialize fields for TestEmailTest

* fix TestCheckMandatoryS3Fields
2019-01-31 08:12:01 -05:00
Christopher Speller
ce2c7110d3 Switching redirect_location route to use httpservice client and adding caching. (#10118) 2019-01-27 18:24:46 -08:00
Christopher Speller
8429add371 Cleanup related to context refactor (#9988) 2018-12-17 08:51:46 -08:00
Jesse Hallam
136d8ca5c4 Various unit test related improvements (#9865)
* api4: improved error handling

* system_store: more logs

* integrate go-junit-report into test-te/test-ee

* add CI_MINIO_HOST and CI_INBUCKET_HOST instead of CI_HOST

* comment re: minio configuration issue

* fix TestStartServerPortUnavailable to pass even when root can bind to :21

* skip TestFindManifest_FolderPermission while running as root
2018-11-28 09:05:39 -05:00
George Goldberg
c24c518a14 MM-13185: Fix Message Export config special case. (#9898)
It should only apply when setting through the System Console, to avoid
messing up externally managed config files.
2018-11-28 14:01:29 +00:00
Jesse Hallam
a78913178c Ensure unittest isolation (#9819)
* api4: fix TestGetUsersNotInTeam assertions

This test was relying on data from a previous test run. With the data cleared before each test, the assertions much match reality.

* *testlib: always InitSystemAdmin

Some tests implicitly relied on the basic user having system
administrator privileges because it was the first user created as such.
Eliminate `InitSystemAdmin` and explicitly create the system admin user
instead to avoid this ambiguity going forward.

* *testlib: drop all tables before each test

* api4: split up TestChannelDelete to avoid duplicate InitBasic

* api4: teardown in TestResetPassword, for when this test comes back

* invalidate cache on DropAllTables

This is necessary since the test store persists across tests.

* disable parallel tests

While tests within a package must be explicitly parallelized using `t.Parallel()`, tests across packages are run in parallel by default.  This causes problems given that the tests all currently share the same database instance.

Unfortunately, this also means that running the tests is much slower, but we can return to this later.
2018-11-20 20:16:25 -05:00
Harrison Healey
159c2a44dc MM-10987 Turn on ExperimentalLimitClientConfig by default and remove setting (#9696) 2018-10-24 11:52:53 +01:00
Jesse Haka
3e462713de if EnableLinkPreviews not enabled, do not call url (#9461) 2018-10-02 08:00:50 +02:00
Martin Kraft
ed0fb617ef MM-11786: Adds API endpoint to retrieve redirect locations. (#9284) 2018-08-24 08:49:31 -04:00
Jesse Hallam
d8c8a19d35 avoid t.Fatal() in tests (#9189)
I've been burned a few times by tests that simply fatal, requiring me to
run another build to learn more about what the mismatch was. Avoid this.

This is part of a long running goal of mine to make testing "better".
2018-08-09 11:26:38 +02:00
Jesús Espino
344836dfb2 Add missed translations (#8959) 2018-06-19 19:40:26 +02:00
Harrison Healey
6d8140337e MM-8701 Limit the number of client config fields sent before user logs in (#8954)
* MM-8701 Limit the number of client config fields sent before user logs in

* Fixed missing client config field

* Reduced duplication between limited and regular client config
2018-06-18 12:39:22 -04:00
Carlos Tadeu Panato Junior
db6b8f6238 fix test and add new (#8759) 2018-05-10 17:56:11 +08:00
Christopher Speller
454c113b4e Removing bad test. 2018-05-09 18:03:28 -07:00
Joram Wilander
d6537deb3d Add inactive user count to analytics and fix client analytics function (#8695) 2018-05-02 07:50:56 -07:00
Christopher Speller
686c2fbab7 Structured logging (#8673)
* Implementing structured logging

* Changes to en.json to allow refactor to run.

* Fixing global logger

* Structured logger initalization.

* Add caller.

* Do some log redirection.

* Auto refactor

* Cleaning up l4g reference and removing dependancy.

* Removing junk.

* Copyright headers.

* Fixing tests

* Revert "Changes to en.json to allow refactor to run."

This reverts commit fd8249e99b.

* Fixing some auto refactor strangeness and typo.

* Making keys more human readable.
2018-04-27 12:49:45 -07:00
Corey Hulen
2acbc77d78 MM-10375 Fixing connected socket count (#8682)
* Fixing connected socket count

* Adding unit test
2018-04-27 10:38:40 -07:00
Harrison Healey
0a6b96cb40 MM-9849 Added tracking of which settings are set through environment variables (#8586)
* MM-9849 Added tracking of which settings are set through environment variables

* Removed old version of viper

* Added forked version of viper

* Fixed unit tests

* Fixed more unit tests

* Removed copy from App.GetEnvironmentConfig
2018-04-09 18:16:11 +02:00
Chris Duarte
74e703f58d Timezone feature (#8185)
* Add supported timezones into config

Remove Timezone list creation in favor of timezone from configs

Add Timezone field to Users table

Clean up format of SupportedTimezones in config

* Remove unwanted change

* Add test for updating user timezone

* Add empty map[string]string if Timezone is null

* Add EnableTimezoneSelection config

* Revert back to map[string]string for ClientConfig

* Refactor SupportedTimezones into timezones.json

* Include timezones.json in TestConfigFlag

* Add timezone api endpoint

* Bump varchar size to 256 and setMaxSize in user_store

* Refactor LoadConfig to LoadConfig and LoadTimezoneConfig

* Remove unnecessary argument in LoadConfig, mail_test

* Add test for timezone endpoint

* Add license header

* Refactor timezones endpoint to system.go

* Add system base route to timezone endpoint

* db timezone upgrade in db v4.9

* Avoid saving SupportedTimezones to config.json

* Add timezonePath support in config

* Remove EnableTimezoneSelection from config

* Use return statement without return parameter

* Refactor test for SupportedTimezones

* Check for supportedTimezone != nil instead of using len

* Decouple SupportedTimezones out of Config

* Fix failing test

* Add LastTeamIconUpdate back in upgrade.go

* Write timezone config in config_flag_test

* Add code fallback for default timezone support
2018-03-22 09:53:43 -04:00
Carlos Tadeu Panato Junior
db4402c40d remove s3 region to be mandatory and fix when user call test s3 when the config is saved (#8454) 2018-03-14 00:26:56 +08:00
Carlos Tadeu Panato Junior
1b29b50330 update email test in the driver to be able to send the config in the body (#8453)
Signed-off-by: cpanato <ctadeu@gmail.com>
2018-03-13 10:42:56 -05:00
Carlos Tadeu Panato Junior
6e024c45b5 [PLT-8186] add support for ec2 instance profile authentication (#8243) 2018-02-28 23:12:11 +00:00
Joram Wilander
5c560db810 ABC-176 Prevent changing PluginSettings.EnableUploads through the API (#8249)
* Prevent changing PluginSettings.EnableUploads through the API

* Contain api4 test case in it's own test
2018-02-13 11:08:49 -05:00
Yusuke Nemoto
ddd99f7476 PLT-6896 per-paging for logs (#7903)
* PLT-6896 Read logs from last

* Getting rid of file.Stats

* remove deprecated value

* Make non-reassigned value constant
2017-12-13 13:04:55 -06:00