Skip to content

Commit 8d90a35

Browse files
committed
Fix RabbitMQ version parsing
Turns out that Version.TryParse does not handle semver, and the following version will not be parsed: 3.8.5-alpha.8 This change removes all characters following the dash and the dash itself. https://ci.rabbitmq.com/teams/main/pipelines/dotnet/jobs/test/builds/343
1 parent aa5e8cb commit 8d90a35

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

projects/Unit/TestUpdateSecret.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ private bool RabbitMQ380OrHigher()
6969
if (properties.TryGetValue("version", out object versionVal))
7070
{
7171
string versionStr = Encoding.UTF8.GetString((byte[])versionVal);
72+
73+
int dashIdx = versionStr.IndexOf('-');
74+
if (dashIdx > 0)
75+
{
76+
versionStr = versionStr.Remove(dashIdx);
77+
}
78+
7279
if (Version.TryParse(versionStr, out Version version))
7380
{
7481
return version >= new Version(3, 8);

0 commit comments

Comments
 (0)