Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: migrate unit tests to Rust #9

Merged
merged 3 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions .travis.yml

This file was deleted.

77 changes: 77 additions & 0 deletions Cargo.lock

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

3 changes: 3 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]
fs2 = "0.4"
Expand All @@ -15,6 +16,8 @@ error-chain = { version = "0.12", default-features = false }
clap = { version = "4.4.6", features = ["cargo"] }
uzers = "0.11.3"
openssh-keys = "0.6.2"
lazy_static = "1.4.0"
tempfile = "3.8.0"

[[bin]]
name = "update-ssh-keys"
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# update-ssh-keys

[![Build Status](https://travis-ci.org/coreos/update-ssh-keys.svg?branch=master)](https://travis-ci.org/coreos/update-ssh-keys)
![minimum rust 1.28](https://img.shields.io/badge/rust-1.28%2B-orange.svg)
[![Github CI](https://github.com/flatcar/update-ssh-keys/actions/workflows/rust.yml/badge.svg)](https://github.com/flatcar/update-ssh-keys/actions)
![minimum rust 1.60](https://img.shields.io/badge/rust-1.60%2B-orange.svg)

`update-ssh-keys` is a command line tool and a library for managing openssh
authorized public keys. It keeps track of sets of keys with names, allows for
Expand All @@ -15,6 +15,6 @@ non-Container Linux machine, you can build the project with `cargo build
--release`. The rust toolchain is required to build it. You can install `rustup`
to manage your rust toolchain - https://www.rustup.rs.

`test/test_update_ssh_keys.py` is a python script which tests the functionality
`test/test_update_ssh_keys.rs` is a Rust program which tests the functionality
of the `update-ssh-keys` command line tool. If changes are made to
`update-ssh-keys`, that script should be run.
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,11 @@ impl AuthorizedKeys {
})
}

/// close file lock to release resources for other processes
pub fn close(&self) -> Result<()> {
self.lock.unlock()
}

/// get_keys gets the authorized keyset with the provided name
pub fn get_keys(&self, name: &str) -> Option<&AuthorizedKeySet> {
self.keys.get(name)
Expand Down
21 changes: 0 additions & 21 deletions tests/compat_python.rs

This file was deleted.

Loading
Loading