Skip to content

Commit

Permalink
tests: migrate unit tests to Rust
Browse files Browse the repository at this point in the history
To avoid issues like python2 not available on distros, we should simply
migrate unit tests to Rust. That would make more sense, as the main code
is already written in Rust.

Adding edition in Cargo.toml.
Without edition = 2021, build fails due to a missing "extern crate ...".
Specifying an edition, Build passes without having to add it.

To run unit tests sequentially as expected, add an option
--test-threads=1 to CI.
  • Loading branch information
dongsupark committed Jul 14, 2023
1 parent 5be7dcf commit 7c3266f
Show file tree
Hide file tree
Showing 6 changed files with 509 additions and 266 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
run: cargo test --verbose -- --test-threads=1
15 changes: 11 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ repository = "https://github.com/coreos/update-ssh-keys"
documentation = "https://docs.rs/update-ssh-keys"
description = "A tool for managing authorized SSH keys"
version = "0.4.2-alpha.0"
edition = "2021"

[dependencies]
# Private dependencies.
Expand All @@ -16,6 +17,7 @@ fs2 = "0.4"
error-chain = { version = "0.12", default-features = false }
openssh-keys = { git = "https://github.com/pothos/openssh-keys", branch = "add-sk-keys" }
users = "0.9"
lazy_static = "1.4.0"

[[bin]]
name = "update-ssh-keys"
Expand Down
21 changes: 0 additions & 21 deletions tests/compat_python.rs

This file was deleted.

240 changes: 0 additions & 240 deletions tests/test_update_ssh_keys.py

This file was deleted.

Loading

0 comments on commit 7c3266f

Please sign in to comment.