mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-24 17:26:47 +00:00
Merge branch 'feat/printer-agent-infra' into feat/printer-agent-impl
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <slic3r/Utils/IPrinterAgent.hpp>
|
||||
#include <slic3r/Utils/OrcaCloudServiceAgent.hpp>
|
||||
#include <slic3r/Utils/OrcaPrinterAgent.hpp>
|
||||
|
||||
@@ -85,7 +86,10 @@ TEST_CASE("OrcaPrinterAgent::make_lan_client_id is stable and prefixed", "[OrcaP
|
||||
|
||||
TEST_CASE("connect_printer wires up a LAN Config", "[OrcaPrinterAgent][.integration]") {
|
||||
Probe agent("/tmp");
|
||||
const int rc = agent.connect_printer("dev-1", "10.255.255.1", "orcasonar", "code", false);
|
||||
Slic3r::PrinterConnectionParams params{
|
||||
"dev-1", "10.255.255.1", "orcasonar", "code", "", false, ""
|
||||
};
|
||||
const int rc = agent.connect_printer(params);
|
||||
CHECK(rc == BAMBU_NETWORK_SUCCESS);
|
||||
CHECK(agent.lan_connection_target() == "ws://10.255.255.1:8280/mqtt");
|
||||
CHECK(agent.get_user_selected_machine().empty()); // LAN path must not touch the cloud selection
|
||||
@@ -174,7 +178,7 @@ TEST_CASE("send_message_to_printer publishes on the LAN connection", "[OrcaPrint
|
||||
orca_mqtt_test::MockBroker broker;
|
||||
OrcaPrinterAgent agent("/tmp");
|
||||
const auto ep = broker.host_port();
|
||||
agent.connect_printer("dev-1", ep.first + ":" + ep.second, "orcasonar", "code", false);
|
||||
agent.connect_printer(Slic3r::PrinterConnectionParams{"dev-1", ep.first + ":" + ep.second, "orcasonar", "code", "", false, ""});
|
||||
|
||||
for (int i = 0; i < 150 && broker.connect_count() == 0; ++i)
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||
@@ -197,7 +201,7 @@ TEST_CASE("send_message_to_printer publishes on the LAN connection", "[OrcaPrint
|
||||
TEST_CASE("destroying an agent mid-connect does not hang or crash", "[OrcaPrinterAgent]") {
|
||||
for (int i = 0; i < 20; ++i) {
|
||||
auto agent = std::make_unique<OrcaPrinterAgent>("/tmp");
|
||||
agent->connect_printer("dev-1", "127.0.0.1:1", "orcasonar", "code", false); // nothing listening: instant ECONNREFUSED
|
||||
agent->connect_printer(Slic3r::PrinterConnectionParams{"dev-1", "127.0.0.1:1", "orcasonar", "code", "", false, ""}); // nothing listening: instant ECONNREFUSED
|
||||
agent.reset(); // ~OrcaPrinterAgent must stop the conn, join the thread, and not hang/crash
|
||||
}
|
||||
SUCCEED();
|
||||
|
||||
Reference in New Issue
Block a user