test(core): интеграция Settings/Power на session-шине (#[ignore])
Settings round-trip + Changed; Power state + fake-ACC AccChanged — на живой D-Bus. just test-integration (dbus-run-session). #[ignore] → just ci (unit) не требует шины. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Alexander <akotenev2003@gmail.com>
This commit is contained in:
@@ -19,4 +19,5 @@ tracing.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile.workspace = true
|
||||
futures-util.workspace = true
|
||||
shturman-sdk = { path = "../../shturman-sdk" }
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
//! Интеграция `Power1` + dev-mock на session-шине. `#[ignore]` — запуск: `just test-integration`.
|
||||
//! Проверяет state по шине и fake-ACC: `dev.PowerMock1.SetAcc` → сигнал `Power1.AccChanged`.
|
||||
|
||||
use futures_util::StreamExt;
|
||||
use shturman_ipc::types::PowerState;
|
||||
use shturman_power::PowerService;
|
||||
use shturman_sdk::PowerClient;
|
||||
|
||||
#[tokio::test]
|
||||
#[ignore = "нужна session-шина: just test-integration"]
|
||||
async fn power_state_and_fake_acc() {
|
||||
let svc = PowerService::new();
|
||||
let mock = svc.mock();
|
||||
|
||||
// сервер: Power1 + dev.PowerMock1 на одном пути (владеет ru.shturman.Power)
|
||||
let server = zbus::Connection::session().await.unwrap();
|
||||
server
|
||||
.object_server()
|
||||
.at("/ru/shturman/Power", svc)
|
||||
.await
|
||||
.unwrap();
|
||||
server
|
||||
.object_server()
|
||||
.at("/ru/shturman/Power", mock)
|
||||
.await
|
||||
.unwrap();
|
||||
server.request_name("ru.shturman.Power").await.unwrap();
|
||||
|
||||
let client_conn = zbus::Connection::session().await.unwrap();
|
||||
let power = PowerClient::new(&client_conn).await.unwrap();
|
||||
assert_eq!(power.power_state().await.unwrap(), PowerState::Running);
|
||||
|
||||
// подписка на AccChanged
|
||||
let mut acc = power.proxy().receive_acc_changed().await.unwrap();
|
||||
|
||||
// dev.PowerMock1.SetAcc(false) сырым D-Bus-вызовом
|
||||
client_conn
|
||||
.call_method(
|
||||
Some("ru.shturman.Power"),
|
||||
"/ru/shturman/Power",
|
||||
Some("ru.shturman.dev.PowerMock1"),
|
||||
"SetAcc",
|
||||
&(false,),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let sig = acc.next().await.unwrap();
|
||||
assert!(!sig.args().unwrap().on());
|
||||
}
|
||||
Reference in New Issue
Block a user