Task 2/6: Mock HTTP server infrastructure for Ingestion API and XFUS#129
Open
elahmed-microsoft wants to merge 9 commits into
Open
Task 2/6: Mock HTTP server infrastructure for Ingestion API and XFUS#129elahmed-microsoft wants to merge 9 commits into
elahmed-microsoft wants to merge 9 commits into
Conversation
Add the WireMock.Net package reference and lock-file entries; it provides the in-process HTTP mock server used to build the Ingestion and XFUS fixtures in later phases. The package is saved to the private feed and is publicly readable, so CI restores it without authentication.
Add IngestionMockServer, a reusable WireMock.Net-backed fake of the Partner Center Ingestion API with fluent stubs for the endpoints PackageUploader uses (GetProduct, GetBranches, CreatePackage, package processing poll, package configuration, CreateSubmission, submission poll) and configurable success/error/retry/polling scenarios. Polling and retry use WireMock stateful scenarios with self-looping terminal states.
Add XfusMockServer, a reusable WireMock.Net-backed fake of the XFUS upload service serving the three-step chunked upload (initialize, block payload PUT, continue) rooted at /api/v2/assets/. Omits directUploadParameters.sasUri so the client uses the proxy PUT path, and emits the upload status as a number to match the client serializer. Provides a no-delta success convenience plus initialize/block/continue primitives and stateful continue-progression and block-retry scenarios.
…se 3) Add MockServerTestHost, which owns the Ingestion and XFUS WireMock fakes and composes the real IPackageUploaderService pointed at them (Ingestion via IngestionConfig:BaseAddress, XFUS via the upload domain returned in the package response), keeping FakeAccessTokenProvider. Extend IngestionMockServer.StubCreatePackage to embed the XFUS upload info, and add IntegrationTestBase.CreateMockServerHost().
Remove the superseded in-process PackageUploaderTestHost and MockHttpMessageHandler, migrate the smoke test to CreateMockServerHost() (real HTTP to the WireMock Ingestion fake), and drop the CreateHost overload. MockServerTestHost is now the single canonical integration test host.
…Task 2/6 Phase 4) Add IngestionApiTests (success, NotFound, transient-error retry, branches), UploadFlowTests (full no-delta upload tying the Ingestion and XFUS fakes together), and PublishFlowTests (submission create + poll to Published). Enhance IngestionMockServer with submission pendingUpdateInfo (mapper NRE guard), package-config market group, StubProcessPackage, and a flights stub; add fast retry config to MockServerTestHost.
- IngestionMockServer: emit null (not an empty object) for absent uploadInfo so the client's Guid mapping doesn't throw on a null XfusId; short-circuit StubRetryThenSuccess(failures<=0) to an unconditional success instead of an unmatched 404. - XfusMockServer: short-circuit StubBlockUploadRetryThenSuccess(failures<=0); document the single-asset-per-server assumption of StubContinueProgression. - MockServerTestHost: dispose the WireMock servers if composition throws, to avoid leaking listeners. - UploadFlowTests: assert a block payload PUT actually reached XFUS rather than any request.
This was referenced Jun 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Second task (2/6) of the PackageUploader Integration Test Suite & Azure DevOps Pipeline deliverable. Builds reusable mock HTTP server infrastructure so integration tests can exercise PackageUploader's full flows against the Partner Center Ingestion API and XFUS with no live environment or credentials.
Builds on Task 1 (the
PackageUploader.IntegrationTestproject, host, and CI category split).IsPackable=false) provisioned into the private feed and publicly readable, so CI restores it without authentication.IngestionMockServer— reusable fake of the Ingestion API with fluent stubs for GetProduct, GetBranches, CreatePackage, package-processing poll, package configuration, CreateSubmission, and submission poll. Supports configurable success / error / retry / polling scenarios via WireMock stateful scenarios.XfusMockServer— reusable fake of the XFUS upload service serving the three-step chunked upload (initialize -> block payload PUT -> continue), rooted at/api/v2/assets/, for the no-delta path plus success / error / retry scenarios.MockServerTestHost— composes the realIPackageUploaderServicewired to both fakes (Ingestion via base address; XFUS via the upload domain returned in the package response), with a fake access-token provider. Consolidated the two earlier Task 1 hosts into this single canonical host.IngestionApiTests(success, NotFound, transient-error retry, branches),UploadFlowTests(full no-delta upload tying both fakes together), andPublishFlowTests(submission create + poll to Published).Out of scope (later tasks 3-6)
Per-operation E2E coverage for all 8 operations, the full delta-upload flow end-to-end, error/timeout flow tests, the Azure DevOps pipeline, and live-service (Tier 2) execution.