Commit Graph

29 Commits

Author SHA1 Message Date
Agniva De Sarker
94827d06a3 MM-26750: Remove instances of InitBasic when it's not required (#14984)
th.InitBasic initializes users, channels, and teams. But a lot of
tests don't use it at all, causing unncessary delays. A single InitBasic
call takes around 400ms. This PR removes 71 of them, approximately shaving
off 28 seconds. Arguably, this would be more because some tests run in loops.
2020-07-13 19:34:05 +02:00
Agniva De Sarker
14f7118dde MM-22706: pass along set_online flag in websocket response (#14591)
* MM-22706: pass along set_online flag in websocket response

To let the client know whether a user has created a post without
being online or not, we get the set_online query param and
pass it down to the websocket event being passed down to the client.

With this PR, the "data" field of the `posted` event will contain
a `set_online` boolean field set to true/false depending on the
query_param set_online value set in the createPost call.

* Setting to false for auto responder

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-27 17:35:02 +05:30
Sven Hüster
37ac6654f6 add support for exporting and importing props (#14034)
* add support for exporting and importing props

* merge master

* add export test for post props

* add check if postData exists

* add import tests for post props

* fix ci bot issues

Co-Authored-By: Bot from GolangCI <42910462+golangcibot@users.noreply.github.com>

* fix gofmt errors

* remove test comment and add name instead

* remove uneccessary changes

Co-authored-by: Bot from GolangCI <42910462+golangcibot@users.noreply.github.com>
2020-03-23 09:21:05 -04:00
Jesús Espino
c9a0418a32 Making private some methods that are not needed publicly (#13959)
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-03-03 22:43:48 +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
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
8347f3e1fa Bulk import/export supports direct messages from a user to themselves (#13200)
* Test added to check support for import of messages sent to your own DM
channel

* Support for single member direct channel messages and posts

Now bulk import is able to export/import the self direct channel and
the posts inside

* Improve how the copy of channel members for DM and DM posts

* Improved the tests for the export self-channels
2019-12-05 22:58:38 +08: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
Nikhil Ranjan
995a545411 Convert app/export_test.go t.Fatal calls into assert/require calls (#12184) 2019-09-13 11:51:46 +02:00
Eli Yukelzon
89a79e2e9f MM-17224 - Bulk export fails due to missing user (#11738)
* don't fail on deleted users

* test

* logging

* more fine grained error checking
2019-08-01 09:19:37 -03:00
Rodrigo Villablanca Vásquez
1e05d37290 Migrates Channel.GetAllDirectChannelsForExportAfter to sync by default (#11272) 2019-06-20 11:01:49 -04:00
Rodrigo Villablanca Vásquez
9fa1622fc3 Fix #10963: GetDirectPostParentsForExportAfter is sync now (#11009) 2019-05-30 23:19:14 +02:00
Ishank Gulati
3b25e09b99 [GH-10866] Preferrence.Save - Remove preference length return arg (#10962) 2019-05-29 09:54:56 -04:00
Ishank Gulati
fb6c1debf0 [MM-15296] Migrate "Preference.Save" to Sync by default (#10866)
* response format changes

* Generated mocks
Fixed all references of Preferences.Save

* Remove old code from store.go (incorrect merge)

* Review change - Add validations on count and error

* Review change - return from root level

* Review change - return 0 as nil value for int

* fix initialisation of err in preference_store
2019-05-26 15:06:33 +02:00
Fernando Correa Neto
02bd35247b [MM-14779] Investigate flaky TestExportGMandDMChannels (#10534)
* fix flaky test by sorting by Type and also change helper to increase
precision in CreateAt

* better strategy is to get a smaller number

* user nanonseconds as milisenconds proved to be a bit problematic for
unit tests

* revert changes in helper function and create posts in a more controled way

* use the original value

* make post instantiation more clear
2019-04-09 09:47:41 -04:00
Fernando Correa Neto
9abd4dd7dc [MM 12464] Include DM/GM Channels and Their Posts in the Bulk Export (#10421)
* transplant the existing PR into the working tree

* start addressing review comments

* move existing direct channel export code into this branch

* modify channel exporter to use squirell and populate members in two steps

* use squirrel to build sql queries for channel and dm/gm export methods

* remove debug helpers and use Username instead of UserId

* unit test for DM Channel exporter

* add more unit tests for channel export

* add test for DM/GM post export

* checkpoint with failing test for postgres

* use getQueryBuilder to make sure squirrel uses the correct formatting
for each database

* add a test for post export

* fix shadowed vars that broke the build

* address review comments and add tests to support it

* address review comments and add a mlog call

* s/Info/Debug/

* address review comments in post_store

* address review comments in channel_store

* address review comments in export

* address review comment in post_store: drop GroupBy

* address review comment on supplier: move getQueryBuilder to sqlstore

* address review comments: explicit TearDown

* address review comments: improve test coverage

* address review comments: make sure public and private channels are excluded

* address review comments: improve test coverage

* address review comments: make sure Channels table gets truncated after
each test

* more cleanups and better assertions

* wrap PostStore in a StoreTestWithSqlSupplier

* last minute changes: improve post export test coverage and check members

* address review comments: make sure all posts have their channel
members set

* address review comments: make sure all posts have their ChannelMembers
exported correctly

* gofmt fix

* sort channels so it's possible to assert on index
2019-03-15 16:28:43 +01:00
Sandeep Sukhani
7f9e1273d7 [MM-12667] Allow including deactivated users in bulk import and export (#10353)
* [MM-12667] Allow including deactivated users in bulk import and export

1. Added `deleteAt` for user type import line
2. Adding deactivated users data in bulk export
3. Importing deactivated users data in bulk import

Added/Updated relevant test cases

* Fixed export of replies to posts by deleted users.
Updated tests for same
2019-03-01 15:50:24 +00:00
Shreyansh Chouhan
39ceaa3e86 [MM-13833] Configured unit tests to log through t.Log (#10272)
* Rerouted the unit test logs through t.Log

* resolving merge confilvts

* Update testing.go

* Update helper_test.go

* Added godocs for NewTestingLogger

* Added go docs for NewTestingLogger

* Resolving conflicts
2019-02-14 13:52:11 -04:00
Simone Salsi
0f35c4b24d [MM 12458] Include user preferences in bulk export (#9784)
* First version of the preference exporter

* First working version of the preference export

* Removed useless debug line

* Added special case of empty string to harverst the omitempty feature

* Removed dangling line from rebase

* Moved exportablepreference in scope

* Fix go vet issue

* Fix formating

* Add simple test

* Add full test for BulkExportUsers

* Improve variable naming
2019-02-01 11:43:41 +00:00
Jesse Hallam
66d174d80b Fix various unit tests (#10079)
* fix spurious TestMuteCommandSpecificChannel test failure

See
https://community-daily.mattermost.com/core/pl/px9p8s3dzbg1pf3ddrm5cr36uw

* fix race in TestExportUserChannels

* TestExportUserChannels: remove SaveMember call, as it is redundant and used to be silently failing anyway
2019-01-09 14:01:24 -05:00
Jesús Espino
febc5115fd MM-13220: Fixes for bulk export problems (#9980)
* MM-13220: Fixes for bulk export problems

* fixing tests
2018-12-12 14:20:22 +01:00
Jesse Hallam
8374b6221e unittest using externally managed database (#9400)
* MM-12083: unittest using externally managed database

* cherry-pick Makefile changes from @cpanato

* Jenkins changes (#9915)

* add docker compose

* udpate

* when using minio dont need to set the region

* update

* add wait for it script

* using old minio

* add new jenkins file

* update makefile

* add dockerfile

* rename the docker-compose proj to avoid colision (#9917)

* rename the docker-compose proj to avoid colision

* enable debug

* enable debug to double checkt the branchs and fix docker-compose name (#9919)

* add ee hash to check (#9920)

* fix name (#9921)

* update jenkins file to push from branch and prs

* if a new push comes in stop the running build

* split mysql and postgres variables

* add script to run jenkins-like env in local dev env

* update docker-compose project name to use uuid to make it more randon

* fix DCNAME definition

* update elasticsearch docker image

* revert test

* tidy up stages, and wait for mysql differently

* update docker image and add check for postgres

* checking if is ready

* update docker compose to have a wait for deps

* add readme and rename dockerfile

* fix -unittest setup

* using mm docker image

* restore parallel unit tests at the package level

Spin up a dedicated database for each package under test to avoid races in accessing the same tables.
Simplify the interface for configuring the test database to just a DSN instead of multiple exports for each field.

* try to work around root mysql access in CI

* update local-test-env.sh too

* MYSQL_ROOT_HOST: %

* fix missing quotes

* setting some memory limits for mysql

* revert memory docker compose does not support

* fix env name for postgres

* expose errors in app/export_test.go

* fix test label, better error checking on teardown

* increase query timeout for tests

* fix export_test

* update local dev script

* add configurable mysql root passwd
2018-12-10 17:58:09 +01:00
Wasim Thabraze
246ff89391 MM-12463 : Added capability to bulk export custom emojis (#9790) 2018-11-19 14:43:31 +00:00
Shobhit Gupta
bce7a7c73d [MM-12462] Include favorite channels in bulk export (#9692)
* Include favorite channels in bulk export

* Remove duplicate method
2018-11-05 13:18:00 +00:00
Shobhit Gupta
2e945e287d [MM-12461] Include the per-channel NotifyProps for Users in Bulk Export (#9773)
* Add per channel notify props to bulk export

* Check if key exists before assigning
2018-10-31 11:43:47 -07:00
Vadim
54b7a29581 MM-12459 Include User Notify Props in the Bulk Export (#9724) 2018-10-24 07:34:43 -07:00
Wasim Thabraze
7562f940bb [MM-12465] Added capability to export reactions of posts during bulk export (#9600)
* Added capability to export reactions of posts

* Added capability to export reactions of replies of a post

* Added test case to test the reactions of a post
2018-10-17 14:23:10 +01:00