Skip to content

Commit

Permalink
Update various package versions (#2453)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesNK committed Jun 6, 2024
1 parent 0ea0112 commit 775d1fb
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 29 deletions.
6 changes: 6 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" />
</ItemGroup>

<ItemGroup Condition="$(MSBuildProjectName.EndsWith('Tests'))">
<Using Include="NUnit.Framework.Legacy.ClassicAssert" Alias="Assert" />
<Using Include="NUnit.Framework.Legacy" />
<Using Include="NUnit.Framework" />
</ItemGroup>

<!--
Make a netstandard2.1 copy of the .net ILLinkPack to work around a trimming issue.
See https://github.com/dotnet/linker/issues/3175
Expand Down
12 changes: 6 additions & 6 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,21 @@
<!-- Other -->
<PackageVersion Include="BenchmarkDotNet" Version="0.13.1" />
<PackageVersion Include="CommandLineParser" Version="2.5.0" />
<PackageVersion Include="Google.Api.CommonProtos" Version="2.13.0" />
<PackageVersion Include="Google.Api.CommonProtos" Version="2.15.0" />
<PackageVersion Include="Google.Apis.Auth" Version="1.46.0" />
<PackageVersion Include="Google.Protobuf" Version="3.24.0" />
<PackageVersion Include="Google.Protobuf" Version="3.27.0" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
<PackageVersion Include="Microsoft.Build.Locator" Version="1.5.5" />
<PackageVersion Include="Microsoft.Build" Version="16.9.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0-preview.23472.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0" />
<PackageVersion Include="Microsoft.Crank.EventSources" Version="0.2.0-alpha.21255.1" />
<PackageVersion Include="Microsoft.Extensions.Logging.Testing" Version="2.1.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.6.2" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<PackageVersion Include="Microsoft.Win32.Registry" Version="4.6.0" />
<PackageVersion Include="Moq" Version="4.16.1" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="Nunit" Version="3.13.3" />
<PackageVersion Include="Nunit" Version="4.1.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageVersion Include="protobuf-net.Grpc.AspNetCore" Version="1.0.140" />
<PackageVersion Include="protobuf-net.Grpc" Version="1.0.140" />
Expand All @@ -81,7 +81,7 @@
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="6.0.1" />
<PackageVersion Include="System.IO.Pipelines" Version="5.0.1" />
<PackageVersion Include="System.Memory" Version="4.5.3" />
<PackageVersion Include="System.Net.Http.WinHttpHandler" Version="7.0.0" />
<PackageVersion Include="System.Net.Http.WinHttpHandler" Version="8.0.0" />
<PackageVersion Include="System.Security.Principal.Windows" Version="4.7.0" />
<PackageVersion Include="System.Threading.Channels" Version="4.6.0" />
</ItemGroup>
Expand Down
8 changes: 7 additions & 1 deletion test/FunctionalTests/Balancer/DnsResolverTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public async Task RefreshAsync_MultipleCallsThenCancellation_CallCanceled()
var dnsResolver = CreateDnsResolver(new Uri("dns:///localhost"));
dnsResolver.Start(r =>
{
tcs.SetResult(r);
tcs.TrySetResult(r);
});

// Act
Expand All @@ -286,13 +286,19 @@ public async Task RefreshAsync_MultipleCallsThenCancellation_CallCanceled()
Assert.Greater(result.Addresses!.Count, 0);

// Wait for the internal resolve task to be completed before triggering refresh again
Logger.LogInformation("Wait for DNS resolver resolve task to complete.");
await dnsResolver._resolveTask.DefaultTimeout();

Logger.LogInformation("Recreate TCS and refresh resolver again.");
tcs = new TaskCompletionSource<ResolverResult>(TaskCreationOptions.RunContinuationsAsynchronously);
dnsResolver.Refresh();

Logger.LogInformation("Dispose resolver while refresh is in progress. The refresh should be waiting for the min interval to complete.");
dnsResolver.Dispose();

result = await tcs.Task.DefaultTimeout();

Logger.LogInformation("Received result from disposing resolver.");
Assert.AreEqual(StatusCode.Unavailable, result.Status.StatusCode);
Assert.AreEqual("Error getting DNS hosts for address 'localhost'. TaskCanceledException: A task was canceled.", result.Status.Detail);
Assert.AreEqual("A task was canceled.", result.Status.DebugException!.Message);
Expand Down
2 changes: 1 addition & 1 deletion test/FunctionalTests/Client/UnaryTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#region Copyright notice and license
#region Copyright notice and license

// Copyright 2019 The gRPC Authors
//
Expand Down
5 changes: 3 additions & 2 deletions test/FunctionalTests/Infrastructure/RequireHttp3Attribute.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#region Copyright notice and license
#region Copyright notice and license

// Copyright 2019 The gRPC Authors
//
Expand All @@ -16,6 +16,7 @@

#endregion

using System.Diagnostics.CodeAnalysis;
using NUnit.Framework;
using NUnit.Framework.Interfaces;
using NUnit.Framework.Internal;
Expand All @@ -41,7 +42,7 @@ public void ApplyToTest(NUnit.Framework.Internal.Test test)
test.Properties.Set(PropertyNames.SkipReason, message!);
}

public static bool IsSupported(out string? message)
public static bool IsSupported([NotNullWhen(false)] out string? message)
{
var osVersion = Environment.OSVersion;
if (osVersion.Platform == PlatformID.Win32NT &&
Expand Down
2 changes: 1 addition & 1 deletion test/Grpc.Core.Api.Tests/Grpc.Core.Api.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net462;net6.0</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

Expand Down
2 changes: 1 addition & 1 deletion test/Grpc.Core.Api.Tests/RpcExceptionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void DefaultMessageDoesntContainDebugExceptionStacktrace()
var ex = new RpcException(new Status(StatusCode.Internal, "abc", someExceptionWithStacktrace));
// Check debug exceptions's message is contained.
StringAssert.Contains(someExceptionWithStacktrace.Message, ex.Message);
StringAssert.Contains(someExceptionWithStacktrace.GetType().FullName, ex.Message);
StringAssert.Contains(someExceptionWithStacktrace.GetType().FullName!, ex.Message);
// If name of the current method is not in the message, it probably doesn't contain the stack trace.
StringAssert.DoesNotContain(nameof(DefaultMessageDoesntContainDebugExceptionStacktrace), ex.Message);
}
Expand Down
4 changes: 2 additions & 2 deletions test/Grpc.Core.Api.Tests/VersionInfoTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ public void VersionInfoMatchesAssemblyProperties()
var assemblyVersion = assembly!.GetName()!.Version!.ToString()!;
Assert.AreEqual(VersionInfo.CurrentAssemblyVersion, assemblyVersion);

string assemblyFileVersion = FileVersionInfo.GetVersionInfo(assembly.Location)!.FileVersion;
string assemblyFileVersion = FileVersionInfo.GetVersionInfo(assembly.Location).FileVersion!;
string assemblyFileVersionFromAttribute = assembly.GetCustomAttribute<AssemblyFileVersionAttribute>()!.Version;
Assert.AreEqual(VersionInfo.CurrentAssemblyFileVersion, assemblyFileVersion);
Assert.AreEqual(VersionInfo.CurrentAssemblyFileVersion, assemblyFileVersionFromAttribute);

string productVersion = FileVersionInfo.GetVersionInfo(assembly.Location)!.ProductVersion;
string productVersion = FileVersionInfo.GetVersionInfo(assembly.Location).ProductVersion!;
string informationalVersionFromAttribute = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()!.InformationalVersion;
Assert.AreEqual(productVersion, informationalVersionFromAttribute);
// grpc-dotnet appends commit SHA to the product version (e.g. "2.45.0-dev+e30038495bd26b812b6684049353c045d1049d3c")
Expand Down
2 changes: 1 addition & 1 deletion test/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net462;net6.0</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion test/Grpc.Reflection.Tests/Grpc.Reflection.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net462;net6.0</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

Expand Down
3 changes: 1 addition & 2 deletions test/Grpc.Reflection.Tests/SymbolRegistryTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#region Copyright notice and license
#region Copyright notice and license
// Copyright 2015 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -18,7 +18,6 @@
using Grpc.Reflection.V1Alpha;
using NUnit.Framework;


namespace Grpc.Reflection.Tests;

/// <summary>
Expand Down
5 changes: 2 additions & 3 deletions test/dotnet-grpc.Tests/AddFileCommandTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#region Copyright notice and license
#region Copyright notice and license

// Copyright 2019 The gRPC Authors
//
Expand Down Expand Up @@ -44,7 +44,7 @@ public async Task Commandline_AddFileCommand_AddsPackagesAndReferences()
var result = await parser.InvokeAsync($"add-file -p {tempDir} -s Server --access Internal -i ImportDir {Path.Combine("Proto", "*.proto")}", testConsole);

// Assert
Assert.AreEqual(0, result, testConsole.Error.ToString());
Assert.AreEqual(0, result, testConsole.Error.ToString()!);

var project = ProjectCollection.GlobalProjectCollection.LoadedProjects.Single(p => p.DirectoryPath == tempDir);
project.ReevaluateIfNecessary();
Expand All @@ -53,7 +53,6 @@ public async Task Commandline_AddFileCommand_AddsPackagesAndReferences()
Assert.AreEqual(1, packageRefs.Count);
Assert.NotNull(packageRefs.SingleOrDefault(r => r.UnevaluatedInclude == "Grpc.AspNetCore" && !r.HasMetadata(CommandBase.PrivateAssetsElement)));


var protoRefs = project.GetItems(CommandBase.ProtobufElement);
Assert.AreEqual(2, protoRefs.Count);
Assert.NotNull(protoRefs.SingleOrDefault(r => r.UnevaluatedInclude == "Proto\\a.proto"));
Expand Down
4 changes: 2 additions & 2 deletions test/dotnet-grpc.Tests/AddUrlCommandTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#region Copyright notice and license
#region Copyright notice and license

// Copyright 2019 The gRPC Authors
//
Expand Down Expand Up @@ -46,7 +46,7 @@ public async Task Commandline_AddUrlCommand_AddsPackagesAndReferences()
var result = await parser.InvokeAsync($"add-url -p {tempDir} -s Server --access Internal -i ImportDir -o {Path.Combine("Proto", "c.proto")} {SourceUrl}", testConsole);

// Assert
Assert.AreEqual(0, result, testConsole.Error.ToString());
Assert.AreEqual(0, result, testConsole.Error.ToString()!);

var project = ProjectCollection.GlobalProjectCollection.LoadedProjects.Single(p => p.DirectoryPath == tempDir);
project.ReevaluateIfNecessary();
Expand Down
4 changes: 2 additions & 2 deletions test/dotnet-grpc.Tests/ListCommandTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#region Copyright notice and license
#region Copyright notice and license

// Copyright 2019 The gRPC Authors
//
Expand Down Expand Up @@ -44,7 +44,7 @@ public async Task Commandline_List_ListsReferences()
var result = await parser.InvokeAsync($"list -p {tempDir}", testConsole);

// Assert
Assert.AreEqual(0, result, testConsole.Error.ToString());
Assert.AreEqual(0, result, testConsole.Error.ToString()!);

var project = ProjectCollection.GlobalProjectCollection.LoadedProjects.Single(p => p.DirectoryPath == tempDir);
project.ReevaluateIfNecessary();
Expand Down
4 changes: 2 additions & 2 deletions test/dotnet-grpc.Tests/RefreshCommandTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#region Copyright notice and license
#region Copyright notice and license

// Copyright 2019 The gRPC Authors
//
Expand Down Expand Up @@ -46,7 +46,7 @@ public async Task Commandline_Refresh_RefreshesReferences(bool dryRun)
var result = await parser.InvokeAsync($"refresh -p {tempDir} --dry-run {dryRun}", testConsole);

// Assert
Assert.AreEqual(0, result, testConsole.Error.ToString());
Assert.AreEqual(0, result, testConsole.Error.ToString()!);

var project = ProjectCollection.GlobalProjectCollection.LoadedProjects.Single(p => p.DirectoryPath == tempDir);
project.ReevaluateIfNecessary();
Expand Down
4 changes: 2 additions & 2 deletions test/dotnet-grpc.Tests/RemoveCommandTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#region Copyright notice and license
#region Copyright notice and license

// Copyright 2019 The gRPC Authors
//
Expand Down Expand Up @@ -43,7 +43,7 @@ public async Task Commandline_Remove_RemovesReferences()
var result = await parser.InvokeAsync($"remove -p {tempDir} {Path.Combine("Proto", "a.proto")}", testConsole);

// Assert
Assert.AreEqual(0, result, testConsole.Error.ToString());
Assert.AreEqual(0, result, testConsole.Error.ToString()!);

var project = ProjectCollection.GlobalProjectCollection.LoadedProjects.Single(p => p.DirectoryPath == tempDir);
project.ReevaluateIfNecessary();
Expand Down

0 comments on commit 775d1fb

Please sign in to comment.