mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 10:53:44 +00:00
feat(master): UPDATE_STATUS from the dashboard, logged when it changes
Appended message ID 50 (dashboard -> master): the update check's state and a one-line summary. Master logs it whenever the summary changes, so the first one after master starts says when an update is out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "master/WorldFiles.h"
|
||||
#include "master/MessageCapture.h"
|
||||
#include "master/PlayerAction.h"
|
||||
#include "master/UpdateStatus.h"
|
||||
#include "PacketDispatcher.h"
|
||||
#include "PacketTestUtils.h"
|
||||
#include "Game.h"
|
||||
@@ -672,6 +673,31 @@ TEST(MasterPacketsTests, WorldFilesStatus) {
|
||||
EXPECT_EQ(read.zones, status.zones);
|
||||
}
|
||||
|
||||
TEST(MasterPacketsTests, UpdateStatus) {
|
||||
UpdateStatus status;
|
||||
status.state = 2;
|
||||
status.summary = "Update available: release v3.1.0 (this server is running release v3.0.0)";
|
||||
ExpectHeaderThenSerialize(status, MessageType::Master::UPDATE_STATUS);
|
||||
|
||||
RakNet::BitStream stream;
|
||||
status.Serialize(stream);
|
||||
UpdateStatus read;
|
||||
ASSERT_TRUE(read.Deserialize(stream));
|
||||
EXPECT_EQ(read.state, 2);
|
||||
EXPECT_EQ(read.summary, status.summary);
|
||||
|
||||
// Longer than the cap: cut on the way out, refused on the way in
|
||||
status.summary.assign(UpdateStatus::MAX_SUMMARY + 10, 'x');
|
||||
RakNet::BitStream cut;
|
||||
status.Serialize(cut);
|
||||
ASSERT_TRUE(read.Deserialize(cut));
|
||||
EXPECT_EQ(read.summary.size(), UpdateStatus::MAX_SUMMARY);
|
||||
RakNet::BitStream tooLong;
|
||||
tooLong.Write<uint8_t>(1);
|
||||
tooLong.Write<uint16_t>(UpdateStatus::MAX_SUMMARY + 1);
|
||||
EXPECT_FALSE(read.Deserialize(tooLong));
|
||||
}
|
||||
|
||||
// A master without the outdated flags (written after the endpoints) still reads: nothing is outdated
|
||||
TEST(MasterPacketsTests, ServerListWithoutOutdatedFlags) {
|
||||
MasterPackets::ServerListResponse response;
|
||||
|
||||
Reference in New Issue
Block a user