* Cache test users to speed up testing
Users were recreated for many tests and hashing passwords takes a lot of
time. Testing /api4 takes around 120s less and /app 60s less.
* fix build
* simplifying a bit the approach
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Jesús Espino <jespinog@gmail.com>
* MM-22282 Add Ephemeral response when using mentions without permission and add new prop to disable mention highlights on client
* MM-22622 Make test name test actually what it does and fix comment style
* MM-22622 Check ephemeral post created when post create with mentions on API
* MM-22622 More tests for App>CreatePost
* MM-22622 Make DisableMentionHighlights more concise and rename ephemeral post
* MM-22622 Dont send ephemeral message for system message created by user
* Trigger build
Hubs property has been detected by the race condition detector
as a possible one because we could set the Hubs variable
and also we're spawning goroutines that could ask for that property
This condition is not happening right now because we're setting the
Hubs variable in the server start and after that, we're spawning the
goroutines but the tests are failing because of this and in the future
this could be a problem
I could not figure out the actual root cause for this.
But a possible area of concern is that somewhere in the call stack,
the login failed partially. Therefore, the session did not have the teamMembers
populated. And the permission check failed therefore.
Adding the error checks should let us know in future if this is not the case.
Another possible case is the app.ClearTeamMembersCache which gets called in
the goroutine app.SyncRolesAndMembership. If this races with the session,
then it's possible that the teamMember is wiped off from the session. But this
happens after the permission check. So it's not very likely.
Also, while we are here, I found that (*app).ClearTeamMembersCache
does not log the internal error bubbled up. This prevents us from understanding
what actually happened. Added that logging.
* 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
* Running tests in mysql and postgres
* Fixing ci
* Fixing ci
* Fixing ci
* Fixing ci
* Fixing ci
* Fixing ci
* Fixing ci
* Fixing ci
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
* Remove unnecessary struct2interface dependency
Running go mod tidy on the repo removes it.
This was also preventing 1.14beta from running the repo,
because now it verifies modules.txt with go.mod, which had a mismatch.
* fixing CI
* Fix test-server target
* Fix some discrepancies in vendor
* Removing the Makefile target for now
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
- Fix panic due to not checking for JSON marshal error
- Reorder the FileExists check which would fail if we were to pass
the -short flag to bypass the slow URL test. In which case, the plugin
would have been removed from the filesystem.
So we move the check before we remove the plugin.
https://mattermost.atlassian.net/browse/MM-22666
* allow ExpireInSeconds < 0
Allow `ExpireInSeconds < 0` for use with `KVSetWithOptions`. While this has no practical use in reality, it's much easier to thoroughly unit tests the underlying functionality if we can match the semantics of CompareAndSet. Strictly speaking, this is a breaking change, but not relative to the advertised semantics. Anyway, it's also not entirely unreasonable to treat a negative `ExpireInSeconds` as having already expired vs. marking it as never expired.
* updated tests, to break apart
* honour expiry in CompareAndSet
* honour expiry in CompareAndDelete
* honour expiry in List
* fail unique constraint exception for SaveOrUpdate
A unique constraint error on a `SaveOrUpdate` should not be ignored: we did not save or update the requested value, as someone else managed to write the record first.
Note this is handled differently in `CompareAndSet`, where we correctly swallow the error and return `false` to indicate we did not successfully save the value.
* unexport DEFAULT_PLUGIN_KEY_FETCH_LIMIT
* s/InternalServerError/BadRequest/ for failed SaveOrUpdate
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
* [MM-20941] Parallelize plugin loading on startup
* [MM-20941] Parallelize plugin SyncPlugins
* [MM-20941] Make activation and deactivation of plugin concurrent
* [MM-20941] Remove uncessary optimization
This reverts commit aad2680aec.
[MM-20941] Remove uncessary wait in SyncPlugins
[MM-20941] Parallelize processing of prepackaged plugins
* [MM-20941] Fix lint issue
* [MM-20941] Fix bug for getting the number of plugins to process
* [MM-20941] Use buffered channel and fix return issue in prepackaged plugin processing
* [MM-20941] Implement feedback
* [MM-20941] Fix looping over channel for plugins
* [MM-20941] Retain signature of process plugin
* [MM-20941] Fix function documentation
* [MM-20941] Fix bug to pass the plugin path in anonymous function
* [MM-20941] Rename variable
* [MM-20941] Make minor changes in variable naming
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
* MM-21150: Re-create the workers so that the EE workers are non-nil upon uploading a license.
* MM-21150: Updates from Srv field to method.
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
* MM-22619: check for nil plugins environment
Check if plugins were disabled before attempting to collect metrics and emit telemetry for same.
Fixes: https://mattermost.atlassian.net/browse/MM-22619
* Update app/diagnostics_test.go
* constants and options for getting files
* Method to get files with options
* Add i18n strings for en
* Add API methods for getting files with options
* gofmt -s file
* explicitly set create at in tests
* use greater than nanosecond time difference for tests
* use gte instead of gt for getting files by created time
* use created at time as default sort order for getting file infos
* use explicit inline strings instead of format strings
* join tables only when required
* use if as secondary sort, and update tests
* update field docs to reflect previous changes
* make page and perPage get options as required
* add json struct tags to GetFileOptions
* bump minimum server versioni
* remove sorting by username and channelname
* use bool for sort order type
* use FileInfo prefix instead of just File
* clearer comments
* use zero-based page numbering
* test filtering by user and channel
* remove unnecessary whitespace
* use int instead of uint for page and perPage arguments
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
* MM-21919 Add channel_mention permission
* MM-21919 Fix emojis migration test
* Enforce Channel Mentions on the in the posts api
* MM-21919 Rename permission to use_channel_mentions
Allow posts with channel mentions to still be posted without the permission just don't send notifications to users
* MM-21919 Add tests for a post with @all and @here
* MM-21919 Add use channel mentions to all roles that have create post
* MM-21919 Update app_test to include use_channel_mentions permission in default permissions
* Updating build and release process to include externally built mmctl
* Missed last commit before reset
* rename script to align with purpose
* Moving get release script to scripts dir
* Streamlined script to find the correct latest version of an externally built binary from a GitHub Release
* Updated variable names to match
* Updating vars to match
* Updating parameters to named variables for clarity
* Update scripts/get_latest_release.sh
Co-Authored-By: Elisabeth Kulzer <elikul@elikul.de>
Co-authored-by: Elisabeth Kulzer <elikul@elikul.de>