@@ -897,6 +897,51 @@ ZTEST(conn_mgr_conn, test_timeout_invalid)
897897 "Getting timeout should yield CONN_MGR_IF_NO_TIMEOUT for ifnone" );
898898}
899899
900+ /* Verify that idle timeout get/set functions operate correctly (A/B) */
901+ ZTEST (conn_mgr_conn , test_idle_timeout )
902+ {
903+ struct conn_mgr_conn_binding * ifa1_binding = conn_mgr_if_get_binding (ifa1 );
904+
905+ /* Try setting idle timeout */
906+ zassert_equal (conn_mgr_if_set_idle_timeout (ifa1 , 99 ), 0 ,
907+ "Setting idle timeout should succeed for ifa1" );
908+
909+ /* Verify success */
910+ zassert_equal (conn_mgr_if_get_idle_timeout (ifa1 ), 99 ,
911+ "Idle timeout should be set to 99 for ifa1" );
912+
913+ /* Verify that the conn struct agrees, since this is what implementations may use */
914+ zassert_equal (ifa1_binding -> idle_timeout , 99 , "Idle timeout set should affect conn struct" );
915+
916+ /* Try unsetting idle timeout */
917+ zassert_equal (conn_mgr_if_set_idle_timeout (ifa1 , CONN_MGR_IF_NO_TIMEOUT ), 0 ,
918+ "Unsetting idle timeout should succeed for ifa1" );
919+
920+ /* Verify success */
921+ zassert_equal (conn_mgr_if_get_idle_timeout (ifa1 ), CONN_MGR_IF_NO_TIMEOUT ,
922+ "Idle timeout should be unset for ifa1" );
923+
924+ /* Verify that the conn struct agrees, since this is what implementations may use */
925+ zassert_equal (ifa1_binding -> idle_timeout , CONN_MGR_IF_NO_TIMEOUT ,
926+ "Idle timeout unset should affect conn struct" );
927+ }
928+
929+ /* Verify that idle timeout get/set fail and behave as expected respectively for invalid ifaces */
930+ ZTEST (conn_mgr_conn , test_idle_timeout_invalid )
931+ {
932+ /* Verify set failure */
933+ zassert_equal (conn_mgr_if_set_idle_timeout (ifnull , 99 ), - ENOTSUP ,
934+ "Setting idle timeout should fail for ifnull" );
935+ zassert_equal (conn_mgr_if_set_idle_timeout (ifnone , 99 ), - ENOTSUP ,
936+ "Setting idle timeout should fail for ifnone" );
937+
938+ /* Verify get graceful behavior */
939+ zassert_equal (conn_mgr_if_get_idle_timeout (ifnull ), CONN_MGR_IF_NO_TIMEOUT ,
940+ "Getting idle timeout should yield CONN_MGR_IF_NO_TIMEOUT for ifnull" );
941+ zassert_equal (conn_mgr_if_get_idle_timeout (ifnone ), CONN_MGR_IF_NO_TIMEOUT ,
942+ "Getting idle timeout should yield CONN_MGR_IF_NO_TIMEOUT for ifnone" );
943+ }
944+
900945/* Verify that auto-connect works as expected. */
901946ZTEST (conn_mgr_conn , test_auto_connect )
902947{
0 commit comments