Let DSCP policy test accept early network agent creation
Test: DscpPolicyTest with and without the early creation patches
Change-Id: I87e9d710e54e861a5f6c2767da7db67329e1bb59
diff --git a/tests/cts/net/src/android/net/cts/DscpPolicyTest.kt b/tests/cts/net/src/android/net/cts/DscpPolicyTest.kt
index df4dab5..d531e7a 100644
--- a/tests/cts/net/src/android/net/cts/DscpPolicyTest.kt
+++ b/tests/cts/net/src/android/net/cts/DscpPolicyTest.kt
@@ -774,7 +774,9 @@
runAsShell(MANAGE_TEST_NETWORKS) { agent.register() }
// Without the fix, this will crash the system with SIGSEGV.
agent.sendAddDscpPolicy(DscpPolicy.Builder(1, 1).build())
- agent.expectCallback<OnDscpPolicyStatusUpdated>()
+ // Will receive OnNetworkCreated first if the agent is created early. To avoid reading
+ // the flag here, use eventuallyExpect.
+ agent.eventuallyExpect<OnDscpPolicyStatusUpdated>()
}
}