Skip to content

Commit

Permalink
Remove CQCHookEndpoint related fields as package metadata now contain…
Browse files Browse the repository at this point in the history
…s it
  • Loading branch information
kMutagene committed Jun 11, 2024
1 parent 1f8e2e9 commit 6322d70
Show file tree
Hide file tree
Showing 14 changed files with 60 additions and 82 deletions.
2 changes: 1 addition & 1 deletion src/ARCExpect/ARCExpect.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
<PackageReference Include="OBO.NET" Version="[0.4.2]" />
<PackageReference Include="AnyBadge.NET" Version="[2.0.0]" />
<PackageReference Include="FSharp.SystemTextJson" Version="[1.3.13]" />
<PackageReference Include="AVPRIndex" Version="[0.1.0]" />
<PackageReference Include="AVPRIndex" Version="[0.1.1]" />
</ItemGroup>
</Project>
14 changes: 4 additions & 10 deletions src/ARCExpect/ARCValidationPackage.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,16 @@ type ARCValidationPackage =
Metadata: ValidationPackageMetadata
CriticalValidationCases: Test
NonCriticalValidationCases: Test
CQCHookEndpoint: string option
} with
static member create (
metadata: ValidationPackageMetadata,
criticalValidationCases: Test,
nonCriticalValidationCases: Test,
?CQCHookEndpoint: string
nonCriticalValidationCases: Test
) =
{
Metadata = metadata
CriticalValidationCases = criticalValidationCases
NonCriticalValidationCases = nonCriticalValidationCases
CQCHookEndpoint = CQCHookEndpoint
}

static member create (
Expand All @@ -35,19 +32,16 @@ type ARCValidationPackage =
ARCValidationPackage.create(
metadata = metadata,
criticalValidationCases = criticalCases,
nonCriticalValidationCases = nonCriticalCases,
?CQCHookEndpoint = CQCHookEndpoint
nonCriticalValidationCases = nonCriticalCases
)

static member create (
metadata: ValidationPackageMetadata,
?CriticalValidationCasesList: Test list,
?NonCriticalValidationCasesList: Test list,
?CQCHookEndpoint: string
?NonCriticalValidationCasesList: Test list
) =
ARCValidationPackage.create(
metadata = metadata,
criticalValidationCasesList = defaultArg CriticalValidationCasesList [],
nonCriticalValidationCasesList = defaultArg NonCriticalValidationCasesList [],
?CQCHookEndpoint = CQCHookEndpoint
nonCriticalValidationCasesList = defaultArg NonCriticalValidationCasesList []
)
2 changes: 1 addition & 1 deletion src/ARCExpect/BadgeCreation.fs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type BadgeCreation =
defaultColor = (DefaultColor |> Option.defaultValue (Color.fromString Defaults.DEFAULT_COLOR) ),
Thresholds = thresholds,
value = testResults.passed.Length,
ValueSuffix = $"/{max}"
ValueSuffix = valueSuffix
)


Expand Down
4 changes: 4 additions & 0 deletions src/ARCExpect/RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 3.0.0 - (Released 2024-04-30)

Remove separate `CQCHookEndpoint` because it is now directly contained in package metadata.

### 2.0.0 - (Released 2024-04-30)

Major rework and improvements of the **ARCExpect API**. The main changes are:
Expand Down
17 changes: 6 additions & 11 deletions src/ARCExpect/TopLevelAPI.fs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@ type Setup =
static member ValidationPackage(
metadata: ValidationPackageMetadata,
?CriticalValidationCases: Test list,
?NonCriticalValidationCases: Test list,
?CQCHookEndpoint: string
?NonCriticalValidationCases: Test list
) =
ARCValidationPackage.create(
metadata = metadata,
?CriticalValidationCasesList = CriticalValidationCases,
?NonCriticalValidationCasesList = NonCriticalValidationCases,
?CQCHookEndpoint = CQCHookEndpoint
?NonCriticalValidationCasesList = NonCriticalValidationCases
)

static member ValidationPackage(
Expand Down Expand Up @@ -51,11 +49,11 @@ type Setup =
?Publish = Publish,
?Authors = Authors,
?Tags = Tags,
?ReleaseNotes = ReleaseNotes
?ReleaseNotes = ReleaseNotes,
?CQCHookEndpoint = CQCHookEndpoint
),
?CriticalValidationCases = CriticalValidationCases,
?NonCriticalValidationCases = NonCriticalValidationCases,
?CQCHookEndpoint = CQCHookEndpoint
?NonCriticalValidationCases = NonCriticalValidationCases
)

type Execute =
Expand All @@ -68,10 +66,7 @@ type Execute =
ValidationSummary.ofExpectoTestRunSummaries(
criticalSummary = criticalResults,
nonCriticalSummary = nonCriticalResults,
package = ValidationPackageSummary.create(
arcValidationPackage.Metadata,
?HookEndpoint = arcValidationPackage.CQCHookEndpoint
)
package = ValidationPackageSummary.create(arcValidationPackage.Metadata)
)

static member SummaryCreation(
Expand Down
11 changes: 5 additions & 6 deletions src/ARCExpect/ValidationSummary.fs
Original file line number Diff line number Diff line change
Expand Up @@ -64,31 +64,30 @@ type ValidationPackageSummary = {
Version: string
Summary: string
Description: string
HookEndpoint: string option
CQCHookEndpoint: string option
} with
static member create(
name: string,
version: string,
summary: string,
description: string,
?HookEndpoint: string
?CQCHookEndpoint: string
) = {
Name = name
Version = version
Summary = summary
Description = description
HookEndpoint = HookEndpoint
CQCHookEndpoint = CQCHookEndpoint
}
static member create (
metadata: ValidationPackageMetadata,
?HookEndpoint: string
metadata: ValidationPackageMetadata
) =
ValidationPackageSummary.create(
name = metadata.Name,
version = ValidationPackageMetadata.getSemanticVersionString metadata,
summary = metadata.Summary,
description = metadata.Description,
?HookEndpoint = HookEndpoint
?CQCHookEndpoint = if metadata.CQCHookEndpoint = "" then None else Some metadata.CQCHookEndpoint
)

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions src/ARCValidationPackages/ARCValidationPackages.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
<ItemGroup>
<PackageReference Include="Fake.DotNet.Cli" Version="[6.0.0]" />
<PackageReference Include="FsHttp" Version="[14.5.0]" />
<PackageReference Include="AVPRClient" Version="[0.0.4]" />
<PackageReference Include="AVPRIndex" Version="[0.1.0]" />
<PackageReference Include="AVPRIndex" Version="[0.1.1]" />
<PackageReference Include="AVPRClient" Version="[0.0.5]" />
</ItemGroup>

</Project>
6 changes: 5 additions & 1 deletion src/ARCValidationPackages/RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
### 3.0.0 - (Released 2024-04-30)
### 4.0.0 - (Released 2024-04-30)

Update to AVPRIndex v0.1.1 and AVPRClient v0.0.5

### 3.0.0 - (Released 2024-04-30)

3.0.0 release of the ArcValidationPackages API.

Expand Down
10 changes: 3 additions & 7 deletions src/arc-validate/APIs/ValidateAPI.fs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ module ValidateAPI =
let version =
args.TryGetResult(Package_Version)

let mutable exitCode = ExitCode.Success

match package with

| None -> // Default call means validate schema conformity
Expand All @@ -52,7 +54,6 @@ module ValidateAPI =

let specVersion = defaultArg (args.TryGetResult(Specification_Version)) "latest"
let status = AnsiConsole.Status()
let mutable exitCode = ExitCode.Success

status.Start($"Performing validation against version '{specVersion}' of the ARC specification", fun ctx ->

Expand All @@ -79,7 +80,6 @@ module ValidateAPI =
| Some packageName -> // Validate against a specific package

let status = AnsiConsole.Status()
let mutable exitCode = ExitCode.Success

let isRelease = args.TryGetResult(ValidateArgs.Preview).IsSome |> not

Expand Down Expand Up @@ -132,9 +132,5 @@ module ValidateAPI =
AnsiConsole.MarkupLine($"[red]Package {packageName} not installed. You can run run [green]arc-validate package install <your-desired-package-name>[/] to install a validation package.[/]")
exitCode <- ExitCode.InternalError
)
try

ExitCode.Success

with e ->
ExitCode.CriticalTestFailure
exitCode
4 changes: 2 additions & 2 deletions src/arc-validate/arc-validate.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
<PackageReference Include="Spectre.Console.CLI" Version="[0.49.1]" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ARCExpect\ARCExpect.fsproj" PackageVersion="[2.0.0, 3.0.0)" />
<ProjectReference Include="..\ARCValidationPackages\ARCValidationPackages.fsproj" PackageVersion="[1.0.0, 2.0.0)" />
<ProjectReference Include="..\ARCExpect\ARCExpect.fsproj" PackageVersion="[3.0.0, 4.0.0)" />
<ProjectReference Include="..\ARCValidationPackages\ARCValidationPackages.fsproj" PackageVersion="[4.0.0, 5.0.0)" />
</ItemGroup>
<Target Name="UseExplicitPackageVersions" BeforeTargets="GenerateNuspec">
<ItemGroup>
Expand Down
9 changes: 5 additions & 4 deletions tests/ARCExpect.Tests/ReferenceObjects.fs
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ module ValidationPackageSummary =
Version = "1.0.0"
Summary = "A package without CQC hook."
Description = "A package without CQC hook. More text here."
HookEndpoint = None
CQCHookEndpoint = None
}

let withHook = {
Name = "test"
Version = "1.0.0"
Summary = "A package with CQC hook."
Description = "A package with CQC hook. More text here."
HookEndpoint = Some "http://test.com"
CQCHookEndpoint = Some "http://test.com"
}

module ValidationSummary =
Expand All @@ -83,7 +83,7 @@ module ValidationSummary =
ValidationPackage = ValidationPackageSummary.withHook
}

let allPassedWithHookJson = """{"Critical":{"HasFailures":false,"Total":1,"Passed":1,"Failed":0,"Errored":0},"NonCritical":{"HasFailures":false,"Total":1,"Passed":1,"Failed":0,"Errored":0},"ValidationPackage":{"Name":"test","Version":"1.0.0","Summary":"A package with CQC hook.","Description":"A package with CQC hook. More text here.","HookEndpoint":"http://test.com"}}"""
let allPassedWithHookJson = """{"Critical":{"HasFailures":false,"Total":1,"Passed":1,"Failed":0,"Errored":0},"NonCritical":{"HasFailures":false,"Total":1,"Passed":1,"Failed":0,"Errored":0},"ValidationPackage":{"Name":"test","Version":"1.0.0","Summary":"A package with CQC hook.","Description":"A package with CQC hook. More text here.","CQCHookEndpoint":"http://test.com"}}"""

let allFailedNoHook =
{
Expand Down Expand Up @@ -184,7 +184,8 @@ module ValidationPackageMetadata =
MinorVersion = 0,
PatchVersion = 0,
Summary = "A package with CQC hook.",
Description = "A package with CQC hook. More text here."
Description = "A package with CQC hook. More text here.",
CQCHookEndpoint = "http://test.com"
)

module JUnitReport =
Expand Down
18 changes: 6 additions & 12 deletions tests/ARCExpect.Tests/TopLevelAPITests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ let ``Toplevel API Setup tests`` =
Expect.equal fromMetadata.Metadata.Publish fromValues.Metadata.Publish "metadata publish were not equal"
Expect.equal fromMetadata.Metadata.Tags fromValues.Metadata.Tags "metadata tags were not equal"
Expect.equal fromMetadata.Metadata.ReleaseNotes fromValues.Metadata.ReleaseNotes "metadata release notes were not equal"

Expect.equal fromMetadata.CQCHookEndpoint fromValues.CQCHookEndpoint "hook endpoint was not equal"
Expect.equal fromMetadata.Metadata.CQCHookEndpoint fromValues.Metadata.CQCHookEndpoint "hook endpoint was not equal"
}
]
testList "Execute_Validation" [
Expand All @@ -68,8 +67,7 @@ let ``Toplevel API Setup tests`` =
Setup.ValidationPackage(
metadata = ReferenceObjects.ValidationPackageMetadata.validWithHook,
CriticalValidationCases = [ReferenceObjects.TestCase.dummyTestWillPass],
NonCriticalValidationCases = [ReferenceObjects.TestCase.dummyTestWillPass],
CQCHookEndpoint = "http://test.com"
NonCriticalValidationCases = [ReferenceObjects.TestCase.dummyTestWillPass]
)
|> Execute.Validation
Expect.validationSummaryEqualIgnoringOriginal actual ReferenceObjects.ValidationSummary.allPassedWithHook
Expand All @@ -81,8 +79,7 @@ let ``Toplevel API Setup tests`` =
Setup.ValidationPackage(
metadata = ReferenceObjects.ValidationPackageMetadata.validWithHook,
CriticalValidationCases = [ReferenceObjects.TestCase.dummyTestWillPass],
NonCriticalValidationCases = [ReferenceObjects.TestCase.dummyTestWillPass],
CQCHookEndpoint = "http://test.com"
NonCriticalValidationCases = [ReferenceObjects.TestCase.dummyTestWillPass]
)
|> Execute.Validation
|> Execute.SummaryCreation path
Expand All @@ -99,8 +96,7 @@ let ``Toplevel API Setup tests`` =
Setup.ValidationPackage(
metadata = ReferenceObjects.ValidationPackageMetadata.validWithHook,
CriticalValidationCases = [ReferenceObjects.TestCase.dummyTestWillPass],
NonCriticalValidationCases = [ReferenceObjects.TestCase.dummyTestWillPass],
CQCHookEndpoint = "http://test.com"
NonCriticalValidationCases = [ReferenceObjects.TestCase.dummyTestWillPass]
)
|> Execute.Validation
|> Execute.JUnitReportCreation path
Expand All @@ -117,8 +113,7 @@ let ``Toplevel API Setup tests`` =
Setup.ValidationPackage(
metadata = ReferenceObjects.ValidationPackageMetadata.validWithHook,
CriticalValidationCases = [ReferenceObjects.TestCase.dummyTestWillPass],
NonCriticalValidationCases = [ReferenceObjects.TestCase.dummyTestWillPass],
CQCHookEndpoint = "http://test.com"
NonCriticalValidationCases = [ReferenceObjects.TestCase.dummyTestWillPass]
)
|> Execute.Validation
|> Execute.BadgeCreation(path, labelText="allPassedWithHook")
Expand All @@ -134,8 +129,7 @@ let ``Toplevel API Setup tests`` =
Setup.ValidationPackage(
metadata = ReferenceObjects.ValidationPackageMetadata.validWithHook,
CriticalValidationCases = [ReferenceObjects.TestCase.dummyTestWillPass],
NonCriticalValidationCases = [ReferenceObjects.TestCase.dummyTestWillPass],
CQCHookEndpoint = "http://test.com"
NonCriticalValidationCases = [ReferenceObjects.TestCase.dummyTestWillPass]
)
|> Execute.ValidationPipeline(
basePath = path
Expand Down
4 changes: 2 additions & 2 deletions tests/ARCExpect.Tests/ValidationSummaryTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ let testPackageWithHook = ValidationPackageSummary.create(
version = testPackageVersion,
summary = testSummaryWithHook,
description = testDescriptionWithHook,
HookEndpoint = testHook
CQCHookEndpoint = testHook
)

[<Tests>]
Expand Down Expand Up @@ -63,7 +63,7 @@ let ``ValidationResult tests`` =
version = testPackageVersion,
summary = testSummaryWithHook,
description = testDescriptionWithHook,
HookEndpoint = testHook
CQCHookEndpoint = testHook
)
Expect.equal actual ReferenceObjects.ValidationPackageSummary.withHook "package summary was not equal"
}
Expand Down
Loading

0 comments on commit 6322d70

Please sign in to comment.