Skip to content

Task 2/6: Mock HTTP server infrastructure for Ingestion API and XFUS#129

Open
elahmed-microsoft wants to merge 9 commits into
mainfrom
users/elahmed/mock-http-server-infra
Open

Task 2/6: Mock HTTP server infrastructure for Ingestion API and XFUS#129
elahmed-microsoft wants to merge 9 commits into
mainfrom
users/elahmed/mock-http-server-infra

Conversation

@elahmed-microsoft

@elahmed-microsoft elahmed-microsoft commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

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.IntegrationTest project, host, and CI category split).

  • WireMock.Net (test-only dependency, 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 real IPackageUploaderService wired 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.
  • Integration testsIngestionApiTests (success, NotFound, transient-error retry, branches), UploadFlowTests (full no-delta upload tying both fakes together), and PublishFlowTests (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.

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.
@elahmed-microsoft elahmed-microsoft changed the title probe Task 2/6: Mock HTTP server infrastructure for Ingestion API and XFUS Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants