mirror of
https://github.com/rust-lang/cargo
synced 2024-10-13 19:22:33 +00:00
refactor(tests): Hack publish to balance testing/wait_for_publish
This commit is contained in:
parent
8995e84124
commit
33ba607783
|
@ -1872,7 +1872,9 @@ fn env_vars_and_build_products_for_various_build_targets() {
|
|||
|
||||
#[cargo_test]
|
||||
fn publish_artifact_dep() {
|
||||
// HACK below allows us to use a local registry
|
||||
let registry = registry::init();
|
||||
|
||||
Package::new("bar", "1.0.0").publish();
|
||||
Package::new("baz", "1.0.0").publish();
|
||||
|
||||
|
@ -1901,6 +1903,15 @@ fn publish_artifact_dep() {
|
|||
.file("src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
// HACK: Inject `foo` directly into the index so `publish` won't block for it to be in
|
||||
// the index.
|
||||
//
|
||||
// This is to ensure we can verify the Summary we post to the registry as doing so precludes
|
||||
// the registry from processing the publish.
|
||||
Package::new("foo", "0.1.0")
|
||||
.file("src/lib.rs", "")
|
||||
.publish();
|
||||
|
||||
p.cargo("publish -Z bindeps --no-verify")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! Tests for credential-process.
|
||||
|
||||
use cargo_test_support::registry::TestRegistry;
|
||||
use cargo_test_support::registry::{Package, TestRegistry};
|
||||
use cargo_test_support::{basic_manifest, cargo_process, paths, project, registry, Project};
|
||||
use std::fs;
|
||||
|
||||
|
@ -94,6 +94,16 @@ fn warn_both_token_and_process() {
|
|||
.file("src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
// HACK: Inject `foo` directly into the index so `publish` won't block for it to be in
|
||||
// the index.
|
||||
//
|
||||
// This is to ensure we can verify the Summary we post to the registry as doing so precludes
|
||||
// the registry from processing the publish.
|
||||
Package::new("foo", "0.1.0")
|
||||
.file("src/lib.rs", "")
|
||||
.alternative(true)
|
||||
.publish();
|
||||
|
||||
p.cargo("publish --no-verify --registry alternative -Z credential-process")
|
||||
.masquerade_as_nightly_cargo(&["credential-process"])
|
||||
.with_status(101)
|
||||
|
|
|
@ -858,7 +858,9 @@ bar v1.0.0
|
|||
|
||||
#[cargo_test]
|
||||
fn publish_no_implicit() {
|
||||
// HACK below allows us to use a local registry
|
||||
let registry = registry::init();
|
||||
|
||||
// Does not include implicit features or dep: syntax on publish.
|
||||
Package::new("opt-dep1", "1.0.0").publish();
|
||||
Package::new("opt-dep2", "1.0.0").publish();
|
||||
|
@ -885,6 +887,15 @@ fn publish_no_implicit() {
|
|||
.file("src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
// HACK: Inject `foo` directly into the index so `publish` won't block for it to be in
|
||||
// the index.
|
||||
//
|
||||
// This is to ensure we can verify the Summary we post to the registry as doing so precludes
|
||||
// the registry from processing the publish.
|
||||
Package::new("foo", "0.1.0")
|
||||
.file("src/lib.rs", "")
|
||||
.publish();
|
||||
|
||||
p.cargo("publish --no-verify")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_stderr(
|
||||
|
@ -971,7 +982,9 @@ feat = ["opt-dep1"]
|
|||
|
||||
#[cargo_test]
|
||||
fn publish() {
|
||||
// HACK below allows us to use a local registry
|
||||
let registry = registry::init();
|
||||
|
||||
// Publish behavior with explicit dep: syntax.
|
||||
Package::new("bar", "1.0.0").publish();
|
||||
let p = project()
|
||||
|
@ -997,6 +1010,15 @@ fn publish() {
|
|||
.file("src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
// HACK: Inject `foo` directly into the index so `publish` won't block for it to be in
|
||||
// the index.
|
||||
//
|
||||
// This is to ensure we can verify the Summary we post to the registry as doing so precludes
|
||||
// the registry from processing the publish.
|
||||
Package::new("foo", "0.1.0")
|
||||
.file("src/lib.rs", "")
|
||||
.publish();
|
||||
|
||||
p.cargo("publish")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_stderr(
|
||||
|
|
|
@ -101,6 +101,7 @@ fn validate_upload_foo_clean() {
|
|||
|
||||
#[cargo_test]
|
||||
fn simple() {
|
||||
// HACK below allows us to use a local registry
|
||||
let registry = registry::init();
|
||||
|
||||
let p = project()
|
||||
|
@ -118,6 +119,15 @@ fn simple() {
|
|||
.file("src/main.rs", "fn main() {}")
|
||||
.build();
|
||||
|
||||
// HACK: Inject `foo` directly into the index so `publish` won't block for it to be in
|
||||
// the index.
|
||||
//
|
||||
// This is to ensure we can verify the Summary we post to the registry as doing so precludes
|
||||
// the registry from processing the publish.
|
||||
Package::new("foo", "0.0.1")
|
||||
.file("src/lib.rs", "")
|
||||
.publish();
|
||||
|
||||
p.cargo("publish --no-verify")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_stderr(
|
||||
|
@ -698,6 +708,7 @@ The registry `alternative` is not listed in the `publish` value in Cargo.toml.
|
|||
|
||||
#[cargo_test]
|
||||
fn publish_allowed_registry() {
|
||||
// HACK below allows us to use a local registry
|
||||
registry::alt_init();
|
||||
|
||||
let p = project().build();
|
||||
|
@ -721,6 +732,16 @@ fn publish_allowed_registry() {
|
|||
.file("src/main.rs", "fn main() {}")
|
||||
.build();
|
||||
|
||||
// HACK: Inject `foo` directly into the index so `publish` won't block for it to be in
|
||||
// the index.
|
||||
//
|
||||
// This is to ensure we can verify the Summary we post to the registry as doing so precludes
|
||||
// the registry from processing the publish.
|
||||
Package::new("foo", "0.0.1")
|
||||
.file("src/lib.rs", "")
|
||||
.alternative(true)
|
||||
.publish();
|
||||
|
||||
p.cargo("publish --registry alternative")
|
||||
.with_stderr(
|
||||
"\
|
||||
|
@ -748,6 +769,7 @@ fn publish_allowed_registry() {
|
|||
|
||||
#[cargo_test]
|
||||
fn publish_implicitly_to_only_allowed_registry() {
|
||||
// HACK below allows us to use a local registry
|
||||
registry::alt_init();
|
||||
|
||||
let p = project().build();
|
||||
|
@ -771,6 +793,16 @@ fn publish_implicitly_to_only_allowed_registry() {
|
|||
.file("src/main.rs", "fn main() {}")
|
||||
.build();
|
||||
|
||||
// HACK: Inject `foo` directly into the index so `publish` won't block for it to be in
|
||||
// the index.
|
||||
//
|
||||
// This is to ensure we can verify the Summary we post to the registry as doing so precludes
|
||||
// the registry from processing the publish.
|
||||
Package::new("foo", "0.0.1")
|
||||
.file("src/lib.rs", "")
|
||||
.alternative(true)
|
||||
.publish();
|
||||
|
||||
p.cargo("publish")
|
||||
.with_stderr(
|
||||
"\
|
||||
|
@ -1035,6 +1067,7 @@ fn publish_with_no_default_features() {
|
|||
|
||||
#[cargo_test]
|
||||
fn publish_with_patch() {
|
||||
// HACK below allows us to use a local registry
|
||||
let registry = registry::init();
|
||||
Package::new("bar", "1.0.0").publish();
|
||||
|
||||
|
@ -1078,6 +1111,15 @@ fn publish_with_patch() {
|
|||
// Remove the usage of new functionality and try again.
|
||||
p.change_file("src/main.rs", "extern crate bar; pub fn main() {}");
|
||||
|
||||
// HACK: Inject `foo` directly into the index so `publish` won't block for it to be in
|
||||
// the index.
|
||||
//
|
||||
// This is to ensure we can verify the Summary we post to the registry as doing so precludes
|
||||
// the registry from processing the publish.
|
||||
Package::new("foo", "0.0.1")
|
||||
.file("src/lib.rs", "")
|
||||
.publish();
|
||||
|
||||
p.cargo("publish")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_stderr(
|
||||
|
@ -1233,7 +1275,9 @@ include `--registry crates-io` to use crates.io
|
|||
// A dependency with both `git` and `version`.
|
||||
#[cargo_test]
|
||||
fn publish_git_with_version() {
|
||||
// HACK below allows us to use a local registry
|
||||
let registry = registry::init();
|
||||
|
||||
Package::new("dep1", "1.0.1")
|
||||
.file("src/lib.rs", "pub fn f() -> i32 {1}")
|
||||
.publish();
|
||||
|
@ -1274,6 +1318,16 @@ fn publish_git_with_version() {
|
|||
.build();
|
||||
|
||||
p.cargo("run").with_stdout("2").run();
|
||||
|
||||
// HACK: Inject `foo` directly into the index so `publish` won't block for it to be in
|
||||
// the index.
|
||||
//
|
||||
// This is to ensure we can verify the Summary we post to the registry as doing so precludes
|
||||
// the registry from processing the publish.
|
||||
Package::new("foo", "0.1.0")
|
||||
.file("src/lib.rs", "")
|
||||
.publish();
|
||||
|
||||
p.cargo("publish --no-verify")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_stderr(
|
||||
|
@ -1367,6 +1421,7 @@ fn publish_git_with_version() {
|
|||
|
||||
#[cargo_test]
|
||||
fn publish_dev_dep_no_version() {
|
||||
// HACK below allows us to use a local registry
|
||||
let registry = registry::init();
|
||||
|
||||
let p = project()
|
||||
|
@ -1392,6 +1447,15 @@ fn publish_dev_dep_no_version() {
|
|||
.file("bar/src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
// HACK: Inject `foo` directly into the index so `publish` won't block for it to be in
|
||||
// the index.
|
||||
//
|
||||
// This is to ensure we can verify the Summary we post to the registry as doing so precludes
|
||||
// the registry from processing the publish.
|
||||
Package::new("foo", "0.1.0")
|
||||
.file("src/lib.rs", "")
|
||||
.publish();
|
||||
|
||||
p.cargo("publish --no-verify")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_stderr(
|
||||
|
@ -1846,6 +1910,7 @@ Caused by:
|
|||
|
||||
#[cargo_test]
|
||||
fn in_package_workspace() {
|
||||
// HACK below allows us to use a local registry
|
||||
let registry = registry::init();
|
||||
|
||||
let p = project()
|
||||
|
@ -1874,6 +1939,13 @@ fn in_package_workspace() {
|
|||
.file("li/src/main.rs", "fn main() {}")
|
||||
.build();
|
||||
|
||||
// HACK: Inject `foo` directly into the index so `publish` won't block for it to be in
|
||||
// the index.
|
||||
//
|
||||
// This is to ensure we can verify the Summary we post to the registry as doing so precludes
|
||||
// the registry from processing the publish.
|
||||
Package::new("li", "0.0.1").file("src/lib.rs", "").publish();
|
||||
|
||||
p.cargo("publish -p li --no-verify")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_stderr(
|
||||
|
@ -1944,6 +2016,7 @@ fn with_duplicate_spec_in_members() {
|
|||
|
||||
#[cargo_test]
|
||||
fn in_package_workspace_with_members_with_features_old() {
|
||||
// HACK below allows us to use a local registry
|
||||
let registry = registry::init();
|
||||
|
||||
let p = project()
|
||||
|
@ -1971,6 +2044,13 @@ fn in_package_workspace_with_members_with_features_old() {
|
|||
.file("li/src/main.rs", "fn main() {}")
|
||||
.build();
|
||||
|
||||
// HACK: Inject `foo` directly into the index so `publish` won't block for it to be in
|
||||
// the index.
|
||||
//
|
||||
// This is to ensure we can verify the Summary we post to the registry as doing so precludes
|
||||
// the registry from processing the publish.
|
||||
Package::new("li", "0.0.1").file("src/lib.rs", "").publish();
|
||||
|
||||
p.cargo("publish -p li --no-verify")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_stderr(
|
||||
|
|
|
@ -523,7 +523,9 @@ bar v1.0.0
|
|||
|
||||
#[cargo_test]
|
||||
fn publish() {
|
||||
// HACK below allows us to use a local registry
|
||||
let registry = registry::init();
|
||||
|
||||
// Publish behavior with /? syntax.
|
||||
Package::new("bar", "1.0.0").feature("feat", &[]).publish();
|
||||
let p = project()
|
||||
|
@ -548,6 +550,15 @@ fn publish() {
|
|||
.file("src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
// HACK: Inject `foo` directly into the index so `publish` won't block for it to be in
|
||||
// the index.
|
||||
//
|
||||
// This is to ensure we can verify the Summary we post to the registry as doing so precludes
|
||||
// the registry from processing the publish.
|
||||
Package::new("foo", "0.1.0")
|
||||
.file("src/lib.rs", "")
|
||||
.publish();
|
||||
|
||||
p.cargo("publish")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_stderr(
|
||||
|
|
Loading…
Reference in a new issue