Skip to content

Commit

Permalink
Update packages in attempt to fix weird config issue (#189)
Browse files Browse the repository at this point in the history
* Update packages in attempt to fix weird config issue

* Fix test

* Bump System.CommandLine

* Remove command line lib workaround
  • Loading branch information
einarmo authored Aug 19, 2022
1 parent eb9bc99 commit e95e85b
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 41 deletions.
2 changes: 1 addition & 1 deletion Cognite.Common/Cognite.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<None Include="..\LICENSE" Pack="true" Visible="false" PackagePath="" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Text.Json" Version="6.0.4" />
<PackageReference Include="System.Text.Json" Version="6.0.5" />
<PackageReference Include="Cronos" Version="0.7.1" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion Cognite.Config/Cognite.Configuration.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="YamlDotNet" Version="11.2.1" />
<PackageReference Include="YamlDotNet" Version="12.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions Cognite.Extensions/Cognite.Extensions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
<ProjectReference Include="..\Cognite.Common\Cognite.Common.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Identity.Client" Version="4.44.0" />
<PackageReference Include="CogniteSdk" Version="3.4.0" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.46.1" />
<PackageReference Include="CogniteSdk" Version="3.4.1" />
<PackageReference Include="prometheus-net" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="6.0.5" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="6.0.8" />
<PackageReference Include="Polly.Extensions.Http" Version="3.0.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Cognite.Metrics/Cognite.Metrics.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="6.0.5" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="6.0.8" />
<PackageReference Include="Polly.Extensions.Http" Version="3.0.0" />
<PackageReference Include="prometheus-net" Version="6.0.0" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Cognite.StateStorage/Cognite.StateStorage.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<None Include="..\LICENSE" Pack="true" Visible="false" PackagePath="" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="LiteDB" Version="5.0.11" />
<PackageReference Include="LiteDB" Version="5.0.12" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Cognite.Testing/Cognite.Testing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="xunit.assert" Version="2.4.1" />
<PackageReference Include="xunit.core" Version="2.4.1" />
<PackageReference Include="xunit.assert" Version="2.4.2" />
<PackageReference Include="xunit.core" Version="2.4.2" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions ExtractorUtils.Test/ExtractorUtils.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<EnableNETAnalyzers>false</EnableNETAnalyzers>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand All @@ -19,7 +19,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Moq" Version="4.18.1" />
<PackageReference Include="Moq" Version="4.18.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ExtractorUtils\ExtractorUtils.csproj" />
Expand Down
17 changes: 0 additions & 17 deletions ExtractorUtils.Test/unit/CommandLineTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,5 @@ public void TestSimpleCliType()

Assert.Equal(0, command.Invoke("--string-type stringvalue -b -i 123"));
}

[Fact]
public void LibBugTest()
{
// This shows a bug in System.CommandLine, once this fails we can remove the workaround from AttributeBinder

var arg = new Option<bool>(new[] { "-b" }, "Some description");

var cmd = new RootCommand
{
arg
};

var res = cmd.Parse("-b");

Assert.False((bool)res.GetValueForOption((Option)arg));
}
}
}
9 changes: 9 additions & 0 deletions ExtractorUtils.Test/unit/ConfigurationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@ public static void TestInvalidString(string yaml)
Assert.IsType<YamlDotNet.Core.YamlException>(e.InnerException);
}

[Fact]
public static void TestCleanException()
{
var yaml = "version: 0\nbad: foo";
var e = Assert.Throws<ConfigurationException>(() => ConfigurationUtils.TryReadConfigFromString<TestBaseConfig>(yaml, 0));
var ye = Assert.IsType<YamlDotNet.Core.YamlException>(e.InnerException);
Assert.Equal("Failed to load config string at Line: 2, Col: 1, Idx: 11: Property 'bad' not found on type 'ExtractorUtils.Test.Unit.TestBaseConfig'.", e.Message);
}

[Fact]
public static void TestValidString()
{
Expand Down
2 changes: 1 addition & 1 deletion ExtractorUtils.Test/unit/SanitationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ public void TestVerifySequenceData()
}

[Theory]
[InlineData(0)]
[InlineData(0.0)]
[InlineData(321.321)]
[InlineData(null)]
public void TestSanitizeDataPoints(double? nanRepl)
Expand Down
12 changes: 2 additions & 10 deletions ExtractorUtils/CommandLine/AttributeBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,8 @@ protected override T GetBoundValue(BindingContext bindingContext)
if (!prop.CanWrite) continue;
if (!Options.TryGetValue(prop.Name, out var option)) continue;

if (option.GetType() == typeof(Option<>).MakeGenericType(typeof(bool)))
{
prop.SetValue(result, bindingContext.ParseResult.GetValueForOption((Option<bool>)option));
}
else
{
var res = bindingContext.ParseResult.GetValueForOption(option);
prop.SetValue(result, res);
}

var res = bindingContext.ParseResult.GetValueForOption(option);
prop.SetValue(result, res);
}

return (T)result;
Expand Down
2 changes: 1 addition & 1 deletion ExtractorUtils/ExtractorUtils.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.1" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="StackExchange.Redis" Version="2.6.48" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta3.22114.1" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Cognite.Config\Cognite.Configuration.csproj" />
Expand Down

0 comments on commit e95e85b

Please sign in to comment.