Add android_devices to hosts-related tables to delete (#26568)

This commit is contained in:
Martin Angers 2025-02-24 17:09:21 -05:00 committed by GitHub
parent 4abbb5e06e
commit dd6124bff9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View file

@ -542,6 +542,7 @@ var hostRefs = []string{
"host_mdm_actions",
"host_calendar_events",
"upcoming_activities",
"android_devices",
}
// NOTE: The following tables are explicity excluded from hostRefs list and accordingly are not

View file

@ -7055,6 +7055,13 @@ func testHostsDeleteHosts(t *testing.T, ds *Datastore) {
require.NoError(t, err)
require.True(t, added)
// create an android device from this host
_, err = ds.writer(context.Background()).Exec(`
INSERT INTO android_devices (host_id, device_id)
VALUES (?, ?);
`, host.ID, uuid.NewString())
require.NoError(t, err)
// Check there's an entry for the host in all the associated tables.
for _, hostRef := range hostRefs {
var ok bool