diff --git a/thread/tests/integration/src/android/net/thread/ServiceDiscoveryTest.java b/thread/tests/integration/src/android/net/thread/ServiceDiscoveryTest.java index 6c2a9bbf7b..f959ccfe58 100644 --- a/thread/tests/integration/src/android/net/thread/ServiceDiscoveryTest.java +++ b/thread/tests/integration/src/android/net/thread/ServiceDiscoveryTest.java @@ -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); diff --git a/thread/tests/integration/src/android/net/thread/ThreadIntegrationTest.java b/thread/tests/integration/src/android/net/thread/ThreadIntegrationTest.java index 7a5895fed1..2641a77364 100644 --- a/thread/tests/integration/src/android/net/thread/ThreadIntegrationTest.java +++ b/thread/tests/integration/src/android/net/thread/ThreadIntegrationTest.java @@ -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)); diff --git a/thread/tests/integration/src/android/net/thread/ThreadNetworkShellCommandTest.java b/thread/tests/integration/src/android/net/thread/ThreadNetworkShellCommandTest.java index 2f0ab34adf..ac688dda34 100644 --- a/thread/tests/integration/src/android/net/thread/ThreadNetworkShellCommandTest.java +++ b/thread/tests/integration/src/android/net/thread/ThreadNetworkShellCommandTest.java @@ -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(); diff --git a/thread/tests/integration/src/android/net/thread/utils/IntegrationTestUtils.kt b/thread/tests/integration/src/android/net/thread/utils/IntegrationTestUtils.kt index 801e21e33e..f00c9cdf81 100644 --- a/thread/tests/integration/src/android/net/thread/utils/IntegrationTestUtils.kt +++ b/thread/tests/integration/src/android/net/thread/utils/IntegrationTestUtils.kt @@ -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); }