Skip to content

Test panics when USER env var is not set in a Docker container #5

@szabgab

Description

@szabgab

I was trying to run the tests in a docker container where USER is not set and got a test error:

This is how I ran the Docker container:

docker run -it --rm -v$(pwd):/opt --user ubuntu szabgab/rust bash
cargo test

failures:

---- src/exec.rs - exec::ConfigInitializer::init_raw (line 133) stdout ----
Test executable failed (exit status: 101).

stderr:

thread 'main' (752) panicked at /opt/src/layer.rs:29:13:
couldn't get env var `USER` (expected type `&alloc::string::String`): environment variable not found
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace



failures:
    src/exec.rs - exec::ConfigInitializer::init_raw (line 133)

test result: FAILED. 16 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

all doctests ran in 0.28s; merged doctests compilation took 0.27s
error: doctest failed, to rerun pass `--doc`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions