rust-lang / rust-lang/rustup

How to test I/O errors

Open
#575 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
22h 40m
Merged PRs (30d)
46

Description

I just posted a fix for a file system error that I can't test for. rustup error handling is important but hard to test. In this case I would want to trigger out-of-disk during an installation. I'd prefer to be able to test this stuff.

I see two options:

  • Write a fuse filesystem to create the errors. Requires a lot of work, only works for file system access, not network.
  • Add mocking to the rustup-utils I/O functions, so that the test runner can e.g. set environment variables telling the I/O layer to generate specific errors. Downside is that it's ugly and isn't exercising big parts of the I/O stack.

I'm inclined toward the latter. @alexcrichton do you have opinions?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading pull request #574 and the rustup-utils I/O functions involved in that fix. Compare the proposed FUSE filesystem and mocking approaches, including network coverage, then define a test strategy and completion criteria with maintainers; this issue does not yet specify an implementation or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.