This test checks the queryable backup mode, by shutting down a secondary node, restaring it with the --queryableBackupMode flag, and then issuing reads considering writes should be forbidden in that mode. As part of the test, there is a read right after stopping a secondary node that tries to get the primary of the replica set, and if the primary stop getting heartbeats from the secondary (i.e. they could be taking too long in slow machine tests), then there won't be any primary to query, causing the test to fail.
This is a test issue, the reason of the read is to get the shard identity string that will allow the stopped node to be restarted as queryable, so, in order to fix this issue we could simply move the read right before stopping the secondary node.