[Thread] Replace the "ot-ctl factoryreset" with the java leave() API
The leave() API can now correctly clear the in-memory state for the Thread stack, it's better to use the leaveAndWait() API in the tests to ensure timing sequences Bug: 338061061 Change-Id: Ic91f8043cd5a35f19b9161c5778f83b83a713946
This commit is contained in:
parent
9de6f57d2d
commit
cbfe8c938e
4 changed files with 6 additions and 14 deletions
|
|
@ -113,8 +113,8 @@ public class ServiceDiscoveryTest {
|
|||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
mOtCtl.factoryReset();
|
||||
mController.setEnabledAndWait(true);
|
||||
mController.leaveAndWait();
|
||||
mController.joinAndWait(DEFAULT_DATASET);
|
||||
mNsdManager = mContext.getSystemService(NsdManager.class);
|
||||
|
||||
|
|
|
|||
|
|
@ -132,10 +132,6 @@ public class ThreadIntegrationTest {
|
|||
mOtCtl = new OtDaemonController();
|
||||
mController.setEnabledAndWait(true);
|
||||
mController.leaveAndWait();
|
||||
|
||||
// TODO: b/323301831 - This is a workaround to avoid unnecessary delay to re-form a network
|
||||
mOtCtl.factoryReset();
|
||||
|
||||
mFtd = new FullThreadDevice(10 /* nodeId */);
|
||||
}
|
||||
|
||||
|
|
@ -352,7 +348,6 @@ public class ThreadIntegrationTest {
|
|||
mOtCtl.executeCommand("netdata register");
|
||||
|
||||
mController.leaveAndWait();
|
||||
mOtCtl.factoryReset();
|
||||
mController.joinAndWait(DEFAULT_DATASET);
|
||||
|
||||
LinkProperties lp = cm.getLinkProperties(getThreadNetwork(CALLBACK_TIMEOUT));
|
||||
|
|
|
|||
|
|
@ -66,11 +66,7 @@ public class ThreadNetworkShellCommandTest {
|
|||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
// TODO(b/366141754): The current implementation of "thread_network ot-ctl factoryreset"
|
||||
// results in timeout error.
|
||||
// A future fix will provide proper support for factoryreset, allowing us to replace the
|
||||
// legacy "ot-ctl".
|
||||
mOtCtl.factoryReset();
|
||||
mController.leaveAndWait();
|
||||
|
||||
mFtd = new FullThreadDevice(10 /* nodeId */);
|
||||
ensureThreadEnabled();
|
||||
|
|
|
|||
|
|
@ -603,11 +603,12 @@ object IntegrationTestUtils {
|
|||
/** Enables Thread and joins the specified Thread network. */
|
||||
@JvmStatic
|
||||
fun enableThreadAndJoinNetwork(dataset: ActiveOperationalDataset) {
|
||||
// TODO: b/323301831 - This is a workaround to avoid unnecessary delay to re-form a network
|
||||
OtDaemonController().factoryReset();
|
||||
|
||||
val context: Context = requireNotNull(ApplicationProvider.getApplicationContext());
|
||||
val controller = requireNotNull(ThreadNetworkControllerWrapper.newInstance(context));
|
||||
|
||||
// TODO: b/323301831 - This is a workaround to avoid unnecessary delay to re-form a network
|
||||
controller.leaveAndWait();
|
||||
|
||||
controller.setEnabledAndWait(true);
|
||||
controller.joinAndWait(dataset);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue