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

Conversation

dongsupark
Copy link
Member

@dongsupark dongsupark commented Jul 11, 2023

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.

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

As Rust does not support global variables by default, it is necessary to make use of lazy_static, so the variables could be accessed in multiple tests.

Fixes: flatcar/Flatcar#1081

@dongsupark dongsupark force-pushed the dongsu/rust-tests branch 2 times, most recently from 08ba464 to 7c3266f Compare July 14, 2023 10:39
@dongsupark dongsupark marked this pull request as ready for review July 14, 2023 10:41
tests/test_update_ssh_keys.rs Outdated Show resolved Hide resolved
@dongsupark
Copy link
Member Author

Replaced tempdir with tempfile, as the tempdir crate was deprecated.

@dongsupark
Copy link
Member Author

Replaced users with uzers, as the users crate was deprecated.

Update URLs to CI status, badge, update programming language of
test programs.
Travis CI is not used any more. Delete.
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.

As Rust does not support global variables by default, it is necessary to
make use of lazy_static, so the variables could be accessed in multiple
tests.
@dongsupark
Copy link
Member Author

Thanks.

@dongsupark dongsupark merged commit ad3b888 into flatcar-master Nov 22, 2023
1 check passed
@dongsupark dongsupark deleted the dongsu/rust-tests branch November 22, 2023 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFE] make CI tests of update-ssh-keys work again
2 participants