功能:完善通用云管工作台、审计与诊断能力
This commit is contained in:
1 parent
5ac692724d
commit
9f05aa20ea
225 files changed
+14266
-141
No files matched your search
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "desktop_list_page.h"
|
||||
#include "main_window.h"
|
||||
#include "platform_client.h"
|
||||
|
||||
namespace vdi {
|
||||
|
||||
@@ -26,6 +27,10 @@ public:
|
||||
int delayMs = 0;
|
||||
int authRequests = 0;
|
||||
int listRequests = 0;
|
||||
bool sharedGPU = false;
|
||||
bool prepareFailed = false;
|
||||
int preparePolls = 0;
|
||||
int ticketRequests = 0;
|
||||
|
||||
protected:
|
||||
void incomingConnection(qintptr descriptor) override {
|
||||
@@ -55,8 +60,24 @@ protected:
|
||||
++listRequests;
|
||||
body["items"] = QJsonArray{QJsonObject{
|
||||
{"id", "authorized-desktop"}, {"name", "Authorized Windows"},
|
||||
{"os", "Windows"}, {"powerState", "running"},
|
||||
{"os", "Windows"}, {"powerState", sharedGPU ? "stopped" : "running"},
|
||||
{"powerOnConnect", sharedGPU},
|
||||
{"endpoint", "127.0.0.1"}, {"app", "Desktop"}}};
|
||||
} else if (path == "/api/v1/terminal/desktop-prepare") {
|
||||
status = 202;
|
||||
body["taskId"] = "prepare-task";
|
||||
body["status"] = "queued";
|
||||
} else if (path == "/api/v1/terminal/desktop-prepare/prepare-task") {
|
||||
++preparePolls;
|
||||
body["status"] = prepareFailed ? "failed" : (preparePolls > 1 ? "success" : "running");
|
||||
body["message"] = "prepare test result";
|
||||
} else if (path == "/api/v1/terminal/connect-ticket") {
|
||||
++ticketRequests;
|
||||
status = 201;
|
||||
body["ticket"] = "prepared-ticket";
|
||||
} else if (path == "/api/v1/terminal/connect-ticket/consume") {
|
||||
body = QJsonObject{{"desktopId", "authorized-desktop"}, {"sessionId", "prepared-session"},
|
||||
{"endpoint", "127.0.0.1"}, {"width", 2560}, {"height", 1440}, {"fps", 45}};
|
||||
} else {
|
||||
body["items"] = QJsonArray{};
|
||||
}
|
||||
@@ -210,6 +231,38 @@ private slots:
|
||||
QVERIFY(selectionVisible(window));
|
||||
QVERIFY(!window.deviceAuthTimer_->isActive());
|
||||
}
|
||||
void sharedDesktopWaitsBeforeIssuingTicket() {
|
||||
for (bool fail : {false, true}) {
|
||||
TestPlatform server;
|
||||
QVERIFY(server.listen(QHostAddress::LocalHost, 0));
|
||||
configure(server, server.serverPort());
|
||||
server.sharedGPU = true;
|
||||
server.prepareFailed = fail;
|
||||
PlatformClient client;
|
||||
bool authenticated = false;
|
||||
client.authenticate([&](const AuthResult& result) { authenticated = result.ok; });
|
||||
QTRY_VERIFY(authenticated);
|
||||
bool listed = false;
|
||||
client.list([&](std::vector<DesktopInfo> desktops, const QString& error) {
|
||||
QVERIFY(error.isEmpty());
|
||||
QCOMPARE(desktops.size(), size_t(1));
|
||||
QVERIFY(desktops[0].powerOnConnect && desktops[0].poweredOff);
|
||||
QCOMPARE(desktops[0].state, DesktopState::kAvailable);
|
||||
listed = true;
|
||||
});
|
||||
QTRY_VERIFY(listed);
|
||||
bool completed = false;
|
||||
client.ticket("authorized-desktop", [&](const ConnectionTicket& ticket, const QString& error) {
|
||||
QCOMPARE(error.isEmpty(), !fail);
|
||||
if (!fail) QCOMPARE(ticket.sessionId, QString("prepared-session"));
|
||||
completed = true;
|
||||
});
|
||||
QTRY_VERIFY(server.preparePolls > 0);
|
||||
QCOMPARE(server.ticketRequests, 0);
|
||||
QTRY_VERIFY(completed);
|
||||
QCOMPARE(server.ticketRequests, fail ? 0 : 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace vdi
|
||||
|
||||
Reference in new issue
Block a user