https://github.com/nyuichi/sandbox-testing-rs
Run rust unit tests in docker container
https://github.com/nyuichi/sandbox-testing-rs
Last synced: about 2 months ago
JSON representation
Run rust unit tests in docker container
- Host: GitHub
- URL: https://github.com/nyuichi/sandbox-testing-rs
- Owner: nyuichi
- Created: 2021-09-16T08:51:03.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-09-16T09:04:12.000Z (over 3 years ago)
- Last Synced: 2025-01-30T13:24:11.705Z (4 months ago)
- Language: Rust
- Size: 2.93 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# sandbox-testing-rs
`sandbox-testing` is a test harness for running unit tests defined with `#[test]` attribute in a docker container.
This crate enables us to safely and securely test rust codes that modify the running environment or require the test runner to change system settings during testing.## Example
Testing if the implementation of `ToSocketAddrs` for `String` correctly refers to `/etc/resolv.conf`.
```rust
#[test]
fn test() {
sandbox_testing::test_in_docker!("ubuntu:latest");assert!("www.google.com:443".to_socket_addrs().is_ok());
std::process::Command::new("sh")
.args(&["-c", ": > /etc/resolv.conf"])
.status()
.unwrap();assert!("www.google.com:443".to_socket_addrs().is_err());
}
```#### License
Licensed under MIT license.
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in msgpack-schema by you shall be licensed as above, without any additional terms or conditions.