fix flaky TestIntegrationsMDM/TestDEPProfileAssignment (#11304)

This test was failing because we can send other commands when a DEP
device is enrolling (eg: to install a bootstrap package) and the test
was assuming that the first command we'll always get is the command to
install `fleetd`.

We have discussed in the past (@gillespi314 suggested that is important)
increasing the accuracy of the timestamps in the `nano_commadns` table,
which is the proper fix for this.
This commit is contained in:
Roberto Dip 2023-04-25 10:05:57 -03:00 committed by GitHub
parent 1fb9eeec64
commit 9cd51af022
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -558,14 +558,18 @@ func (s *integrationMDMTestSuite) TestDEPProfileAssignment() {
d.mdmEnroll(s)
// make sure the host gets a request to install fleetd
var fleetdCmd *micromdm.CommandPayload
cmd := d.idle()
require.NotNil(t, cmd)
require.NotNil(t, cmd.Command)
require.Equal(t, "InstallEnterpriseApplication", cmd.Command.RequestType)
require.NotNil(t, cmd.Command.InstallEnterpriseApplication)
// TODO: this seems flaky?
// require.NotNil(t, cmd.Command.InstallEnterpriseApplication.ManifestURL)
// require.Contains(t, *cmd.Command.InstallEnterpriseApplication.ManifestURL, apple_mdm.FleetdPublicManifestURL)
for cmd != nil {
if cmd.Command.RequestType == "InstallEnterpriseApplication" &&
cmd.Command.InstallEnterpriseApplication.ManifestURL != nil &&
strings.Contains(*cmd.Command.InstallEnterpriseApplication.ManifestURL, apple_mdm.FleetdPublicManifestURL) {
fleetdCmd = cmd
}
cmd = d.acknowledge(cmd.CommandUUID)
}
require.NotNil(t, fleetdCmd)
require.NotNil(t, fleetdCmd.Command)
// only one shows up as pending
listHostsRes = listHostsResponse{}