From e3056ffc97640c2791f73bc2aa24b0db07b9d60b Mon Sep 17 00:00:00 2001
From: chenjiayi <chenjiayi22@huawei.com>
Date: Mon, 20 Nov 2023 14:47:22 +0800
Subject: [PATCH 074/103] test(devmaster): trigger add and remove uevent to
 cover netif renaming procedure

The netif renaming procedure executes only when a add uevent of netif raised.

In addition, the remove process was not covered previously.
---
 exts/devmaster/src/bin/devctl/daemon/mod.rs | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/exts/devmaster/src/bin/devctl/daemon/mod.rs b/exts/devmaster/src/bin/devctl/daemon/mod.rs
index 53931650..4aa957a4 100644
--- a/exts/devmaster/src/bin/devctl/daemon/mod.rs
+++ b/exts/devmaster/src/bin/devctl/daemon/mod.rs
@@ -61,7 +61,10 @@ mod test {
 
     #[test]
     fn test_run_daemon() {
-        /* Require root privilege, skip in ci environment. */
+        /* Require root privilege, skip in ci environment.
+         *
+         * In addition, this test case will fail when devmaster daemon is running.
+         */
         let dev = Device::from_subsystem_sysname("net", "lo").unwrap();
         if dev.trigger(DeviceAction::Change).is_err() {
             return;
@@ -73,9 +76,9 @@ mod test {
             let dev = Device::from_subsystem_sysname("net", "lo").unwrap();
 
             /* Trigger more than the number of workers. */
-            dev.trigger(DeviceAction::Change).unwrap();
-            dev.trigger(DeviceAction::Change).unwrap();
-            dev.trigger(DeviceAction::Change).unwrap();
+            dev.trigger(DeviceAction::Remove).unwrap();
+            dev.trigger(DeviceAction::Add).unwrap();
+            dev.trigger(DeviceAction::Add).unwrap();
             dev.trigger(DeviceAction::Change).unwrap();
             dev.trigger(DeviceAction::Change).unwrap();
             dev.trigger(DeviceAction::Change).unwrap();
-- 
2.33.0

