mattermost/server/public/pluginapi/cluster
Pavel Zeman 3e2c3f70c2
Some checks are pending
API / build (push) Waiting to run
Server CI / Compute Go Version (push) Waiting to run
Server CI / Check mocks (push) Blocked by required conditions
Server CI / Check go mod tidy (push) Blocked by required conditions
Server CI / check-style (push) Blocked by required conditions
Server CI / Check serialization methods for hot structs (push) Blocked by required conditions
Server CI / Vet API (push) Blocked by required conditions
Server CI / Check migration files (push) Blocked by required conditions
Server CI / Generate email templates (push) Blocked by required conditions
Server CI / Check store layers (push) Blocked by required conditions
Server CI / Check mmctl docs (push) Blocked by required conditions
Server CI / Postgres with binary parameters (push) Blocked by required conditions
Server CI / Postgres (shard 0) (push) Blocked by required conditions
Server CI / Postgres (shard 1) (push) Blocked by required conditions
Server CI / Postgres (shard 2) (push) Blocked by required conditions
Server CI / Postgres (shard 3) (push) Blocked by required conditions
Server CI / Merge Postgres Test Results (push) Blocked by required conditions
Server CI / Postgres (FIPS) (push) Blocked by required conditions
Server CI / Generate Test Coverage (push) Blocked by required conditions
Server CI / Run mmctl tests (push) Blocked by required conditions
Server CI / Run mmctl tests (FIPS) (push) Blocked by required conditions
Server CI / Build mattermost server app (push) Blocked by required conditions
Web App CI / check-lint (push) Waiting to run
Web App CI / check-i18n (push) Blocked by required conditions
Web App CI / check-external-links (push) Blocked by required conditions
Web App CI / check-types (push) Blocked by required conditions
Web App CI / test (platform) (push) Blocked by required conditions
Web App CI / test (mattermost-redux) (push) Blocked by required conditions
Web App CI / test (channels shard 1/4) (push) Blocked by required conditions
Web App CI / test (channels shard 2/4) (push) Blocked by required conditions
Web App CI / test (channels shard 3/4) (push) Blocked by required conditions
Web App CI / test (channels shard 4/4) (push) Blocked by required conditions
Web App CI / upload-coverage (push) Blocked by required conditions
Web App CI / build (push) Blocked by required conditions
fix: prevent sql.DB connectionCleaner race and harden flaky tests (#35891)
* fix: prevent sql.DB connectionCleaner race with testify mock diffing

The previous fix (#35881) moved store.Close()/th.Shutdown() before
AssertExpectations, but the race actually occurs earlier — during
mock.Called() when RegisterDBCollector fires inside initConnection.

Root cause: testify's Arguments.Diff() unconditionally calls
fmt.Sprintf("%v", *sql.DB) on every recorded argument (mock.go:976),
which uses reflect to read sql.DB internal fields. The connectionCleaner
goroutine concurrently writes to those same fields, triggering a DATA
RACE under Go 1.25's stricter race detector.

Fix: Set ConnMaxLifetimeMilliseconds=0 and ConnMaxIdleTimeMilliseconds=0
in test SqlSettings before initConnection. This prevents the
connectionCleaner goroutine from starting at all — no concurrent writer
means no race. Connection pool cleanup serves no purpose in tests.

For store_test.go: settings are set directly before SqlStore creation.
For platform tests: settings are set in setupTestHelper's config before
sqlstore.New() is called via platform.New().

Co-authored-by: Claude <claude@anthropic.com>

* fix: harden flaky TestScheduleOnceSequential and TestGroupStore tests

TestScheduleOnceSequential: Replace fixed 300ms sleep with
require.Eventually polling (5s timeout, 50ms interval). Under the race
detector, execution is significantly slower and 25+ scheduled jobs may
not complete within a fixed 300ms window.

TestGroupStore/GetGroups: Use unique uid-prefixed display names for
test groups to avoid collisions with groups created by other parallel
subtests sharing the same database. Search queries and result checks
updated to use the uid prefix.

Co-authored-by: Claude <claude@anthropic.com>

* fix: address CodeRabbit review feedback

- Restore mixed-case search coverage in TestGroupStore by using
  mixed-case query strings (uid + "-GrOuP-3") to verify
  case-insensitive matching behavior.
- Strengthen exactly-once validation in TestScheduleOnceSequential
  by checking callback count == 1 instead of > 0, ensuring
  duplicate executions are caught.

Co-authored-by: Claude <claude@anthropic.com>

---------

Co-authored-by: Claude <claude@anthropic.com>
2026-03-31 16:58:09 -04:00
..
doc.go [MM-53968] Includes mattermost-plugin-api into the mono repo (#24235) 2023-08-21 09:50:30 +02:00
job.go [MM-53968] Includes mattermost-plugin-api into the mono repo (#24235) 2023-08-21 09:50:30 +02:00
job_example_test.go [MM-53968] Includes mattermost-plugin-api into the mono repo (#24235) 2023-08-21 09:50:30 +02:00
job_once.go [MM-53968] Includes mattermost-plugin-api into the mono repo (#24235) 2023-08-21 09:50:30 +02:00
job_once_example_test.go [MM-53968] Includes mattermost-plugin-api into the mono repo (#24235) 2023-08-21 09:50:30 +02:00
job_once_mem_test.go [MM-64654] Migrate to modern Go features (#31820) 2025-07-18 12:54:51 +02:00
job_once_scheduler.go [MM-53968] Includes mattermost-plugin-api into the mono repo (#24235) 2023-08-21 09:50:30 +02:00
job_once_test.go fix: prevent sql.DB connectionCleaner race and harden flaky tests (#35891) 2026-03-31 16:58:09 -04:00
job_test.go updated go to version 1.25.8 (#35817) 2026-03-27 21:11:52 +01:00
mock_plugin_api_test.go [MM-64654] Migrate to modern Go features (#31820) 2025-07-18 12:54:51 +02:00
mutex.go Enforce use of any instead of interface{} (#30588) 2025-03-31 10:44:34 +02:00
mutex_example_test.go [MM-53968] Includes mattermost-plugin-api into the mono repo (#24235) 2023-08-21 09:50:30 +02:00
mutex_test.go MM-57532: Improve timeouts for some tests (#26642) 2024-04-05 19:28:49 +05:30
wait.go [MM-53968] Includes mattermost-plugin-api into the mono repo (#24235) 2023-08-21 09:50:30 +02:00
wait_test.go [MM-53968] Includes mattermost-plugin-api into the mono repo (#24235) 2023-08-21 09:50:30 +02:00