fleet/server
Roberto Dip 8d18e67ab6
prevent errors on tests that use real replicas (#20121)
For #20046, I found this while trying to get #20085 merged, as MySQL 8
tests were consistenly failing (5 times in a row) with this when
integration tests are run in parallel.

I used the `lhotari/action-upterm@v1` action to hook an SSH session into
the worker, and I noticed different errors in different runs, but all on
the same lines of this sample:

```
mysql> SELECT * FROM replication_applier_status_by_worker LIMIT 1 OFFSET 0\G
*************************** 1. row ***************************
                                           CHANNEL_NAME:
                                              WORKER_ID: 1
                                              THREAD_ID: NULL
                                          SERVICE_STATE: OFF
                                      LAST_ERROR_NUMBER: 1146
                                     LAST_ERROR_MESSAGE: Worker 1 failed executing transaction 'ANONYMOUS' at master log bin.000003, end_log_pos 25540153; Error 'Table 'server_datastore_mysql_TestTeams.host_mdm_apple_bootstrap_packages' doesn't exist' on query. Default database: 'server_datastore_mysql_TestTeams'. Query: 'TRUNCATE TABLE host_mdm_apple_bootstrap_packages'
                                   LAST_ERROR_TIMEST
```

This uses

[REPLICATE_DO_DB](https://dev.mysql.com/doc/refman/5.7/en/change-replication-filter.html)
to configure the replica at runtime to replicate only the databases that
are configured with replicas and prevent any unexpected behavior.

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2024-07-01 11:19:02 -03:00
..
authz Only admins and maintainers can run scripts (#20001) 2024-06-26 08:22:54 -05:00
bindata Allow users to be readded if they were ever removed (#1945) 2021-09-07 13:33:40 -03:00
config Added FLEET_CALENDAR_PERIODICITY for internal demo use. (#19559) 2024-06-10 14:27:28 -05:00
contexts 🧹 friday cleanup party: substitute deprecated import of go-kit (#19774) 2024-06-17 10:27:31 -03:00
cron Add host's next maintenance window to the hosts/{id} and hosts/identifier/{identifier} endpoints, and render that data on the host details page (#19820) 2024-06-28 10:51:13 -07:00
datastore prevent errors on tests that use real replicas (#20121) 2024-07-01 11:19:02 -03:00
errorstore 🧹 friday cleanup party: substitute deprecated import of go-kit (#19774) 2024-06-17 10:27:31 -03:00
fleet Add host's next maintenance window to the hosts/{id} and hosts/identifier/{identifier} endpoints, and render that data on the host details page (#19820) 2024-06-28 10:51:13 -07:00
goose Move external dependency goose to monorepo (#15859) 2024-01-02 17:52:00 -03:00
health 🧹 friday cleanup party: substitute deprecated import of go-kit (#19774) 2024-06-17 10:27:31 -03:00
launcher 🧹 friday cleanup party: substitute deprecated import of go-kit (#19774) 2024-06-17 10:27:31 -03:00
live_query Address multiple redis-related issues observed with live queries (#16855) 2024-02-27 19:35:27 -06:00
logging 🧹 friday cleanup party: substitute deprecated import of go-kit (#19774) 2024-06-17 10:27:31 -03:00
mail support external id in STS Assume Role calls (#18901) 2024-05-21 13:19:35 -04:00
mdm use the latest fleetd-base version for MDM commands (#20078) 2024-06-28 16:35:07 -03:00
mock Add host's next maintenance window to the hosts/{id} and hosts/identifier/{identifier} endpoints, and render that data on the host details page (#19820) 2024-06-28 10:51:13 -07:00
policies 🧹 friday cleanup party: substitute deprecated import of go-kit (#19774) 2024-06-17 10:27:31 -03:00
ptr Add Description text to CVE Metadata (#13856) 2023-09-15 11:24:10 -06:00
pubsub Address multiple redis-related issues observed with live queries (#16855) 2024-02-27 19:35:27 -06:00
service fix: wrong types used (#20054) 2024-06-28 18:07:36 -04:00
sso chore: remove refs to deprecated io/ioutil (#14485) 2023-10-27 15:28:54 -03:00
test Merge conflicts 2024-04-16 10:20:59 -05:00
version Move external dependency fleetdm/kolide-kit to monorepo (#15861) 2024-01-02 18:22:52 -03:00
vulnerabilities Windows Vuln False Positives (#20012) 2024-06-26 09:43:57 -06:00
webhooks 🧹 friday cleanup party: substitute deprecated import of go-kit (#19774) 2024-06-17 10:27:31 -03:00
websocket Enable errcheck linter for golangci-lint (#8899) 2022-12-05 16:50:49 -06:00
worker use the latest fleetd-base version for MDM commands (#20078) 2024-06-28 16:35:07 -03:00
utils.go fix: return bad request error during MDM migration when appropriate (#16551) 2024-03-06 15:38:44 -05:00
utils_test.go feature: target profiles by labels (#16202) 2024-01-26 11:00:58 -05:00