From af2ee1eecf4ebe1dbb5e2d03e3aa6c9ff8212191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20CORTIER?= Date: Fri, 28 Aug 2026 23:32:02 +0900 Subject: [PATCH] refactor(policy): keep mock server test-only Move the package broker mock into integration-test support and relocate cross-language fixtures outside the published crate. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- policies/docs/event-channel-protocol.md | 2 +- .../TestData.cs | 17 ++++++------- .../now-policy-server-template/Cargo.toml | 2 +- .../rust/now-policy-server-template/README.md | 20 ++------------- .../now-policy-server-template/src/lib.rs | 4 +-- .../tests/sample_documents.rs | 12 ++++++--- .../{src => tests/support}/mock.rs | 24 +++++++++--------- .../tests/support/mod.rs | 1 + .../frames/event-channel.frames.bin | Bin .../requests/cancel-running.request.json | 0 .../chocolatey-git-install.request.json | 0 .../requests/missing-package-id.request.json | 0 .../powershell-pester-allusers.request.json | 0 ...powershell-pester-currentuser.request.json | 0 ...rshell-pester-poshtestgallery.request.json | 0 .../powershell-pester-prerelease.request.json | 0 .../powershell-pester-skipcheck.request.json | 0 ...ell-pester-update-currentuser.request.json | 0 ...rshell-pester-version-allowed.request.json | 0 ...l-pester-version-out-of-range.request.json | 0 .../status-query-completed.request.json | 0 ...t-git-custom-location-allowed.request.json | 0 ...et-git-custom-location-denied.request.json | 0 ...nget-git-custom-param-allowed.request.json | 0 ...inget-git-custom-param-denied.request.json | 0 .../winget-git-uninstall.request.json | 0 .../winget-powertoys-install.request.json | 0 .../winget-unknown-install.request.json | 0 .../winget-vscode-custom-param.request.json | 0 .../winget-vscode-install.request.json | 0 .../winget-vscode-install.request.yaml | 0 .../winget-vscode-interactive.request.json | 0 .../winget-vscode-kill-before.request.json | 0 .../winget-vscode-msstore.request.json | 0 .../winget-vscode-prepost.request.json | 0 .../winget-vscode-prerelease.request.json | 0 .../winget-vscode-skiphash.request.json | 0 ...winget-vscode-update-in-range.request.json | 0 ...inget-vscode-version-in-range.request.json | 0 ...t-vscode-version-out-of-range.request.json | 0 .../winget-vscode-winget-fonts.request.json | 0 .../requests/winget-vscode-x86.request.json | 0 .../responses/cancel-accepted.response.json | 0 .../responses/capabilities.response.json | 0 ...cution-winget-vscode-install.response.json | 0 .../responses/health-ready.response.json | 0 .../responses/policy.response.json | 0 .../responses/status-canceled.response.json | 0 .../responses/status-completed.response.json | 0 .../responses/status-failed.response.json | 0 .../responses/status-running.response.json | 0 .../responses/status-starting.response.json | 0 .../responses/status-timeout.response.json | 0 ...inget-vscode-install.allowed.response.json | 0 ...inget-vscode-skiphash.denied.response.json | 0 .../scenarios/baseline.scenarios.json | 0 .../scenarios/extended.scenarios.json | 0 57 files changed, 34 insertions(+), 48 deletions(-) rename policies/rust/now-policy-server-template/{src => tests/support}/mock.rs (91%) create mode 100644 policies/rust/now-policy-server-template/tests/support/mod.rs rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/frames/event-channel.frames.bin (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/cancel-running.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/chocolatey-git-install.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/missing-package-id.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/powershell-pester-allusers.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/powershell-pester-currentuser.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/powershell-pester-poshtestgallery.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/powershell-pester-prerelease.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/powershell-pester-skipcheck.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/powershell-pester-update-currentuser.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/powershell-pester-version-allowed.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/powershell-pester-version-out-of-range.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/status-query-completed.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/winget-git-custom-location-allowed.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/winget-git-custom-location-denied.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/winget-git-custom-param-allowed.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/winget-git-custom-param-denied.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/winget-git-uninstall.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/winget-powertoys-install.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/winget-unknown-install.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/winget-vscode-custom-param.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/winget-vscode-install.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/winget-vscode-install.request.yaml (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/winget-vscode-interactive.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/winget-vscode-kill-before.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/winget-vscode-msstore.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/winget-vscode-prepost.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/winget-vscode-prerelease.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/winget-vscode-skiphash.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/winget-vscode-update-in-range.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/winget-vscode-version-in-range.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/winget-vscode-version-out-of-range.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/winget-vscode-winget-fonts.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/requests/winget-vscode-x86.request.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/responses/cancel-accepted.response.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/responses/capabilities.response.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/responses/execution-winget-vscode-install.response.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/responses/health-ready.response.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/responses/policy.response.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/responses/status-canceled.response.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/responses/status-completed.response.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/responses/status-failed.response.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/responses/status-running.response.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/responses/status-starting.response.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/responses/status-timeout.response.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/responses/winget-vscode-install.allowed.response.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/responses/winget-vscode-skiphash.denied.response.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/scenarios/baseline.scenarios.json (100%) rename policies/{rust/now-policy-server-template/assets/samples => test-data/package-broker}/scenarios/extended.scenarios.json (100%) diff --git a/policies/docs/event-channel-protocol.md b/policies/docs/event-channel-protocol.md index ce8d17c..678f2e8 100644 --- a/policies/docs/event-channel-protocol.md +++ b/policies/docs/event-channel-protocol.md @@ -10,7 +10,7 @@ Reference implementations: - Rust: `policies/rust/now-policy-api/src/event_channel.rs` - .NET: `policies/dotnet/Devolutions.Now.Policy.Api/EventChannel.cs` -- Shared test fixture: `policies/rust/now-policy-server-template/assets/samples/frames/event-channel.frames.bin` +- Shared test fixture: `policies/test-data/package-broker/frames/event-channel.frames.bin` ## Purpose diff --git a/policies/dotnet/Devolutions.Now.Policy.Client.Tests/TestData.cs b/policies/dotnet/Devolutions.Now.Policy.Client.Tests/TestData.cs index df115cc..fa16f1a 100644 --- a/policies/dotnet/Devolutions.Now.Policy.Client.Tests/TestData.cs +++ b/policies/dotnet/Devolutions.Now.Policy.Client.Tests/TestData.cs @@ -12,20 +12,19 @@ namespace Devolutions.Now.Policy.Client.Tests; /// -/// Resolves the shared schema artifacts and sample files that the Rust crate uses, so the -/// C# client is validated against the exact same fixtures. The request/response wire schemas -/// are sourced from the OpenAPI spec generated by the Rust API crate. +/// Resolves the shared schema artifacts and sample files, so the C# client is validated against +/// the exact same fixtures as the Rust implementation. The request/response wire schemas are +/// sourced from the OpenAPI spec generated by the Rust API crate. /// public static class TestData { - /// Absolute path to the Rust package broker server template crate root. - public static string CrateRoot { get; } = ResolveCrateRoot(); + private static string PoliciesRoot { get; } = ResolvePoliciesRoot(); - public static string SamplesDir => Path.Combine(CrateRoot, "assets", "samples"); + public static string SamplesDir => Path.Combine(PoliciesRoot, "test-data", "package-broker"); /// The OpenAPI specification: the source of truth for the request/response wire schemas. public static string OpenApiSpec => - Path.Combine(CrateRoot, "..", "now-policy-api", "openapi", "now-policy-api.yaml"); + Path.Combine(PoliciesRoot, "rust", "now-policy-api", "openapi", "now-policy-api.yaml"); private static readonly SemaphoreSlim s_docLock = new(1, 1); private static OpenApiDocument? s_doc; @@ -202,9 +201,9 @@ private static IEnumerable JsonFiles(string dir) => private static bool IsInvalidRequestSample(string path) => Path.GetFileName(path).Equals("missing-package-id.request.json", StringComparison.Ordinal); - private static string ResolveCrateRoot([CallerFilePath] string thisFile = "") + private static string ResolvePoliciesRoot([CallerFilePath] string thisFile = "") { var testsDir = Path.GetDirectoryName(thisFile)!; - return Path.GetFullPath(Path.Combine(testsDir, "..", "..", "rust", "now-policy-server-template")); + return Path.GetFullPath(Path.Combine(testsDir, "..", "..")); } } \ No newline at end of file diff --git a/policies/rust/now-policy-server-template/Cargo.toml b/policies/rust/now-policy-server-template/Cargo.toml index ed6ead8..444b411 100644 --- a/policies/rust/now-policy-server-template/Cargo.toml +++ b/policies/rust/now-policy-server-template/Cargo.toml @@ -7,7 +7,7 @@ homepage.workspace = true repository.workspace = true authors.workspace = true readme = "README.md" -description = "Reusable Devolutions NOW package broker server facade, mock, and OpenAPI generator" +description = "Reusable Devolutions NOW package broker server facade and OpenAPI generator" publish = true [lints] diff --git a/policies/rust/now-policy-server-template/README.md b/policies/rust/now-policy-server-template/README.md index 3e3f484..e1e0600 100644 --- a/policies/rust/now-policy-server-template/README.md +++ b/policies/rust/now-policy-server-template/README.md @@ -1,7 +1,7 @@ Devolutions NOW policy server template ====================================== -`now-policy-server-template` is the reusable server facade, HTTP route binding, mock implementation, OpenAPI generator, and sample fixture owner for the Devolutions NOW package broker API. +`now-policy-server-template` is the reusable server facade, HTTP route binding, and OpenAPI generator for the Devolutions NOW package broker API. Purpose ------- @@ -15,16 +15,13 @@ The crate is used to: - expose the `PackageBrokerServer` trait implemented by runtime brokers; - bind that trait to the canonical HTTP endpoints; - keep runtime routing and OpenAPI generation based on the same route definitions; -- provide a deterministic mock server for tests and client development; -- store sample request/response documents used by Rust and .NET validation. Architecture ------------ -The crate has three main surfaces: +The crate has two main components: - `server.rs` defines `PackageBrokerServer`, router builders, endpoint handlers, error-to-HTTP status mapping, and OpenAPI generation. -- `mock.rs` provides `MockPackageBrokerServer`, a deterministic in-memory implementation backed by registered sample responses and default health/capability data. - `tools/generate_openapi.rs` generates the OpenAPI YAML file into the sibling `now-policy-api/openapi/` directory. The crate re-exports `now-policy-api`, so tests and consumers that need the server template can import both server utilities and API DTOs from `now_policy_server_template`. @@ -59,19 +56,6 @@ Then they pass the implementation to `api_router` or `api_router_from_shared`. T This keeps route dispatch, error responses, and OpenAPI operation metadata in one place. -Mock and fixtures ------------------ - -`MockPackageBrokerServer` is intended for protocol tests, sample validation, and client development. It returns deterministic health/capabilities responses and can be configured with policy, evaluation, execution, and status responses loaded from fixture files. - -Sample documents live under: - -```text -assets/samples/ -``` - -They are treated as protocol fixtures rather than implementation fixtures. Rust tests deserialize them through the API model, exercise the mock/router path, and .NET tests validate equivalent DTOs against the generated OpenAPI schema. - OpenAPI generation ------------------ diff --git a/policies/rust/now-policy-server-template/src/lib.rs b/policies/rust/now-policy-server-template/src/lib.rs index dfc233c..23ca235 100644 --- a/policies/rust/now-policy-server-template/src/lib.rs +++ b/policies/rust/now-policy-server-template/src/lib.rs @@ -1,11 +1,9 @@ -//! Devolutions NOW package broker server facade, mock, and OpenAPI generator. +//! Devolutions NOW package broker server facade and OpenAPI generator. #![allow(clippy::std_instead_of_core, unused_qualifications)] -pub mod mock; pub mod server; -pub use mock::*; pub use now_policy_api::*; pub use server::*; diff --git a/policies/rust/now-policy-server-template/tests/sample_documents.rs b/policies/rust/now-policy-server-template/tests/sample_documents.rs index 37f31df..94654b6 100644 --- a/policies/rust/now-policy-server-template/tests/sample_documents.rs +++ b/policies/rust/now-policy-server-template/tests/sample_documents.rs @@ -7,14 +7,18 @@ use axum::http::{Request, StatusCode}; use now_policy_server_template::{ API_VERSION_STR, CancelRequest, CancelResponse, CapabilitiesResponse, CapabilitiesResponseKind, DEFAULT_PIPE_NAME, ErrorCode, ErrorResponse, ErrorResponseKind, EvaluationResponse, ExecutionResponse, HealthResponse, - HealthResponseKind, HealthStatus, MAX_REQUEST_BODY_BYTES, ManagerName, MockPackageBrokerServer, Operation, - PackageBrokerServer, PackageRequest, PolicyResponse, PolicyResponseKind, Scope, ServerContext, StatusRequest, - StatusRequestKind, StatusResponse, Transport, api_router, + HealthResponseKind, HealthStatus, MAX_REQUEST_BODY_BYTES, ManagerName, Operation, PackageBrokerServer, + PackageRequest, PolicyResponse, PolicyResponseKind, Scope, ServerContext, StatusRequest, StatusRequestKind, + StatusResponse, Transport, api_router, }; use tower::ServiceExt; +use support::mock::MockPackageBrokerServer; + +mod support; + fn samples_dir() -> PathBuf { - PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("assets/samples") + PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../test-data/package-broker") } fn load_text_file(path: &Path) -> String { diff --git a/policies/rust/now-policy-server-template/src/mock.rs b/policies/rust/now-policy-server-template/tests/support/mock.rs similarity index 91% rename from policies/rust/now-policy-server-template/src/mock.rs rename to policies/rust/now-policy-server-template/tests/support/mock.rs index 32ae256..32e91d3 100644 --- a/policies/rust/now-policy-server-template/src/mock.rs +++ b/policies/rust/now-policy-server-template/tests/support/mock.rs @@ -4,17 +4,17 @@ use std::collections::BTreeMap; use async_trait::async_trait; -use crate::server::{MAX_REQUEST_BODY_BYTES, PackageBrokerServer}; -use now_policy_api::{ +use now_policy_server_template::{ API_VERSION_STR, Architecture, CancelRequest, CancelResponse, CapabilitiesResponse, CapabilitiesResponseKind, ErrorCode, ErrorResponse, ErrorResponseKind, EvaluationResponse, ExecutionResponse, HealthResponse, - HealthResponseKind, HealthStatus, ManagerCapability, ManagerName, Operation, PackageRequest, PolicyResponse, Scope, - ServerContext, StatusRequest, StatusResponse, Transport, + HealthResponseKind, HealthStatus, MAX_REQUEST_BODY_BYTES, ManagerCapability, ManagerName, Operation, + PackageBrokerServer, PackageRequest, PolicyResponse, Scope, ServerContext, StatusRequest, StatusResponse, + Transport, }; /// Deterministic mock broker backed by caller-provided sample responses. #[derive(Debug, Clone)] -pub struct MockPackageBrokerServer { +pub(crate) struct MockPackageBrokerServer { health: HealthResponse, capabilities: CapabilitiesResponse, policy_response: Option, @@ -26,7 +26,7 @@ pub struct MockPackageBrokerServer { } impl MockPackageBrokerServer { - pub fn new(_pipe_name: impl Into) -> Self { + pub(crate) fn new(_pipe_name: impl Into) -> Self { let server = server_context(); Self { health: HealthResponse { @@ -54,42 +54,42 @@ impl MockPackageBrokerServer { } #[must_use] - pub fn with_evaluation_response(mut self, response: EvaluationResponse) -> Self { + pub(crate) fn with_evaluation_response(mut self, response: EvaluationResponse) -> Self { self.evaluation_responses .insert(response.request_id.to_string(), response); self } #[must_use] - pub fn with_policy_response(mut self, response: PolicyResponse) -> Self { + pub(crate) fn with_policy_response(mut self, response: PolicyResponse) -> Self { self.policy_response = Some(response); self.policy_error = None; self } #[must_use] - pub fn with_policy_error(mut self, error: ErrorResponse) -> Self { + pub(crate) fn with_policy_error(mut self, error: ErrorResponse) -> Self { self.policy_response = None; self.policy_error = Some(error); self } #[must_use] - pub fn with_execution_response(mut self, response: ExecutionResponse) -> Self { + pub(crate) fn with_execution_response(mut self, response: ExecutionResponse) -> Self { self.execution_responses .insert(response.request_id.to_string(), response); self } #[must_use] - pub fn with_status_response(mut self, response: StatusResponse) -> Self { + pub(crate) fn with_status_response(mut self, response: StatusResponse) -> Self { self.status_responses .insert(response.operation_id.to_string(), response); self } #[must_use] - pub fn with_cancel_response(mut self, response: CancelResponse) -> Self { + pub(crate) fn with_cancel_response(mut self, response: CancelResponse) -> Self { self.cancel_responses .insert(response.operation_id.to_string(), response); self diff --git a/policies/rust/now-policy-server-template/tests/support/mod.rs b/policies/rust/now-policy-server-template/tests/support/mod.rs new file mode 100644 index 0000000..5c8ab12 --- /dev/null +++ b/policies/rust/now-policy-server-template/tests/support/mod.rs @@ -0,0 +1 @@ +pub(crate) mod mock; diff --git a/policies/rust/now-policy-server-template/assets/samples/frames/event-channel.frames.bin b/policies/test-data/package-broker/frames/event-channel.frames.bin similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/frames/event-channel.frames.bin rename to policies/test-data/package-broker/frames/event-channel.frames.bin diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/cancel-running.request.json b/policies/test-data/package-broker/requests/cancel-running.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/cancel-running.request.json rename to policies/test-data/package-broker/requests/cancel-running.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/chocolatey-git-install.request.json b/policies/test-data/package-broker/requests/chocolatey-git-install.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/chocolatey-git-install.request.json rename to policies/test-data/package-broker/requests/chocolatey-git-install.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/missing-package-id.request.json b/policies/test-data/package-broker/requests/missing-package-id.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/missing-package-id.request.json rename to policies/test-data/package-broker/requests/missing-package-id.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/powershell-pester-allusers.request.json b/policies/test-data/package-broker/requests/powershell-pester-allusers.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/powershell-pester-allusers.request.json rename to policies/test-data/package-broker/requests/powershell-pester-allusers.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/powershell-pester-currentuser.request.json b/policies/test-data/package-broker/requests/powershell-pester-currentuser.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/powershell-pester-currentuser.request.json rename to policies/test-data/package-broker/requests/powershell-pester-currentuser.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/powershell-pester-poshtestgallery.request.json b/policies/test-data/package-broker/requests/powershell-pester-poshtestgallery.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/powershell-pester-poshtestgallery.request.json rename to policies/test-data/package-broker/requests/powershell-pester-poshtestgallery.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/powershell-pester-prerelease.request.json b/policies/test-data/package-broker/requests/powershell-pester-prerelease.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/powershell-pester-prerelease.request.json rename to policies/test-data/package-broker/requests/powershell-pester-prerelease.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/powershell-pester-skipcheck.request.json b/policies/test-data/package-broker/requests/powershell-pester-skipcheck.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/powershell-pester-skipcheck.request.json rename to policies/test-data/package-broker/requests/powershell-pester-skipcheck.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/powershell-pester-update-currentuser.request.json b/policies/test-data/package-broker/requests/powershell-pester-update-currentuser.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/powershell-pester-update-currentuser.request.json rename to policies/test-data/package-broker/requests/powershell-pester-update-currentuser.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/powershell-pester-version-allowed.request.json b/policies/test-data/package-broker/requests/powershell-pester-version-allowed.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/powershell-pester-version-allowed.request.json rename to policies/test-data/package-broker/requests/powershell-pester-version-allowed.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/powershell-pester-version-out-of-range.request.json b/policies/test-data/package-broker/requests/powershell-pester-version-out-of-range.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/powershell-pester-version-out-of-range.request.json rename to policies/test-data/package-broker/requests/powershell-pester-version-out-of-range.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/status-query-completed.request.json b/policies/test-data/package-broker/requests/status-query-completed.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/status-query-completed.request.json rename to policies/test-data/package-broker/requests/status-query-completed.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/winget-git-custom-location-allowed.request.json b/policies/test-data/package-broker/requests/winget-git-custom-location-allowed.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/winget-git-custom-location-allowed.request.json rename to policies/test-data/package-broker/requests/winget-git-custom-location-allowed.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/winget-git-custom-location-denied.request.json b/policies/test-data/package-broker/requests/winget-git-custom-location-denied.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/winget-git-custom-location-denied.request.json rename to policies/test-data/package-broker/requests/winget-git-custom-location-denied.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/winget-git-custom-param-allowed.request.json b/policies/test-data/package-broker/requests/winget-git-custom-param-allowed.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/winget-git-custom-param-allowed.request.json rename to policies/test-data/package-broker/requests/winget-git-custom-param-allowed.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/winget-git-custom-param-denied.request.json b/policies/test-data/package-broker/requests/winget-git-custom-param-denied.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/winget-git-custom-param-denied.request.json rename to policies/test-data/package-broker/requests/winget-git-custom-param-denied.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/winget-git-uninstall.request.json b/policies/test-data/package-broker/requests/winget-git-uninstall.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/winget-git-uninstall.request.json rename to policies/test-data/package-broker/requests/winget-git-uninstall.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/winget-powertoys-install.request.json b/policies/test-data/package-broker/requests/winget-powertoys-install.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/winget-powertoys-install.request.json rename to policies/test-data/package-broker/requests/winget-powertoys-install.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/winget-unknown-install.request.json b/policies/test-data/package-broker/requests/winget-unknown-install.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/winget-unknown-install.request.json rename to policies/test-data/package-broker/requests/winget-unknown-install.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/winget-vscode-custom-param.request.json b/policies/test-data/package-broker/requests/winget-vscode-custom-param.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/winget-vscode-custom-param.request.json rename to policies/test-data/package-broker/requests/winget-vscode-custom-param.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/winget-vscode-install.request.json b/policies/test-data/package-broker/requests/winget-vscode-install.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/winget-vscode-install.request.json rename to policies/test-data/package-broker/requests/winget-vscode-install.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/winget-vscode-install.request.yaml b/policies/test-data/package-broker/requests/winget-vscode-install.request.yaml similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/winget-vscode-install.request.yaml rename to policies/test-data/package-broker/requests/winget-vscode-install.request.yaml diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/winget-vscode-interactive.request.json b/policies/test-data/package-broker/requests/winget-vscode-interactive.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/winget-vscode-interactive.request.json rename to policies/test-data/package-broker/requests/winget-vscode-interactive.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/winget-vscode-kill-before.request.json b/policies/test-data/package-broker/requests/winget-vscode-kill-before.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/winget-vscode-kill-before.request.json rename to policies/test-data/package-broker/requests/winget-vscode-kill-before.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/winget-vscode-msstore.request.json b/policies/test-data/package-broker/requests/winget-vscode-msstore.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/winget-vscode-msstore.request.json rename to policies/test-data/package-broker/requests/winget-vscode-msstore.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/winget-vscode-prepost.request.json b/policies/test-data/package-broker/requests/winget-vscode-prepost.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/winget-vscode-prepost.request.json rename to policies/test-data/package-broker/requests/winget-vscode-prepost.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/winget-vscode-prerelease.request.json b/policies/test-data/package-broker/requests/winget-vscode-prerelease.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/winget-vscode-prerelease.request.json rename to policies/test-data/package-broker/requests/winget-vscode-prerelease.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/winget-vscode-skiphash.request.json b/policies/test-data/package-broker/requests/winget-vscode-skiphash.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/winget-vscode-skiphash.request.json rename to policies/test-data/package-broker/requests/winget-vscode-skiphash.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/winget-vscode-update-in-range.request.json b/policies/test-data/package-broker/requests/winget-vscode-update-in-range.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/winget-vscode-update-in-range.request.json rename to policies/test-data/package-broker/requests/winget-vscode-update-in-range.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/winget-vscode-version-in-range.request.json b/policies/test-data/package-broker/requests/winget-vscode-version-in-range.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/winget-vscode-version-in-range.request.json rename to policies/test-data/package-broker/requests/winget-vscode-version-in-range.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/winget-vscode-version-out-of-range.request.json b/policies/test-data/package-broker/requests/winget-vscode-version-out-of-range.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/winget-vscode-version-out-of-range.request.json rename to policies/test-data/package-broker/requests/winget-vscode-version-out-of-range.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/winget-vscode-winget-fonts.request.json b/policies/test-data/package-broker/requests/winget-vscode-winget-fonts.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/winget-vscode-winget-fonts.request.json rename to policies/test-data/package-broker/requests/winget-vscode-winget-fonts.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/requests/winget-vscode-x86.request.json b/policies/test-data/package-broker/requests/winget-vscode-x86.request.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/requests/winget-vscode-x86.request.json rename to policies/test-data/package-broker/requests/winget-vscode-x86.request.json diff --git a/policies/rust/now-policy-server-template/assets/samples/responses/cancel-accepted.response.json b/policies/test-data/package-broker/responses/cancel-accepted.response.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/responses/cancel-accepted.response.json rename to policies/test-data/package-broker/responses/cancel-accepted.response.json diff --git a/policies/rust/now-policy-server-template/assets/samples/responses/capabilities.response.json b/policies/test-data/package-broker/responses/capabilities.response.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/responses/capabilities.response.json rename to policies/test-data/package-broker/responses/capabilities.response.json diff --git a/policies/rust/now-policy-server-template/assets/samples/responses/execution-winget-vscode-install.response.json b/policies/test-data/package-broker/responses/execution-winget-vscode-install.response.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/responses/execution-winget-vscode-install.response.json rename to policies/test-data/package-broker/responses/execution-winget-vscode-install.response.json diff --git a/policies/rust/now-policy-server-template/assets/samples/responses/health-ready.response.json b/policies/test-data/package-broker/responses/health-ready.response.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/responses/health-ready.response.json rename to policies/test-data/package-broker/responses/health-ready.response.json diff --git a/policies/rust/now-policy-server-template/assets/samples/responses/policy.response.json b/policies/test-data/package-broker/responses/policy.response.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/responses/policy.response.json rename to policies/test-data/package-broker/responses/policy.response.json diff --git a/policies/rust/now-policy-server-template/assets/samples/responses/status-canceled.response.json b/policies/test-data/package-broker/responses/status-canceled.response.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/responses/status-canceled.response.json rename to policies/test-data/package-broker/responses/status-canceled.response.json diff --git a/policies/rust/now-policy-server-template/assets/samples/responses/status-completed.response.json b/policies/test-data/package-broker/responses/status-completed.response.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/responses/status-completed.response.json rename to policies/test-data/package-broker/responses/status-completed.response.json diff --git a/policies/rust/now-policy-server-template/assets/samples/responses/status-failed.response.json b/policies/test-data/package-broker/responses/status-failed.response.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/responses/status-failed.response.json rename to policies/test-data/package-broker/responses/status-failed.response.json diff --git a/policies/rust/now-policy-server-template/assets/samples/responses/status-running.response.json b/policies/test-data/package-broker/responses/status-running.response.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/responses/status-running.response.json rename to policies/test-data/package-broker/responses/status-running.response.json diff --git a/policies/rust/now-policy-server-template/assets/samples/responses/status-starting.response.json b/policies/test-data/package-broker/responses/status-starting.response.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/responses/status-starting.response.json rename to policies/test-data/package-broker/responses/status-starting.response.json diff --git a/policies/rust/now-policy-server-template/assets/samples/responses/status-timeout.response.json b/policies/test-data/package-broker/responses/status-timeout.response.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/responses/status-timeout.response.json rename to policies/test-data/package-broker/responses/status-timeout.response.json diff --git a/policies/rust/now-policy-server-template/assets/samples/responses/winget-vscode-install.allowed.response.json b/policies/test-data/package-broker/responses/winget-vscode-install.allowed.response.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/responses/winget-vscode-install.allowed.response.json rename to policies/test-data/package-broker/responses/winget-vscode-install.allowed.response.json diff --git a/policies/rust/now-policy-server-template/assets/samples/responses/winget-vscode-skiphash.denied.response.json b/policies/test-data/package-broker/responses/winget-vscode-skiphash.denied.response.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/responses/winget-vscode-skiphash.denied.response.json rename to policies/test-data/package-broker/responses/winget-vscode-skiphash.denied.response.json diff --git a/policies/rust/now-policy-server-template/assets/samples/scenarios/baseline.scenarios.json b/policies/test-data/package-broker/scenarios/baseline.scenarios.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/scenarios/baseline.scenarios.json rename to policies/test-data/package-broker/scenarios/baseline.scenarios.json diff --git a/policies/rust/now-policy-server-template/assets/samples/scenarios/extended.scenarios.json b/policies/test-data/package-broker/scenarios/extended.scenarios.json similarity index 100% rename from policies/rust/now-policy-server-template/assets/samples/scenarios/extended.scenarios.json rename to policies/test-data/package-broker/scenarios/extended.scenarios.json