140 Commits

Author SHA1 Message Date
Ed Page
3a615ca9c8 feat(test): Add CargoPathExt to prelude 2024-07-18 15:22:29 -05:00
Ed Page
5b9799c6f4 refactor: Migrate from extern crate to test-support prelude
We now include the prelude in so many places, this simplifies how we can
present how `cargo-test-support` works.

Yes, this included some `use` clean ups but its already painful enough
walking through every test file, I didn't want to do it twice.
2024-07-12 15:57:00 -05:00
eth3lbert
447ac75d3e
fix(test): Reduce over-prescription to the caller
This is a follow-up fix that addresses the suggestion made in
https://github.com/rust-lang/cargo/pull/14200#discussion_r1667239028
for the remaining files.
2024-07-09 15:25:36 +08:00
eth3lbert
a00d03fd39
test: migrate registry to snapbox 2024-06-27 22:41:17 +08:00
Joe Neeman
c0287bec8d Change verification order during packaging.
Once we support packaging workspaces with dependencies, dependency
packages need to be built before anything is verified. In addition to a
little refactoring, this commit reorders the console messages so that
package metadata (archive size, etc.) is reported before verification
results.

Co-Authored-By: Tor Hovland <55164+torhovland@users.noreply.github.com>
2024-06-14 15:15:03 -05:00
Ed Page
dc5ac62cab fix(test): Deprecate non-snapbox assertions
While this is noisy and hides other deprecations, I figured deprecations would
make it easier for people to discover what tasks remain and allow us to
divide and conquer this work rather than doing a heroic PR.
In theory, this will be short lived and we'll go back to seeing
deprecations in our tests.
2024-06-10 10:20:52 -05:00
bors
ab85225804 Auto merge of #13921 - heisen-li:licence_readme_warning, r=weihanglo
fix(toml): Convert warnings that `licence` and `readme` files do not exist into errors

### What does this PR try to resolve?

In this PR:
- Changed the warning to a hard error and modified the associated test function;
- Removed what should have been a redundant test function:`publish::publish_with_missing_readme`;
- Since `cargo publish` is preceded by the execution of `cargo package`, the error message in the test `function bad_license_file` needs to be modified.

issue: https://github.com/rust-lang/cargo/issues/13629#license-file-and-readme-pointing-to-a-non-existent-file.

### Additional information

It seems that this is not enough, the current situation is that `cargo package` warns if `package.readme` is an empty string or the wrong file location, but if I cancel `package.readme`, no warning is generated.

I'm wondering if I should judge `package.readme&licence` when executing `cargo package` and return an error if it doesn't exist?

As this has not been done before, your advice is sought.
2024-06-09 13:02:50 +00:00
heisen-li
193319c66c fix(toml): Convert warnings that license and readme files do not exist into errors 2024-06-04 12:32:18 +08:00
Joe Neeman
2f97a3b323 Add a test and a comment 2024-05-09 14:09:13 -05:00
Ed Page
bec36fce99 fix(update): Remove locking message for --precise
We aren't locking to latest.
We could customize the message for precise but it seemed a bit
excessive.
2024-04-15 13:00:34 -05:00
Ed Page
e772fc93b4 feat(update): Include a Locking message 2024-04-15 12:36:36 -05:00
Ed Page
1876326b6b feat(resolve): Tell the user the style of resovle done
This is to help with #9930

Example changes:
```diff
-[LOCKING] 4 packages
+[LOCKING] 4 packages to latest version
-[LOCKING] 2 packages
+[LOCKING] 2 packages to latest Rust 1.60.0 compatible versions
-[LOCKING] 2 packages
+[LOCKING] 2 packages to earliest versions
```

Benefits
- The package count is of "added" packages and this makes that more
  logically clear
- This gives users transparency into what is happening, especially with
  - what rust-version is use
  - the transition to this feature in the new edition
  - whether the planned config was applied or not (as I don't want it to
    require an MSRV bump)
- Will make it easier in tests to show what changed
- Provides more motiviation to show this message in `cargo update` and
  `cargo install` (that will be explored in a follow up PR)

This does come at the cost of more verbose output but hopefully not too
verbose.  This is why I left off other factors, like avoid-dev-deps.
2024-04-13 20:39:59 -05:00
Ed Page
4ab2797f36 feat(lock): Print lockfile changes on all commands 2024-03-12 13:39:56 -05:00
Ed Page
14646e6af6 test: Make edition explicit on packages 2024-02-22 11:37:03 -06:00
Arlo Siemsen
dbd7c989a7 Fix confusing error messages for sparse index replaced source 2024-02-12 10:59:05 -06:00
Ed Page
e7e8d8748a fix(compiler): Clarify we're showing a profile name 2024-02-08 14:01:39 -06:00
Ed Page
012ca52bcc fix(update): Start note/warn with lowercase 2024-02-05 10:55:01 -06:00
Ed Page
c89ac1f234 feat(update): Summarize unchanged packages with updates
`--verbose` will show them.

This is prep for telling the user about `--breaking` and other flags.
2024-01-30 20:16:32 -06:00
Ed Page
675224b3a0 test(config): Shift to config.toml 2024-01-26 13:40:46 -06:00
Eric Huss
0afd943dad Fix some test output validation. 2023-11-15 15:10:18 -08:00
Jacob Finkelman
6644828028 add test 2023-10-19 18:44:42 +00:00
Jacob Finkelman
dcde7eb316 move pre-release specific error message 2023-09-12 16:06:29 +00:00
loloicci
7880215265 fix error message trying patch non-existing package with prerelease version 2023-09-12 15:57:29 +00:00
Ed Page
385dfb6298 test(registry): Show current too-new schema error
This reproduces the problem in #10623.
2023-09-11 16:19:15 +00:00
Ed Page
293b71a961 test(registry): Provide more room from tests conflicting with reality 2023-09-11 16:19:15 +00:00
Ed Page
4bf1af0cd0 fix(update): Make -p more convenient by being positional
Generally, cargo avoids positional arguments.  Mostly for the commands
that might forward arguments to another command, like `cargo test`.
It also allows some flexibility in turning flags into options.

For `cargo add` and `cargo remove`, we decided to accept positionals
because the motivations didn't seem to apply as much (similar to `cargo
install`).

This applies the pattern to `cargo update` as well which is in the same
category of commands as `cargo add` and `cargo remove`.

As for `--help` formatting, I'm mixed on whether `[SPEC]...` should be at the top like
other positionals or should be relegated to "Package selection".  I went
with the latter mostly to make it easier to visualize the less common
choice.

Switching to a positional for `cargo update` (while keeping `-p` for
backwards compatibility) was referenced in #12425.
2023-08-23 11:57:36 -05:00
Arlo Siemsen
fb98f3fcba Add test differ_only_by_metadata 2023-08-11 18:42:40 -05:00
Weihang Lo
c60c06585c
fix: clear cache for old .cargo-ok format
In 1.71, `.cargo-ok` changed to contain a JSON `{ v: 1 }` to indicate
the version of it. A failure of parsing will result in a heavy-hammer
approach that unpacks the `.crate` file again. This is in response to a
security issue that the unpacking didn't respect umask on Unix systems.
2023-08-03 13:42:54 +01:00
Weihang Lo
4fafa69a4d
fix: respect umask when unpacking .crate files
Without this, an attacker can leverage globally writable files buried
in the `.crate` file. After a user downloaded and unpacked the file,
the attacker can then write malicous code to the downloaded sources.
2023-08-03 13:41:08 +01:00
Weihang Lo
789a2fb4bf
test: verify permissions bits are preserved when unpacking
This is not secure and will be fixed in the next commit.
2023-08-03 13:39:48 +01:00
Jacob Finkelman
d6021c9c34 do not try an exponential number of package names 2023-05-05 17:15:06 +00:00
Eric Huss
6fa758e83c Fix flaky not_found_permutations test. 2023-04-14 08:01:34 -07:00
Eric Huss
c00a633bd6 Don't display headers in spurious warning message.
The headers can significantly contribute to noise in the output,
drowning out the rest of the output. Most investigation will likely be
focused on the case where cargo completely fails to download, so this
only shows the full detail in the final error message.
2023-04-12 09:38:53 -07:00
Eric Huss
4702fa3ad3 Include the IP address in HTTP errors. 2023-04-12 09:38:53 -07:00
Eric Huss
c7c9b8f32b Show some HTTP headers in error messages. 2023-04-12 09:38:52 -07:00
Eric Huss
a9e0b505d6 Update auth error message to specify args for cargo login. 2023-04-10 10:20:21 -07:00
Eric Huss
1ee340c0a7 Don't query permutations of the path prefix. 2023-04-04 18:49:42 -07:00
Eric Huss
6bd1209a55 Add delays to network retries. 2023-03-31 14:04:48 -07:00
Arlo Siemsen
78d4f2cb84 Make sparse the default protocol for crates.io 2023-03-02 10:50:22 -06:00
Scott Schafer
98c746629b chore: update registry tests to use check 2023-02-20 12:22:24 -06:00
Eric Huss
5c160dde1c Handle .cargo-ok being truncated 2023-01-31 15:03:28 -08:00
Arlo Siemsen
7dc5506756 Stabilize sparse-registry 2023-01-05 11:04:52 -06:00
Jacob Finkelman
f20ab0fa9b move login tests 2022-12-14 20:40:59 +00:00
Jacob Finkelman
29ff25f6d9 cleanups round 1 2022-12-13 23:49:07 +00:00
Jacob Finkelman
c2a1daab63 print the public key on login 2022-12-13 19:09:57 +00:00
Jacob Finkelman
40325c4d4a generate and check secret_key 2022-12-12 17:52:49 +00:00
Jacob Finkelman
b907a7f7ea Add test for wrighting keys 2022-12-12 17:51:47 +00:00
bors
0460192d1a Auto merge of #11337 - weihanglo:compression-ratio, r=ehuss
Aware of compression ratio for unpack size limit
2022-11-29 19:10:00 +00:00
Arlo Siemsen
9827412fee Implement RFC 3139: alternative registry authentication support 2022-11-16 14:36:19 -06:00
Weihang Lo
de7cd31eac
aware of compression ratio for unpack size limit 2022-11-04 18:40:44 +00:00