Skip to content

Commit 322a00e

Browse files
authored
test: Improve random topic naming for Kafka integration tests (#2048)
1 parent f644e0f commit 322a00e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/Agent/IntegrationTests/ContainerIntegrationTests/LinuxKafkaTests.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System;
55
using System.Collections.Generic;
66
using System.Linq;
7+
using System.Security.Cryptography;
78
using System.Text;
89
using NewRelic.Agent.ContainerIntegrationTests.ContainerFixtures;
910
using NewRelic.Agent.IntegrationTestHelpers;
@@ -19,7 +20,6 @@ public abstract class LinuxKafkaTest<T> : NewRelicIntegrationTest<T> where T : L
1920

2021
internal string _topicName;
2122
private readonly T _fixture;
22-
private readonly static Random _rnd = new();
2323

2424
protected LinuxKafkaTest(T fixture, ITestOutputHelper output) : base(fixture)
2525
{
@@ -105,7 +105,7 @@ internal static string GenerateTopic()
105105
var builder = new StringBuilder();
106106
for (int i = 0; i < TopicNameLength; i++)
107107
{
108-
var shifter = Convert.ToInt32(Math.Floor(25 * _rnd.NextDouble()));
108+
var shifter= RandomNumberGenerator.GetInt32(0, 26);
109109
builder.Append(Convert.ToChar(shifter + 65));
110110
}
111111

0 commit comments

Comments
 (0)