Skip to content

Pull out the HTTP mock server as cargo-dev-registry #14834

Open
@0xPoe

Description

@0xPoe

Problem

In Cargo's unit tests, we used a mock HTTP server as our test infrastructure. But it is not a fully implemented registry. Some unit tests are just using custom handler to mock some registry API.

So as I discussed with @weihanglo and @epage, we both agree that having full featured dev registry in cargo would help the testing a lot. And maybe help us to catch some bugs that can only be caught in a real cargo registry.

At the same time, if we can have a standalone dev registry, it would help us a lot when testing or debugging the cargo itself. At the moment, it is difficult to test the real publish function, because setting up a real registry from scratch is difficult.

Furthermore, if we try to implement this dev registry, we can give other people a reference about how to implement the basic API for a cargo registry. We can also extend the common library for building a cargo registry. We believe this would not only help the cargo itself, but also help the community to implement a registry more easily.

Proposed Solution

As discussed with @epage, he suggested that we can do the following things to pull out the mock HTTP server as our cargo-dev-registry.

  • switch cargo's summary generation to use a normalized manifest, rather than a Package
  • pull registry types like IndexPackage out into cargo-util-schemas
  • pull out index/manifest/publish conversions into a cargo-util-registry
  • switch our dev registry to using the above rather than reimplement
  • pull our dev registry out into cargo-dev-registry with an optional cli for spinning it up

Notes

No response

Metadata

Metadata

Assignees

Labels

A-cargo-apiArea: cargo-the-library API and internal code issuesC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or review

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions