dependabot-nuget 0.310.0 → 0.311.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/helpers/lib/NuGetUpdater/Directory.Packages.props +1 -1
- data/helpers/lib/NuGetUpdater/DotNetPackageCorrelation.Test/DotNetPackageCorrelation.Test.csproj +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/NuGetUpdater.Cli.Test.csproj +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/ClosePullRequest.cs +13 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/CreatePullRequest.cs +20 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/Job.cs +1 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/JobErrorBase.cs +19 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/MessageBase.cs +1 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/UpdatePullRequest.cs +16 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestTextGenerator.cs +49 -13
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs +31 -6
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdateOperationBase.cs +1 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/DependencyConflictResolver.cs +6 -25
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +12 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/MockNuGetPackage.cs +37 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/NuGetUpdater.Core.Test.csproj +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/MessageReportTests.cs +232 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/PullRequestTextTests.cs +32 -8
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/RunWorkerTests.cs +485 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/SerializationTests.cs +4 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateOperationBaseTests.cs +3 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackageReference.cs +1 -13
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/LoggerTests.cs +0 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +58 -8
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/PathHelperTests.cs +1 -1
- data/helpers/lib/NuGetUpdater/global.json +1 -1
- metadata +10 -9
@@ -499,7 +499,7 @@ public class RunWorkerTests
|
|
499
499
|
}
|
500
500
|
|
501
501
|
[Fact]
|
502
|
-
public async Task
|
502
|
+
public async Task ErrorsThrownFromDiscoveryWorkerAreForwaredToApiHandler()
|
503
503
|
{
|
504
504
|
await RunAsync(
|
505
505
|
packages:
|
@@ -539,8 +539,8 @@ public class RunWorkerTests
|
|
539
539
|
{
|
540
540
|
throw new HttpRequestException(message: null, inner: null, statusCode: HttpStatusCode.Unauthorized);
|
541
541
|
}),
|
542
|
-
analyzeWorker: TestAnalyzeWorker
|
543
|
-
updaterWorker: TestUpdaterWorker
|
542
|
+
analyzeWorker: new TestAnalyzeWorker((_input) => throw new NotImplementedException("shouldn't get this far")),
|
543
|
+
updaterWorker: new TestUpdaterWorker((_input) => throw new NotImplementedException("shouldn't get this far")),
|
544
544
|
expectedResult: new RunResult()
|
545
545
|
{
|
546
546
|
Base64DependencyFiles = [],
|
@@ -554,6 +554,488 @@ public class RunWorkerTests
|
|
554
554
|
);
|
555
555
|
}
|
556
556
|
|
557
|
+
[Fact]
|
558
|
+
public async Task ErrorsReturnedFromDiscoveryWorkerAreForwaredToApiHandler()
|
559
|
+
{
|
560
|
+
await RunAsync(
|
561
|
+
packages: [],
|
562
|
+
job: new Job()
|
563
|
+
{
|
564
|
+
Source = new()
|
565
|
+
{
|
566
|
+
Provider = "github",
|
567
|
+
Repo = "test/repo",
|
568
|
+
Directory = "/",
|
569
|
+
}
|
570
|
+
},
|
571
|
+
files: [],
|
572
|
+
discoveryWorker: new TestDiscoveryWorker((_input) =>
|
573
|
+
{
|
574
|
+
return Task.FromResult(new WorkspaceDiscoveryResult()
|
575
|
+
{
|
576
|
+
Path = "/",
|
577
|
+
IsSuccess = false,
|
578
|
+
Projects = [],
|
579
|
+
Error = new PrivateSourceAuthenticationFailure(["http://example.com/nuget/index.json"]),
|
580
|
+
});
|
581
|
+
}),
|
582
|
+
analyzeWorker: new TestAnalyzeWorker((_input) => throw new NotImplementedException("shouldn't get this far")),
|
583
|
+
updaterWorker: new TestUpdaterWorker((_input) => throw new NotImplementedException("shouldn't get this far")),
|
584
|
+
expectedResult: new RunResult()
|
585
|
+
{
|
586
|
+
Base64DependencyFiles = [],
|
587
|
+
BaseCommitSha = "TEST-COMMIT-SHA",
|
588
|
+
},
|
589
|
+
expectedApiMessages:
|
590
|
+
[
|
591
|
+
new PrivateSourceAuthenticationFailure(["http://example.com/nuget/index.json"]),
|
592
|
+
new MarkAsProcessed("TEST-COMMIT-SHA")
|
593
|
+
]
|
594
|
+
);
|
595
|
+
}
|
596
|
+
|
597
|
+
[Fact]
|
598
|
+
public async Task ErrorsThrownFromAnalyzeWorkerAreForwaredToApiHandler()
|
599
|
+
{
|
600
|
+
await RunAsync(
|
601
|
+
packages: [],
|
602
|
+
job: new Job()
|
603
|
+
{
|
604
|
+
Source = new()
|
605
|
+
{
|
606
|
+
Provider = "github",
|
607
|
+
Repo = "test/repo",
|
608
|
+
Directory = "/",
|
609
|
+
}
|
610
|
+
},
|
611
|
+
files:
|
612
|
+
[
|
613
|
+
("NuGet.Config", """
|
614
|
+
<configuration>
|
615
|
+
<packageSources>
|
616
|
+
<clear />
|
617
|
+
<add key="private_feed" value="http://example.com/nuget/index.json" allowInsecureConnections="true" />
|
618
|
+
</packageSources>
|
619
|
+
</configuration>
|
620
|
+
"""),
|
621
|
+
("project.csproj", """
|
622
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
623
|
+
<PropertyGroup>
|
624
|
+
<TargetFramework>net8.0</TargetFramework>
|
625
|
+
</PropertyGroup>
|
626
|
+
<ItemGroup>
|
627
|
+
<PackageReference Include="Some.Package" Version="1.0.0" />
|
628
|
+
</ItemGroup>
|
629
|
+
</Project>
|
630
|
+
""")
|
631
|
+
],
|
632
|
+
discoveryWorker: new TestDiscoveryWorker((_input) =>
|
633
|
+
{
|
634
|
+
return Task.FromResult(new WorkspaceDiscoveryResult()
|
635
|
+
{
|
636
|
+
Path = "",
|
637
|
+
Projects = [
|
638
|
+
new()
|
639
|
+
{
|
640
|
+
FilePath = "project.csproj",
|
641
|
+
Dependencies = [new("Some.Package", "1.0.0", DependencyType.PackageReference, TargetFrameworks: ["net8.0"])],
|
642
|
+
ImportedFiles = [],
|
643
|
+
AdditionalFiles = [],
|
644
|
+
}
|
645
|
+
]
|
646
|
+
});
|
647
|
+
}),
|
648
|
+
analyzeWorker: new TestAnalyzeWorker((_input) =>
|
649
|
+
{
|
650
|
+
throw new HttpRequestException(message: null, inner: null, statusCode: HttpStatusCode.Unauthorized);
|
651
|
+
}),
|
652
|
+
updaterWorker: new TestUpdaterWorker((_input) => throw new NotImplementedException("shouldn't get this far")),
|
653
|
+
expectedResult: new RunResult()
|
654
|
+
{
|
655
|
+
Base64DependencyFiles = [],
|
656
|
+
BaseCommitSha = "TEST-COMMIT-SHA",
|
657
|
+
},
|
658
|
+
expectedApiMessages:
|
659
|
+
[
|
660
|
+
new UpdatedDependencyList()
|
661
|
+
{
|
662
|
+
Dependencies =
|
663
|
+
[
|
664
|
+
new ReportedDependency()
|
665
|
+
{
|
666
|
+
Name = "Some.Package",
|
667
|
+
Version = "1.0.0",
|
668
|
+
Requirements =
|
669
|
+
[
|
670
|
+
new ReportedRequirement()
|
671
|
+
{
|
672
|
+
Requirement = "1.0.0",
|
673
|
+
File = "/project.csproj",
|
674
|
+
Groups = ["dependencies"],
|
675
|
+
}
|
676
|
+
]
|
677
|
+
}
|
678
|
+
],
|
679
|
+
DependencyFiles = ["/project.csproj"],
|
680
|
+
},
|
681
|
+
new IncrementMetric()
|
682
|
+
{
|
683
|
+
Metric = "updater.started",
|
684
|
+
Tags = new()
|
685
|
+
{
|
686
|
+
["operation"] = "group_update_all_versions"
|
687
|
+
}
|
688
|
+
},
|
689
|
+
new PrivateSourceAuthenticationFailure(["http://example.com/nuget/index.json"]),
|
690
|
+
new MarkAsProcessed("TEST-COMMIT-SHA")
|
691
|
+
]
|
692
|
+
);
|
693
|
+
}
|
694
|
+
|
695
|
+
[Fact]
|
696
|
+
public async Task ErrorsReturnedFromAnalyzeWorkerAreForwaredToApiHandler()
|
697
|
+
{
|
698
|
+
await RunAsync(
|
699
|
+
packages: [],
|
700
|
+
job: new Job()
|
701
|
+
{
|
702
|
+
Source = new()
|
703
|
+
{
|
704
|
+
Provider = "github",
|
705
|
+
Repo = "test/repo",
|
706
|
+
Directory = "/",
|
707
|
+
}
|
708
|
+
},
|
709
|
+
files: [
|
710
|
+
("project.csproj", """
|
711
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
712
|
+
<PropertyGroup>
|
713
|
+
<TargetFramework>net8.0</TargetFramework>
|
714
|
+
</PropertyGroup>
|
715
|
+
<ItemGroup>
|
716
|
+
<PackageReference Include="Some.Package" Version="1.0.0" />
|
717
|
+
</ItemGroup>
|
718
|
+
</Project>
|
719
|
+
""")
|
720
|
+
],
|
721
|
+
discoveryWorker: new TestDiscoveryWorker((_input) =>
|
722
|
+
{
|
723
|
+
return Task.FromResult(new WorkspaceDiscoveryResult()
|
724
|
+
{
|
725
|
+
Path = "",
|
726
|
+
Projects = [
|
727
|
+
new()
|
728
|
+
{
|
729
|
+
FilePath = "project.csproj",
|
730
|
+
Dependencies = [new("Some.Package", "1.0.0", DependencyType.PackageReference, TargetFrameworks: ["net8.0"])],
|
731
|
+
ImportedFiles = [],
|
732
|
+
AdditionalFiles = [],
|
733
|
+
}
|
734
|
+
]
|
735
|
+
});
|
736
|
+
}),
|
737
|
+
analyzeWorker: new TestAnalyzeWorker((_input) =>
|
738
|
+
{
|
739
|
+
return Task.FromResult(new AnalysisResult()
|
740
|
+
{
|
741
|
+
UpdatedVersion = "",
|
742
|
+
CanUpdate = false,
|
743
|
+
VersionComesFromMultiDependencyProperty = false,
|
744
|
+
UpdatedDependencies = [],
|
745
|
+
Error = new PrivateSourceAuthenticationFailure(["http://example.com/nuget/index.json"]),
|
746
|
+
});
|
747
|
+
}),
|
748
|
+
updaterWorker: new TestUpdaterWorker((_input) => throw new NotImplementedException("shouldn't get this far")),
|
749
|
+
expectedResult: new RunResult()
|
750
|
+
{
|
751
|
+
Base64DependencyFiles = [
|
752
|
+
new()
|
753
|
+
{
|
754
|
+
Directory = "/",
|
755
|
+
Name = "project.csproj",
|
756
|
+
Content = Convert.ToBase64String(Encoding.UTF8.GetBytes("""
|
757
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
758
|
+
<PropertyGroup>
|
759
|
+
<TargetFramework>net8.0</TargetFramework>
|
760
|
+
</PropertyGroup>
|
761
|
+
<ItemGroup>
|
762
|
+
<PackageReference Include="Some.Package" Version="1.0.0" />
|
763
|
+
</ItemGroup>
|
764
|
+
</Project>
|
765
|
+
""")),
|
766
|
+
ContentEncoding = "base64"
|
767
|
+
}
|
768
|
+
],
|
769
|
+
BaseCommitSha = "TEST-COMMIT-SHA",
|
770
|
+
},
|
771
|
+
expectedApiMessages:
|
772
|
+
[
|
773
|
+
new UpdatedDependencyList()
|
774
|
+
{
|
775
|
+
Dependencies =
|
776
|
+
[
|
777
|
+
new ReportedDependency()
|
778
|
+
{
|
779
|
+
Name = "Some.Package",
|
780
|
+
Version = "1.0.0",
|
781
|
+
Requirements =
|
782
|
+
[
|
783
|
+
new ReportedRequirement()
|
784
|
+
{
|
785
|
+
Requirement = "1.0.0",
|
786
|
+
File = "/project.csproj",
|
787
|
+
Groups = ["dependencies"],
|
788
|
+
}
|
789
|
+
]
|
790
|
+
}
|
791
|
+
],
|
792
|
+
DependencyFiles = ["/project.csproj"],
|
793
|
+
},
|
794
|
+
new IncrementMetric()
|
795
|
+
{
|
796
|
+
Metric = "updater.started",
|
797
|
+
Tags = new()
|
798
|
+
{
|
799
|
+
["operation"] = "group_update_all_versions"
|
800
|
+
}
|
801
|
+
},
|
802
|
+
new PrivateSourceAuthenticationFailure(["http://example.com/nuget/index.json"]),
|
803
|
+
new MarkAsProcessed("TEST-COMMIT-SHA")
|
804
|
+
]
|
805
|
+
);
|
806
|
+
}
|
807
|
+
|
808
|
+
[Fact]
|
809
|
+
public async Task ErrorsThrownFromUpdaterWorkerAreForwaredToApiHandler()
|
810
|
+
{
|
811
|
+
await RunAsync(
|
812
|
+
packages: [],
|
813
|
+
job: new Job()
|
814
|
+
{
|
815
|
+
Source = new()
|
816
|
+
{
|
817
|
+
Provider = "github",
|
818
|
+
Repo = "test/repo",
|
819
|
+
Directory = "/",
|
820
|
+
}
|
821
|
+
},
|
822
|
+
files:
|
823
|
+
[
|
824
|
+
("NuGet.Config", """
|
825
|
+
<configuration>
|
826
|
+
<packageSources>
|
827
|
+
<clear />
|
828
|
+
<add key="private_feed" value="http://example.com/nuget/index.json" allowInsecureConnections="true" />
|
829
|
+
</packageSources>
|
830
|
+
</configuration>
|
831
|
+
"""),
|
832
|
+
("project.csproj", """
|
833
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
834
|
+
<PropertyGroup>
|
835
|
+
<TargetFramework>net8.0</TargetFramework>
|
836
|
+
</PropertyGroup>
|
837
|
+
<ItemGroup>
|
838
|
+
<PackageReference Include="Some.Package" Version="1.0.0" />
|
839
|
+
</ItemGroup>
|
840
|
+
</Project>
|
841
|
+
""")
|
842
|
+
],
|
843
|
+
discoveryWorker: new TestDiscoveryWorker((_input) =>
|
844
|
+
{
|
845
|
+
return Task.FromResult(new WorkspaceDiscoveryResult()
|
846
|
+
{
|
847
|
+
Path = "",
|
848
|
+
Projects = [
|
849
|
+
new()
|
850
|
+
{
|
851
|
+
FilePath = "project.csproj",
|
852
|
+
Dependencies = [new("Some.Package", "1.0.0", DependencyType.PackageReference, TargetFrameworks: ["net8.0"])],
|
853
|
+
ImportedFiles = [],
|
854
|
+
AdditionalFiles = [],
|
855
|
+
}
|
856
|
+
]
|
857
|
+
});
|
858
|
+
}),
|
859
|
+
analyzeWorker: new TestAnalyzeWorker((_input) =>
|
860
|
+
{
|
861
|
+
return Task.FromResult(new AnalysisResult()
|
862
|
+
{
|
863
|
+
UpdatedVersion = "1.0.1",
|
864
|
+
CanUpdate = true,
|
865
|
+
UpdatedDependencies =
|
866
|
+
[
|
867
|
+
new("Some.Package", "1.0.1", DependencyType.Unknown, TargetFrameworks: ["net8.0"], InfoUrl: "https://nuget.example.com/some-package"),
|
868
|
+
]
|
869
|
+
});
|
870
|
+
}),
|
871
|
+
updaterWorker: new TestUpdaterWorker((_input) =>
|
872
|
+
{
|
873
|
+
throw new HttpRequestException(message: null, inner: null, statusCode: HttpStatusCode.Unauthorized);
|
874
|
+
}),
|
875
|
+
expectedResult: new RunResult()
|
876
|
+
{
|
877
|
+
Base64DependencyFiles = [],
|
878
|
+
BaseCommitSha = "TEST-COMMIT-SHA",
|
879
|
+
},
|
880
|
+
expectedApiMessages:
|
881
|
+
[
|
882
|
+
new UpdatedDependencyList()
|
883
|
+
{
|
884
|
+
Dependencies =
|
885
|
+
[
|
886
|
+
new ReportedDependency()
|
887
|
+
{
|
888
|
+
Name = "Some.Package",
|
889
|
+
Version = "1.0.0",
|
890
|
+
Requirements =
|
891
|
+
[
|
892
|
+
new ReportedRequirement()
|
893
|
+
{
|
894
|
+
Requirement = "1.0.0",
|
895
|
+
File = "/project.csproj",
|
896
|
+
Groups = ["dependencies"],
|
897
|
+
}
|
898
|
+
]
|
899
|
+
}
|
900
|
+
],
|
901
|
+
DependencyFiles = ["/project.csproj"],
|
902
|
+
},
|
903
|
+
new IncrementMetric()
|
904
|
+
{
|
905
|
+
Metric = "updater.started",
|
906
|
+
Tags = new()
|
907
|
+
{
|
908
|
+
["operation"] = "group_update_all_versions"
|
909
|
+
}
|
910
|
+
},
|
911
|
+
new PrivateSourceAuthenticationFailure(["http://example.com/nuget/index.json"]),
|
912
|
+
new MarkAsProcessed("TEST-COMMIT-SHA")
|
913
|
+
]
|
914
|
+
);
|
915
|
+
}
|
916
|
+
|
917
|
+
[Fact]
|
918
|
+
public async Task ErrorsReturnedFromUpdaterWorkerAreForwaredToApiHandler()
|
919
|
+
{
|
920
|
+
await RunAsync(
|
921
|
+
packages: [],
|
922
|
+
job: new Job()
|
923
|
+
{
|
924
|
+
Source = new()
|
925
|
+
{
|
926
|
+
Provider = "github",
|
927
|
+
Repo = "test/repo",
|
928
|
+
Directory = "/",
|
929
|
+
}
|
930
|
+
},
|
931
|
+
files:
|
932
|
+
[
|
933
|
+
("project.csproj", """
|
934
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
935
|
+
<PropertyGroup>
|
936
|
+
<TargetFramework>net8.0</TargetFramework>
|
937
|
+
</PropertyGroup>
|
938
|
+
<ItemGroup>
|
939
|
+
<PackageReference Include="Some.Package" Version="1.0.0" />
|
940
|
+
</ItemGroup>
|
941
|
+
</Project>
|
942
|
+
""")
|
943
|
+
],
|
944
|
+
discoveryWorker: new TestDiscoveryWorker((_input) =>
|
945
|
+
{
|
946
|
+
return Task.FromResult(new WorkspaceDiscoveryResult()
|
947
|
+
{
|
948
|
+
Path = "",
|
949
|
+
Projects = [
|
950
|
+
new()
|
951
|
+
{
|
952
|
+
FilePath = "project.csproj",
|
953
|
+
Dependencies = [new("Some.Package", "1.0.0", DependencyType.PackageReference, TargetFrameworks: ["net8.0"])],
|
954
|
+
ImportedFiles = [],
|
955
|
+
AdditionalFiles = [],
|
956
|
+
}
|
957
|
+
]
|
958
|
+
});
|
959
|
+
}),
|
960
|
+
analyzeWorker: new TestAnalyzeWorker((_input) =>
|
961
|
+
{
|
962
|
+
return Task.FromResult(new AnalysisResult()
|
963
|
+
{
|
964
|
+
UpdatedVersion = "1.0.1",
|
965
|
+
CanUpdate = true,
|
966
|
+
UpdatedDependencies =
|
967
|
+
[
|
968
|
+
new("Some.Package", "1.0.1", DependencyType.Unknown, TargetFrameworks: ["net8.0"], InfoUrl: "https://nuget.example.com/some-package"),
|
969
|
+
]
|
970
|
+
});
|
971
|
+
}),
|
972
|
+
updaterWorker: new TestUpdaterWorker((_input) =>
|
973
|
+
{
|
974
|
+
return Task.FromResult(new UpdateOperationResult()
|
975
|
+
{
|
976
|
+
UpdateOperations = [],
|
977
|
+
Error = new PrivateSourceAuthenticationFailure(["http://example.com/nuget/index.json"]),
|
978
|
+
});
|
979
|
+
}),
|
980
|
+
expectedResult: new RunResult()
|
981
|
+
{
|
982
|
+
Base64DependencyFiles = [
|
983
|
+
new()
|
984
|
+
{
|
985
|
+
Directory = "/",
|
986
|
+
Name = "project.csproj",
|
987
|
+
Content = Convert.ToBase64String(Encoding.UTF8.GetBytes("""
|
988
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
989
|
+
<PropertyGroup>
|
990
|
+
<TargetFramework>net8.0</TargetFramework>
|
991
|
+
</PropertyGroup>
|
992
|
+
<ItemGroup>
|
993
|
+
<PackageReference Include="Some.Package" Version="1.0.0" />
|
994
|
+
</ItemGroup>
|
995
|
+
</Project>
|
996
|
+
""")),
|
997
|
+
ContentEncoding = "base64"
|
998
|
+
}
|
999
|
+
],
|
1000
|
+
BaseCommitSha = "TEST-COMMIT-SHA",
|
1001
|
+
},
|
1002
|
+
expectedApiMessages:
|
1003
|
+
[
|
1004
|
+
new UpdatedDependencyList()
|
1005
|
+
{
|
1006
|
+
Dependencies =
|
1007
|
+
[
|
1008
|
+
new ReportedDependency()
|
1009
|
+
{
|
1010
|
+
Name = "Some.Package",
|
1011
|
+
Version = "1.0.0",
|
1012
|
+
Requirements =
|
1013
|
+
[
|
1014
|
+
new ReportedRequirement()
|
1015
|
+
{
|
1016
|
+
Requirement = "1.0.0",
|
1017
|
+
File = "/project.csproj",
|
1018
|
+
Groups = ["dependencies"],
|
1019
|
+
}
|
1020
|
+
]
|
1021
|
+
}
|
1022
|
+
],
|
1023
|
+
DependencyFiles = ["/project.csproj"],
|
1024
|
+
},
|
1025
|
+
new IncrementMetric()
|
1026
|
+
{
|
1027
|
+
Metric = "updater.started",
|
1028
|
+
Tags = new()
|
1029
|
+
{
|
1030
|
+
["operation"] = "group_update_all_versions"
|
1031
|
+
}
|
1032
|
+
},
|
1033
|
+
new PrivateSourceAuthenticationFailure(["http://example.com/nuget/index.json"]),
|
1034
|
+
new MarkAsProcessed("TEST-COMMIT-SHA")
|
1035
|
+
]
|
1036
|
+
);
|
1037
|
+
}
|
1038
|
+
|
557
1039
|
[Fact]
|
558
1040
|
public async Task UpdateHandlesPackagesConfigFiles()
|
559
1041
|
{
|
@@ -50,7 +50,8 @@ public class SerializationTests
|
|
50
50
|
"credentials-metadata": [
|
51
51
|
{
|
52
52
|
"host": "github.com",
|
53
|
-
"type": "git_source"
|
53
|
+
"type": "git_source",
|
54
|
+
"replaces-base": false
|
54
55
|
}
|
55
56
|
],
|
56
57
|
"max-updater-run-time": 0
|
@@ -116,7 +117,8 @@ public class SerializationTests
|
|
116
117
|
"credentials": [
|
117
118
|
{
|
118
119
|
"name": "some-cred",
|
119
|
-
"token": "abc123"
|
120
|
+
"token": "abc123",
|
121
|
+
"replaces-base": false
|
120
122
|
}
|
121
123
|
],
|
122
124
|
"existing-pull-requests": [
|
@@ -43,9 +43,9 @@ public class UpdateOperationBaseTests
|
|
43
43
|
// assert
|
44
44
|
var expectedReport = """
|
45
45
|
Performed the following updates:
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
- Updated Package.A to 1.0.0 in file/a.txt
|
47
|
+
- Pinned Package.B at 2.0.0 in file/b.txt
|
48
|
+
- Updated Package.C to 3.0.0 indirectly via Package.D/4.0.0 in file/c.txt
|
49
49
|
""".Replace("\r", "");
|
50
50
|
Assert.Equal(expectedReport, actualReport);
|
51
51
|
}
|
data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackageReference.cs
CHANGED
@@ -382,19 +382,7 @@ public partial class UpdateWorkerTests
|
|
382
382
|
MockNuGetPackage.CreateSimplePackage("Some.Package", "9.0.1", "net8.0"),
|
383
383
|
MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net8.0"),
|
384
384
|
// necessary for the `net8.0-windows10.0.19041.0` TFM
|
385
|
-
|
386
|
-
[
|
387
|
-
("data/FrameworkList.xml", Encoding.UTF8.GetBytes("""
|
388
|
-
<FileList Name="Windows SDK .NET 6.0">
|
389
|
-
<!-- contents omitted -->
|
390
|
-
</FileList>
|
391
|
-
""")),
|
392
|
-
("data/RuntimeList.xml", Encoding.UTF8.GetBytes("""
|
393
|
-
<FileList Name="Windows SDK .NET 6.0" TargetFrameworkIdentifier=".NETCoreApp" TargetFrameworkVersion="6.0" FrameworkName="Microsoft.Windows.SDK.NET.Ref">
|
394
|
-
<!-- contents omitted -->
|
395
|
-
</FileList>
|
396
|
-
""")),
|
397
|
-
]),
|
385
|
+
MockNuGetPackage.WellKnownWindowsSdkRefPackage("10.0.19041.0"),
|
398
386
|
],
|
399
387
|
// initial
|
400
388
|
projectContents: $"""
|
@@ -1370,11 +1370,11 @@ public class MSBuildHelperTests : TestBase
|
|
1370
1370
|
""");
|
1371
1371
|
await UpdateWorkerTestBase.MockNuGetPackagesInDirectory([
|
1372
1372
|
// initial packages
|
1373
|
-
MockNuGetPackage.CreateSimplePackage("Microsoft.EntityFrameworkCore", "7.0.11", "net8.0", [(null, [("Microsoft.EntityFrameworkCore.Analyzers", "7.0.11"), ("Microsoft.Extensions.Caching.Memory", "7.0.0")])]),
|
1373
|
+
MockNuGetPackage.CreateSimplePackage("Microsoft.EntityFrameworkCore", "7.0.11", "net8.0", [(null, [("Microsoft.EntityFrameworkCore.Analyzers", "7.0.11"), ("Microsoft.Extensions.Caching.Memory", "[7.0.0]")])]),
|
1374
1374
|
MockNuGetPackage.CreateSimplePackage("Microsoft.EntityFrameworkCore.Analyzers", "7.0.11", "net8.0"),
|
1375
1375
|
MockNuGetPackage.CreateSimplePackage("Microsoft.Extensions.Caching.Memory", "7.0.0", "net8.0"),
|
1376
1376
|
// available packages
|
1377
|
-
MockNuGetPackage.CreateSimplePackage("Microsoft.EntityFrameworkCore", "8.0.0", "net8.0", [(null, [("Microsoft.EntityFrameworkCore.Analyzers", "8.0.0"), ("Microsoft.Extensions.Caching.Memory", "8.0.0")])]),
|
1377
|
+
MockNuGetPackage.CreateSimplePackage("Microsoft.EntityFrameworkCore", "8.0.0", "net8.0", [(null, [("Microsoft.EntityFrameworkCore.Analyzers", "8.0.0"), ("Microsoft.Extensions.Caching.Memory", "[8.0.0]")])]),
|
1378
1378
|
MockNuGetPackage.CreateSimplePackage("Microsoft.EntityFrameworkCore.Analyzers", "8.0.0", "net8.0"),
|
1379
1379
|
MockNuGetPackage.CreateSimplePackage("Microsoft.Extensions.Caching.Memory", "8.0.0", "net8.0"),
|
1380
1380
|
], tempDirectory.DirectoryPath);
|
@@ -1627,16 +1627,13 @@ public class MSBuildHelperTests : TestBase
|
|
1627
1627
|
// initial packages
|
1628
1628
|
MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.CSharp.Workspaces", "4.8.0", "net8.0", [(null, [("Microsoft.CodeAnalysis.CSharp", "[4.8.0]"), ("Microsoft.CodeAnalysis.Common", "[4.8.0]")])]),
|
1629
1629
|
MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.CSharp", "4.8.0", "net8.0", [(null, [("Microsoft.CodeAnalysis.Common", "[4.8.0]")])]),
|
1630
|
-
MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Common", "4.8.0", "net8.0", [(null, [("System.Collections.Immutable", "7.0.0")])]),
|
1630
|
+
MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Common", "4.8.0", "net8.0", [(null, [("System.Collections.Immutable", "[7.0.0]")])]),
|
1631
1631
|
MockNuGetPackage.CreateSimplePackage("System.Collections.Immutable", "7.0.0", "net8.0"),
|
1632
1632
|
// available packages
|
1633
1633
|
MockNuGetPackage.CreateSimplePackage("System.Collections.Immutable", "8.0.0", "net8.0"),
|
1634
1634
|
MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.CSharp.Workspaces", "4.9.2", "net8.0", [(null, [("Microsoft.CodeAnalysis.CSharp", "[4.9.2]"), ("Microsoft.CodeAnalysis.Common", "[4.9.2]")])]),
|
1635
1635
|
MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.CSharp", "4.9.2", "net8.0", [(null, [("Microsoft.CodeAnalysis.Common", "[4.9.2]")])]),
|
1636
|
-
MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Common", "4.9.2", "net8.0", [(null, [("System.Collections.Immutable", "8.0.0")])]),
|
1637
|
-
//MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.CSharp.Workspaces", "4.10.0", "net8.0", [(null, [("Microsoft.CodeAnalysis.CSharp", "[4.10.0]"), ("Microsoft.CodeAnalysis.Common", "[4.10.0]")])]),
|
1638
|
-
//MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.CSharp", "4.10.0", "net8.0", [(null, [("Microsoft.CodeAnalysis.Common", "[4.10.0]")])]),
|
1639
|
-
//MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Common", "4.10.0", "net8.0", [(null, [("System.Collections.Immutable", "8.0.0")])])
|
1636
|
+
MockNuGetPackage.CreateSimplePackage("Microsoft.CodeAnalysis.Common", "4.9.2", "net8.0", [(null, [("System.Collections.Immutable", "[8.0.0]")])]),
|
1640
1637
|
], tempDirectory.DirectoryPath);
|
1641
1638
|
|
1642
1639
|
var dependencies = new[]
|
@@ -1669,6 +1666,59 @@ public class MSBuildHelperTests : TestBase
|
|
1669
1666
|
};
|
1670
1667
|
AssertEx.Equal(expectedResolvedDependencies, actualResolvedDependencies);
|
1671
1668
|
}
|
1669
|
+
|
1670
|
+
[Fact(Timeout = 120_000)] // 2m
|
1671
|
+
public async Task DependencyConflictsCanBeResolved_TopLevelDependencyHasNewerVersionsThatDoNotPullUpTransitive()
|
1672
|
+
{
|
1673
|
+
using var tempDirectory = new TemporaryDirectory();
|
1674
|
+
var projectPath = Path.Join(tempDirectory.DirectoryPath, "project.csproj");
|
1675
|
+
await File.WriteAllTextAsync(projectPath, """
|
1676
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
1677
|
+
<PropertyGroup>
|
1678
|
+
<TargetFramework>net8.0</TargetFramework>
|
1679
|
+
</PropertyGroup>
|
1680
|
+
<ItemGroup>
|
1681
|
+
<PackageReference Include="Top.Level.Package" Version="1.41.0" />
|
1682
|
+
</ItemGroup>
|
1683
|
+
</Project>
|
1684
|
+
""");
|
1685
|
+
await UpdateWorkerTestBase.MockNuGetPackagesInDirectory([
|
1686
|
+
// initial packages
|
1687
|
+
MockNuGetPackage.CreateSimplePackage("Top.Level.Package", "1.41.0", "net8.0", [(null, [("Transitive.Package", "6.0.0")])]),
|
1688
|
+
MockNuGetPackage.CreateSimplePackage("Transitive.Package", "6.0.0", "net8.0"),
|
1689
|
+
// available packages
|
1690
|
+
MockNuGetPackage.CreateSimplePackage("Top.Level.Package", "1.45.0", "net8.0", [(null, [("Transitive.Package", "6.0.0")])]),
|
1691
|
+
MockNuGetPackage.CreateSimplePackage("Transitive.Package", "8.0.5", "net8.0"),
|
1692
|
+
], tempDirectory.DirectoryPath);
|
1693
|
+
|
1694
|
+
var dependencies = new[]
|
1695
|
+
{
|
1696
|
+
new Dependency("Top.Level.Package", "1.41.0", DependencyType.PackageReference),
|
1697
|
+
}.ToImmutableArray();
|
1698
|
+
var update = new[]
|
1699
|
+
{
|
1700
|
+
new Dependency("Transitive.Package", "8.0.5", DependencyType.PackageReference),
|
1701
|
+
}.ToImmutableArray();
|
1702
|
+
|
1703
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(
|
1704
|
+
tempDirectory.DirectoryPath,
|
1705
|
+
projectPath,
|
1706
|
+
"net8.0",
|
1707
|
+
dependencies,
|
1708
|
+
update,
|
1709
|
+
new ExperimentsManager() { InstallDotnetSdks = true },
|
1710
|
+
new TestLogger()
|
1711
|
+
);
|
1712
|
+
Assert.NotNull(resolvedDependencies);
|
1713
|
+
var actualResolvedDependencies = resolvedDependencies.Value.Select(d => $"{d.Name}/{d.Version}").ToArray();
|
1714
|
+
var expectedResolvedDependencies = new[]
|
1715
|
+
{
|
1716
|
+
"Top.Level.Package/1.41.0",
|
1717
|
+
"Transitive.Package/8.0.5",
|
1718
|
+
};
|
1719
|
+
AssertEx.Equal(expectedResolvedDependencies, actualResolvedDependencies);
|
1720
|
+
}
|
1721
|
+
|
1672
1722
|
#endregion
|
1673
1723
|
|
1674
1724
|
[Theory]
|
@@ -1760,7 +1810,7 @@ public class MSBuildHelperTests : TestBase
|
|
1760
1810
|
// output
|
1761
1811
|
"Unable to find package Some.Package with version (= 1.2.3)",
|
1762
1812
|
// expectedError
|
1763
|
-
new DependencyNotFound("Some.Package"),
|
1813
|
+
new DependencyNotFound("Some.Package/= 1.2.3"),
|
1764
1814
|
];
|
1765
1815
|
|
1766
1816
|
yield return
|