Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mismatched internal/public enum copies #2571

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ public enum WebSocketCloseReason : int
ServerGracefulClose,
ClientDisconnect,
ServerDisconnect,
ActivityTimeout,
}
20 changes: 20 additions & 0 deletions test/ReverseProxy.FunctionalTests/TelemetryEnumTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using System.Linq;
using Xunit;

namespace Yarp.ReverseProxy;

public class TelemetryEnumTests
{
[Theory]
[InlineData(typeof(Telemetry.Consumption.ForwarderStage), typeof(Forwarder.ForwarderStage))]
[InlineData(typeof(Telemetry.Consumption.WebSocketCloseReason), typeof(WebSocketsTelemetry.WebSocketCloseReason))]
public void ExposedEnumsMatchInternalCopies(Type publicEnum, Type internalEnum)
{
Assert.Equal(internalEnum.GetEnumNames(), publicEnum.GetEnumNames());
Assert.Equal(internalEnum.GetEnumValues().Cast<int>().ToArray(), publicEnum.GetEnumValues().Cast<int>().ToArray());
}
}
Loading