dependabot-nuget 0.309.0 → 0.310.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/NuGetUpdater.Cli.Test/EntryPointTests.Run.cs +6 -6
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/HttpApiHandler.cs +12 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/DependencyConflictResolver.cs +0 -8
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTests.cs +3 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/EndToEndTests.cs +355 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/RunWorkerTests.cs +320 -430
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TestHttpServer.cs +16 -6
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/EOLHandlingTests.cs +227 -13
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +331 -164
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60d194f7c1aa9c0a61df000bad1d3030110a66a73cb86615c97fe0a3d053cc56
|
4
|
+
data.tar.gz: d87118a0fb76c9b571b27ec5a66a3ae65d808e17daa9d68cb734962ee3aa5fd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d9fcc54e90b7c3ea93eedab675ce512a989176b02c676d442f9b9edcbbb5653dd9bacc777d77c52f1061ede4048523dfc9693a50c01ce089c5205dcf1cdfddb
|
7
|
+
data.tar.gz: 12abc6e3b3c04933d6d341ea9532d9dbae1cc121310c1f4252e0f7d9f2776861c1b3cb696d813a1c37717363c219c4196743665001ecf7ade03d8bf40aaf58bc
|
@@ -50,10 +50,10 @@ public partial class EntryPointTests
|
|
50
50
|
},
|
51
51
|
expectedUrls:
|
52
52
|
[
|
53
|
-
"/update_jobs/TEST-ID/update_dependency_list",
|
54
|
-
"/update_jobs/TEST-ID/increment_metric",
|
55
|
-
"/update_jobs/TEST-ID/create_pull_request",
|
56
|
-
"/update_jobs/TEST-ID/mark_as_processed",
|
53
|
+
"POST /update_jobs/TEST-ID/update_dependency_list",
|
54
|
+
"POST /update_jobs/TEST-ID/increment_metric",
|
55
|
+
"POST /update_jobs/TEST-ID/create_pull_request",
|
56
|
+
"PATCH /update_jobs/TEST-ID/mark_as_processed",
|
57
57
|
]
|
58
58
|
);
|
59
59
|
}
|
@@ -79,9 +79,9 @@ public partial class EntryPointTests
|
|
79
79
|
await UpdateWorkerTestBase.MockNuGetPackagesInDirectory(packages, tempDirectory.DirectoryPath);
|
80
80
|
|
81
81
|
var actualUrls = new List<string>();
|
82
|
-
using var http = TestHttpServer.CreateTestStringServer(url =>
|
82
|
+
using var http = TestHttpServer.CreateTestStringServer((method, url) =>
|
83
83
|
{
|
84
|
-
actualUrls.Add(new Uri(url).PathAndQuery);
|
84
|
+
actualUrls.Add($"{method} {new Uri(url).PathAndQuery}");
|
85
85
|
return (200, "ok");
|
86
86
|
});
|
87
87
|
var args = new List<string>()
|
@@ -57,7 +57,7 @@ public class HttpApiHandler : IApiHandler
|
|
57
57
|
|
58
58
|
public async Task MarkAsProcessed(MarkAsProcessed markAsProcessed)
|
59
59
|
{
|
60
|
-
await
|
60
|
+
await PatchAsJson("mark_as_processed", markAsProcessed);
|
61
61
|
}
|
62
62
|
|
63
63
|
internal static string Serialize(object body)
|
@@ -70,11 +70,20 @@ public class HttpApiHandler : IApiHandler
|
|
70
70
|
return payload;
|
71
71
|
}
|
72
72
|
|
73
|
-
private
|
73
|
+
private Task PostAsJson(string endpoint, object body) => SendAsJson(endpoint, body, "POST");
|
74
|
+
private Task PatchAsJson(string endpoint, object body) => SendAsJson(endpoint, body, "PATCH");
|
75
|
+
|
76
|
+
private async Task SendAsJson(string endpoint, object body, string method)
|
74
77
|
{
|
78
|
+
var uri = $"{_apiUrl}/update_jobs/{_jobId}/{endpoint}";
|
75
79
|
var payload = Serialize(body);
|
76
80
|
var content = new StringContent(payload, Encoding.UTF8, "application/json");
|
77
|
-
var
|
81
|
+
var httpMethod = new HttpMethod(method);
|
82
|
+
var message = new HttpRequestMessage(httpMethod, uri)
|
83
|
+
{
|
84
|
+
Content = content
|
85
|
+
};
|
86
|
+
var response = await HttpClient.SendAsync(message);
|
78
87
|
var _ = response.EnsureSuccessStatusCode();
|
79
88
|
}
|
80
89
|
}
|
@@ -467,14 +467,6 @@ public class PackageManager
|
|
467
467
|
// Loop from the current version to the latest version, use next patch as a limit (unless there's a limit) so it doesn't look for versions that don't exist
|
468
468
|
for (NuGetVersion version = currentVersionParent; version <= latestVersion; version = NextPatch(version, versions))
|
469
469
|
{
|
470
|
-
NuGetVersion nextPatch = NextPatch(version, versions);
|
471
|
-
|
472
|
-
// If the next patch is the same as the currentVersioon, then the update is a Success
|
473
|
-
if (nextPatch == version)
|
474
|
-
{
|
475
|
-
return "Success";
|
476
|
-
}
|
477
|
-
|
478
470
|
string parentVersion = version.ToString();
|
479
471
|
parent.NewVersion = parentVersion;
|
480
472
|
|
@@ -702,7 +702,7 @@ public partial class AnalyzeWorkerTests : AnalyzeWorkerTestBase
|
|
702
702
|
|
703
703
|
// nothing else is found
|
704
704
|
return (404, Encoding.UTF8.GetBytes("{}"));
|
705
|
-
}
|
705
|
+
}
|
706
706
|
}
|
707
707
|
using var http1 = TestHttpServer.CreateTestServer(TestHttpHandler1);
|
708
708
|
using var http2 = TestHttpServer.CreateTestServer(TestHttpHandler2);
|
@@ -874,7 +874,7 @@ public partial class AnalyzeWorkerTests : AnalyzeWorkerTestBase
|
|
874
874
|
|
875
875
|
// nothing else is found
|
876
876
|
return (404, Encoding.UTF8.GetBytes("{}"));
|
877
|
-
}
|
877
|
+
}
|
878
878
|
}
|
879
879
|
using var http1 = TestHttpServer.CreateTestServer(TestHttpHandler1);
|
880
880
|
using var http2 = TestHttpServer.CreateTestServer(TestHttpHandler2);
|
@@ -1064,7 +1064,7 @@ public partial class AnalyzeWorkerTests : AnalyzeWorkerTestBase
|
|
1064
1064
|
|
1065
1065
|
// nothing else is found
|
1066
1066
|
return (404, Encoding.UTF8.GetBytes("{}"));
|
1067
|
-
}
|
1067
|
+
}
|
1068
1068
|
}
|
1069
1069
|
using var http = TestHttpServer.CreateTestServer(TestHttpHandler);
|
1070
1070
|
await TestAnalyzeAsync(
|
@@ -0,0 +1,355 @@
|
|
1
|
+
using System.Text;
|
2
|
+
|
3
|
+
using NuGetUpdater.Core.Run.ApiModel;
|
4
|
+
using NuGetUpdater.Core.Run;
|
5
|
+
using Xunit;
|
6
|
+
using NuGetUpdater.Core.Analyze;
|
7
|
+
|
8
|
+
namespace NuGetUpdater.Core.Test.Run;
|
9
|
+
|
10
|
+
public class EndToEndTests
|
11
|
+
{
|
12
|
+
[Fact]
|
13
|
+
public async Task UpdatePackageWithDifferentVersionsInDifferentDirectories()
|
14
|
+
{
|
15
|
+
// this test passes `null` for discovery, analyze, and update workers to fully test the desired behavior
|
16
|
+
|
17
|
+
// the same dependency Some.Package is reported for 3 cases:
|
18
|
+
// library1.csproj - top level dependency, already up to date
|
19
|
+
// library2.csproj - top level dependency, needs direct update
|
20
|
+
// library3.csproj - transitive dependency, needs pin
|
21
|
+
await RunWorkerTests.RunAsync(
|
22
|
+
experimentsManager: new ExperimentsManager() { UseDirectDiscovery = true },
|
23
|
+
packages: [
|
24
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "1.0.0", "net8.0"),
|
25
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "2.0.0", "net8.0"),
|
26
|
+
MockNuGetPackage.CreateSimplePackage("Package.With.Transitive.Dependency", "0.1.0", "net8.0", [(null, [("Some.Package", "1.0.0")])]),
|
27
|
+
],
|
28
|
+
job: new Job()
|
29
|
+
{
|
30
|
+
AllowedUpdates = [new() { UpdateType = UpdateType.Security }],
|
31
|
+
SecurityAdvisories =
|
32
|
+
[
|
33
|
+
new()
|
34
|
+
{
|
35
|
+
DependencyName = "Some.Package",
|
36
|
+
AffectedVersions = [Requirement.Parse("= 1.0.0")]
|
37
|
+
}
|
38
|
+
],
|
39
|
+
Source = new()
|
40
|
+
{
|
41
|
+
Provider = "github",
|
42
|
+
Repo = "test/repo",
|
43
|
+
Directory = "/"
|
44
|
+
}
|
45
|
+
},
|
46
|
+
files: [
|
47
|
+
("dirs.proj", """
|
48
|
+
<Project>
|
49
|
+
<ItemGroup>
|
50
|
+
<ProjectFile Include="library1\library1.csproj" />
|
51
|
+
<ProjectFile Include="library2\library2.csproj" />
|
52
|
+
<ProjectFile Include="library3\library3.csproj" />
|
53
|
+
</ItemGroup>
|
54
|
+
</Project>
|
55
|
+
"""),
|
56
|
+
("Directory.Build.props", "<Project />"),
|
57
|
+
("Directory.Build.targets", "<Project />"),
|
58
|
+
("Directory.Packages.props", """
|
59
|
+
<Project>
|
60
|
+
<PropertyGroup>
|
61
|
+
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
|
62
|
+
</PropertyGroup>
|
63
|
+
</Project>
|
64
|
+
"""),
|
65
|
+
("library1/library1.csproj", """
|
66
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
67
|
+
<PropertyGroup>
|
68
|
+
<TargetFramework>net8.0</TargetFramework>
|
69
|
+
</PropertyGroup>
|
70
|
+
<ItemGroup>
|
71
|
+
<PackageReference Include="Some.Package" Version="2.0.0" />
|
72
|
+
</ItemGroup>
|
73
|
+
</Project>
|
74
|
+
"""),
|
75
|
+
("library2/library2.csproj", """
|
76
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
77
|
+
<PropertyGroup>
|
78
|
+
<TargetFramework>net8.0</TargetFramework>
|
79
|
+
</PropertyGroup>
|
80
|
+
<ItemGroup>
|
81
|
+
<PackageReference Include="Some.Package" Version="1.0.0" />
|
82
|
+
</ItemGroup>
|
83
|
+
</Project>
|
84
|
+
"""),
|
85
|
+
("library3/library3.csproj", """
|
86
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
87
|
+
<PropertyGroup>
|
88
|
+
<TargetFramework>net8.0</TargetFramework>
|
89
|
+
</PropertyGroup>
|
90
|
+
<ItemGroup>
|
91
|
+
<PackageReference Include="Package.With.Transitive.Dependency" Version="0.1.0" />
|
92
|
+
</ItemGroup>
|
93
|
+
</Project>
|
94
|
+
"""),
|
95
|
+
],
|
96
|
+
discoveryWorker: null,
|
97
|
+
analyzeWorker: null,
|
98
|
+
updaterWorker: null,
|
99
|
+
expectedResult: new RunResult()
|
100
|
+
{
|
101
|
+
Base64DependencyFiles =
|
102
|
+
[
|
103
|
+
new DependencyFile()
|
104
|
+
{
|
105
|
+
Directory = "/",
|
106
|
+
Name = "Directory.Build.props",
|
107
|
+
Content = Convert.ToBase64String(Encoding.UTF8.GetBytes("<Project />")),
|
108
|
+
ContentEncoding = "base64",
|
109
|
+
},
|
110
|
+
new DependencyFile()
|
111
|
+
{
|
112
|
+
Directory = "/",
|
113
|
+
Name = "Directory.Build.targets",
|
114
|
+
Content = Convert.ToBase64String(Encoding.UTF8.GetBytes("<Project />")),
|
115
|
+
ContentEncoding = "base64",
|
116
|
+
},
|
117
|
+
new DependencyFile()
|
118
|
+
{
|
119
|
+
Directory = "/",
|
120
|
+
Name = "Directory.Packages.props",
|
121
|
+
Content = Convert.ToBase64String(Encoding.UTF8.GetBytes("""
|
122
|
+
<Project>
|
123
|
+
<PropertyGroup>
|
124
|
+
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
|
125
|
+
</PropertyGroup>
|
126
|
+
</Project>
|
127
|
+
""")),
|
128
|
+
ContentEncoding = "base64",
|
129
|
+
},
|
130
|
+
new DependencyFile()
|
131
|
+
{
|
132
|
+
Directory = "/library1",
|
133
|
+
Name = "library1.csproj",
|
134
|
+
Content = Convert.ToBase64String(Encoding.UTF8.GetBytes("""
|
135
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
136
|
+
<PropertyGroup>
|
137
|
+
<TargetFramework>net8.0</TargetFramework>
|
138
|
+
</PropertyGroup>
|
139
|
+
<ItemGroup>
|
140
|
+
<PackageReference Include="Some.Package" Version="2.0.0" />
|
141
|
+
</ItemGroup>
|
142
|
+
</Project>
|
143
|
+
""")),
|
144
|
+
ContentEncoding = "base64",
|
145
|
+
},
|
146
|
+
new DependencyFile()
|
147
|
+
{
|
148
|
+
Directory = "/library2",
|
149
|
+
Name = "library2.csproj",
|
150
|
+
Content = Convert.ToBase64String(Encoding.UTF8.GetBytes("""
|
151
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
152
|
+
<PropertyGroup>
|
153
|
+
<TargetFramework>net8.0</TargetFramework>
|
154
|
+
</PropertyGroup>
|
155
|
+
<ItemGroup>
|
156
|
+
<PackageReference Include="Some.Package" Version="1.0.0" />
|
157
|
+
</ItemGroup>
|
158
|
+
</Project>
|
159
|
+
""")),
|
160
|
+
ContentEncoding = "base64",
|
161
|
+
},
|
162
|
+
new DependencyFile()
|
163
|
+
{
|
164
|
+
Directory = "/library3",
|
165
|
+
Name = "library3.csproj",
|
166
|
+
Content = Convert.ToBase64String(Encoding.UTF8.GetBytes("""
|
167
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
168
|
+
<PropertyGroup>
|
169
|
+
<TargetFramework>net8.0</TargetFramework>
|
170
|
+
</PropertyGroup>
|
171
|
+
<ItemGroup>
|
172
|
+
<PackageReference Include="Package.With.Transitive.Dependency" Version="0.1.0" />
|
173
|
+
</ItemGroup>
|
174
|
+
</Project>
|
175
|
+
""")),
|
176
|
+
ContentEncoding = "base64",
|
177
|
+
}
|
178
|
+
],
|
179
|
+
BaseCommitSha = "TEST-COMMIT-SHA",
|
180
|
+
},
|
181
|
+
expectedApiMessages: [
|
182
|
+
new UpdatedDependencyList()
|
183
|
+
{
|
184
|
+
Dependencies = [
|
185
|
+
new()
|
186
|
+
{
|
187
|
+
Name = "Some.Package",
|
188
|
+
Version = "2.0.0",
|
189
|
+
Requirements = [
|
190
|
+
new()
|
191
|
+
{
|
192
|
+
Requirement = "2.0.0",
|
193
|
+
File = "/library1/library1.csproj",
|
194
|
+
Groups = ["dependencies"],
|
195
|
+
}
|
196
|
+
]
|
197
|
+
},
|
198
|
+
new()
|
199
|
+
{
|
200
|
+
Name = "Some.Package",
|
201
|
+
Version = "1.0.0",
|
202
|
+
Requirements = [
|
203
|
+
new()
|
204
|
+
{
|
205
|
+
Requirement = "1.0.0",
|
206
|
+
File = "/library2/library2.csproj",
|
207
|
+
Groups = ["dependencies"],
|
208
|
+
}
|
209
|
+
]
|
210
|
+
},
|
211
|
+
new()
|
212
|
+
{
|
213
|
+
Name = "Package.With.Transitive.Dependency",
|
214
|
+
Version = "0.1.0",
|
215
|
+
Requirements = [
|
216
|
+
new()
|
217
|
+
{
|
218
|
+
Requirement = "0.1.0",
|
219
|
+
File = "/library3/library3.csproj",
|
220
|
+
Groups = ["dependencies"],
|
221
|
+
}
|
222
|
+
]
|
223
|
+
},
|
224
|
+
new()
|
225
|
+
{
|
226
|
+
Name = "Some.Package",
|
227
|
+
Version = "1.0.0",
|
228
|
+
Requirements = [
|
229
|
+
new()
|
230
|
+
{
|
231
|
+
Requirement = "1.0.0",
|
232
|
+
File = "/library3/library3.csproj",
|
233
|
+
Groups = ["dependencies"],
|
234
|
+
}
|
235
|
+
]
|
236
|
+
},
|
237
|
+
],
|
238
|
+
DependencyFiles = [
|
239
|
+
"/Directory.Build.props",
|
240
|
+
"/Directory.Build.targets",
|
241
|
+
"/Directory.Packages.props",
|
242
|
+
"/library1/library1.csproj",
|
243
|
+
"/library2/library2.csproj",
|
244
|
+
"/library3/library3.csproj",
|
245
|
+
],
|
246
|
+
},
|
247
|
+
new IncrementMetric()
|
248
|
+
{
|
249
|
+
Metric = "updater.started",
|
250
|
+
Tags = new()
|
251
|
+
{
|
252
|
+
["operation"] = "create_security_pr"
|
253
|
+
}
|
254
|
+
},
|
255
|
+
new CreatePullRequest()
|
256
|
+
{
|
257
|
+
Dependencies = [
|
258
|
+
new()
|
259
|
+
{
|
260
|
+
Name = "Some.Package",
|
261
|
+
Version = "2.0.0",
|
262
|
+
Requirements = [
|
263
|
+
new()
|
264
|
+
{
|
265
|
+
Requirement = "2.0.0",
|
266
|
+
File = "/library2/library2.csproj",
|
267
|
+
Groups = ["dependencies"],
|
268
|
+
Source = new()
|
269
|
+
{
|
270
|
+
SourceUrl = null,
|
271
|
+
Type = "nuget_repo",
|
272
|
+
}
|
273
|
+
}
|
274
|
+
],
|
275
|
+
PreviousVersion = "1.0.0",
|
276
|
+
PreviousRequirements = [
|
277
|
+
new()
|
278
|
+
{
|
279
|
+
Requirement = "1.0.0",
|
280
|
+
File = "/library2/library2.csproj",
|
281
|
+
Groups = ["dependencies"],
|
282
|
+
}
|
283
|
+
],
|
284
|
+
},
|
285
|
+
new()
|
286
|
+
{
|
287
|
+
Name = "Some.Package",
|
288
|
+
Version = "2.0.0",
|
289
|
+
Requirements = [
|
290
|
+
new()
|
291
|
+
{
|
292
|
+
Requirement = "2.0.0",
|
293
|
+
File = "/library3/library3.csproj",
|
294
|
+
Groups = ["dependencies"],
|
295
|
+
Source = new()
|
296
|
+
{
|
297
|
+
SourceUrl = null,
|
298
|
+
Type = "nuget_repo",
|
299
|
+
}
|
300
|
+
}
|
301
|
+
],
|
302
|
+
PreviousVersion = "1.0.0",
|
303
|
+
PreviousRequirements = [
|
304
|
+
new()
|
305
|
+
{
|
306
|
+
Requirement = "1.0.0",
|
307
|
+
File = "/library3/library3.csproj",
|
308
|
+
Groups = ["dependencies"],
|
309
|
+
}
|
310
|
+
],
|
311
|
+
},
|
312
|
+
],
|
313
|
+
UpdatedDependencyFiles = [
|
314
|
+
new()
|
315
|
+
{
|
316
|
+
Directory = "/library2",
|
317
|
+
Name = "library2.csproj",
|
318
|
+
Content = """
|
319
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
320
|
+
<PropertyGroup>
|
321
|
+
<TargetFramework>net8.0</TargetFramework>
|
322
|
+
</PropertyGroup>
|
323
|
+
<ItemGroup>
|
324
|
+
<PackageReference Include="Some.Package" Version="2.0.0" />
|
325
|
+
</ItemGroup>
|
326
|
+
</Project>
|
327
|
+
"""
|
328
|
+
},
|
329
|
+
new()
|
330
|
+
{
|
331
|
+
Directory = "/library3",
|
332
|
+
Name = "library3.csproj",
|
333
|
+
Content = """
|
334
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
335
|
+
<PropertyGroup>
|
336
|
+
<TargetFramework>net8.0</TargetFramework>
|
337
|
+
</PropertyGroup>
|
338
|
+
<ItemGroup>
|
339
|
+
<PackageReference Include="Package.With.Transitive.Dependency" Version="0.1.0" />
|
340
|
+
<PackageReference Include="Some.Package" Version="2.0.0" />
|
341
|
+
</ItemGroup>
|
342
|
+
</Project>
|
343
|
+
"""
|
344
|
+
}
|
345
|
+
],
|
346
|
+
BaseCommitSha = "TEST-COMMIT-SHA",
|
347
|
+
CommitMessage = RunWorkerTests.TestPullRequestCommitMessage,
|
348
|
+
PrTitle = RunWorkerTests.TestPullRequestTitle,
|
349
|
+
PrBody = RunWorkerTests.TestPullRequestBody
|
350
|
+
},
|
351
|
+
new MarkAsProcessed("TEST-COMMIT-SHA")
|
352
|
+
]
|
353
|
+
);
|
354
|
+
}
|
355
|
+
}
|