Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Commit

Permalink
Add ExtensionData to Report record so that it is picked up by Scr…
Browse files Browse the repository at this point in the history
…iban
  • Loading branch information
DrChat committed Sep 6, 2023
1 parent e007b3d commit 0c9d589
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/ApiService/ApiService/OneFuzzTypes/Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -509,10 +509,10 @@ public record Report(
string? ToolName,
string? ToolVersion,
string? OnefuzzVersion,
Uri? ReportUrl
Uri? ReportUrl,
[property: JsonExtensionData]
Dictionary<string, JsonElement>? ExtensionData
) : IReport, ITruncatable<Report> {

[JsonExtensionData] public Dictionary<string, JsonElement>? ExtensionData { get; set; }
public Report Truncate(int maxLength) {
return this with {
Executable = TruncateUtils.TruncateString(Executable, maxLength),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.Extensions.Logging;
using System.Text.Json;
using Microsoft.Extensions.Logging;
namespace Microsoft.OneFuzz.Service;

public class JinjaTemplateAdapter {
Expand Down Expand Up @@ -116,7 +117,8 @@ public static async Async.Task<TemplateValidationResponse> ValidateScribanTempla
toolName,
toolVersion,
onefuzzVersion,
reportUrl
reportUrl,
new Dictionary<string, JsonElement>()
);

var preReqTasks = new List<Guid> { Guid.NewGuid(), Guid.NewGuid() };
Expand Down
1 change: 1 addition & 0 deletions src/ApiService/IntegrationTests/ReproVmssTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ public async Async.Task CannotCreateVMForMissingReport() {
null,
null,
null,
null,
null
);

Expand Down
3 changes: 2 additions & 1 deletion src/ApiService/Tests/OrmModelsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ from i in Arb.Generate<int>()
ToolName: s,
ToolVersion: s,
OnefuzzVersion: s,
ReportUrl: u));
ReportUrl: u,
ExtensionData: null));

public static Arbitrary<Container> ArbContainer()
=> Arb.From(from len in Gen.Choose(3, 63)
Expand Down
3 changes: 2 additions & 1 deletion src/ApiService/Tests/TemplateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ private static Report GetReport() {
null,
null,
null,
null
null,
new Dictionary<string, JsonElement>()
);
}

Expand Down
4 changes: 3 additions & 1 deletion src/ApiService/Tests/TruncationTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text.Json;
using FluentAssertions;
using Microsoft.OneFuzz.Service;
using Xunit;
Expand Down Expand Up @@ -75,7 +76,8 @@ public static Report GenerateReport() {
null,
null,
null,
new Uri("http://example.com")
new Uri("http://example.com"),
new Dictionary<string, JsonElement>()
);
}

Expand Down

0 comments on commit 0c9d589

Please sign in to comment.