The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). Additional documentation and release notes are available at [Multiplayer Documentation](https://docs-multiplayer.unity3d.com). ## [1.0.0-pre.3] - 2021-10-22 ### Added - ResetTrigger function to NetworkAnimator (#1327) ### Fixed - Overflow exception when syncing Animator state. (#1327) - Added `try`/`catch` around RPC calls, preventing exception from causing further RPC calls to fail (#1329) - Fixed an issue where ServerClientId and LocalClientId could have the same value, causing potential confusion, and also fixed an issue with the UNet where the server could be identified with two different values, one of which might be the same as LocalClientId, and the other of which would not.(#1368) - IL2CPP would not properly compile (#1359)
57 lines
2.3 KiB
C#
57 lines
2.3 KiB
C#
#if MULTIPLAYER_TOOLS
|
|
using System;
|
|
using System.Collections;
|
|
using System.Linq;
|
|
using NUnit.Framework;
|
|
using Unity.Multiplayer.Tools.MetricTypes;
|
|
using Unity.Netcode.RuntimeTests.Metrics.Utility;
|
|
using UnityEngine.TestTools;
|
|
|
|
namespace Unity.Netcode.RuntimeTests.Metrics
|
|
{
|
|
internal class ServerLogsMetricTests : SingleClientMetricTestBase
|
|
{
|
|
private static readonly int k_ServerLogSentMessageOverhead = 2 + FastBufferWriter.GetWriteSize<MessageHeader>();
|
|
private static readonly int k_ServerLogReceivedMessageOverhead = 2;
|
|
|
|
[UnityTest]
|
|
public IEnumerator TrackServerLogSentMetric()
|
|
{
|
|
var waitForSentMetric = new WaitForMetricValues<ServerLogEvent>(ClientMetrics.Dispatcher, NetworkMetricTypes.ServerLogSent);
|
|
|
|
var message = Guid.NewGuid().ToString();
|
|
NetworkLog.LogWarningServer(message);
|
|
|
|
yield return waitForSentMetric.WaitForMetricsReceived();
|
|
|
|
var sentMetrics = waitForSentMetric.AssertMetricValuesHaveBeenFound();
|
|
Assert.AreEqual(1, sentMetrics.Count);
|
|
|
|
var sentMetric = sentMetrics.First();
|
|
Assert.AreEqual(Server.LocalClientId, sentMetric.Connection.Id);
|
|
Assert.AreEqual((uint)NetworkLog.LogType.Warning, (uint)sentMetric.LogLevel);
|
|
Assert.AreEqual(message.Length + k_ServerLogSentMessageOverhead, sentMetric.BytesCount);
|
|
}
|
|
|
|
[UnityTest]
|
|
public IEnumerator TrackServerLogReceivedMetric()
|
|
{
|
|
var waitForReceivedMetric = new WaitForMetricValues<ServerLogEvent>(ServerMetrics.Dispatcher, NetworkMetricTypes.ServerLogReceived);
|
|
|
|
var message = Guid.NewGuid().ToString();
|
|
NetworkLog.LogWarningServer(message);
|
|
|
|
yield return waitForReceivedMetric.WaitForMetricsReceived();
|
|
|
|
var receivedMetrics = waitForReceivedMetric.AssertMetricValuesHaveBeenFound();
|
|
Assert.AreEqual(1, receivedMetrics.Count);
|
|
|
|
var receivedMetric = receivedMetrics.First();
|
|
Assert.AreEqual(Client.LocalClientId, receivedMetric.Connection.Id);
|
|
Assert.AreEqual((uint)NetworkLog.LogType.Warning, (uint)receivedMetric.LogLevel);
|
|
Assert.AreEqual(message.Length + k_ServerLogReceivedMessageOverhead, receivedMetric.BytesCount);
|
|
}
|
|
}
|
|
}
|
|
#endif
|