Compare commits
10 commits
Author | SHA1 | Date | |
---|---|---|---|
|
43fa1c68f3 | ||
5c7201abe7 | |||
|
4d546ee57c | ||
2df1cfe11f | |||
|
18a253e433 | ||
59fa127967 | |||
2e5c80875e | |||
|
ad173c17ee | ||
|
4206289a10 | ||
a91dcb3a4a |
7 changed files with 104 additions and 42 deletions
|
@ -16,21 +16,23 @@ jobs:
|
|||
release-plz:
|
||||
name: Release-plz
|
||||
runs-on: docker
|
||||
|
||||
container:
|
||||
image:
|
||||
git.kemitix.net/kemitix/rust:v4.0.1
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Run release-plz release-pr
|
||||
uses: https://git.kemitix.net/kemitix/rust@v2.5.0
|
||||
with:
|
||||
args: release-plz release-pr --backend gitea --git-token ${{ secrets.FORGEJO_TOKEN }}
|
||||
env:
|
||||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
||||
- name: Run release-plz release
|
||||
uses: https://git.kemitix.net/kemitix/rust@v2.5.0
|
||||
with:
|
||||
args: release-plz release --backend gitea --git-token ${{ secrets.FORGEJO_TOKEN }}
|
||||
run: release-plz release-pr --backend gitea --git-token ${{ secrets.FORGEJO_TOKEN }}
|
||||
env:
|
||||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
||||
|
||||
- name: Run release-plz release
|
||||
run: release-plz release --backend gitea --git-token ${{ secrets.FORGEJO_TOKEN }}
|
||||
env:
|
||||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
||||
|
|
|
@ -16,6 +16,10 @@ jobs:
|
|||
build:
|
||||
runs-on: docker
|
||||
|
||||
container:
|
||||
image:
|
||||
git.kemitix.net/kemitix/rust:v4.0.1
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
toolchain:
|
||||
|
@ -26,36 +30,27 @@ jobs:
|
|||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Ignored Files
|
||||
run: check-for-ignored
|
||||
|
||||
- name: Check TODOs
|
||||
uses: kemitix/todo-checker@v1.1.0
|
||||
uses: https://git.kemitix.net/kemitix/forgejo-todo-checker@v1.3.0
|
||||
|
||||
- name: Machete
|
||||
uses: https://git.kemitix.net/kemitix/rust@v2.5.0
|
||||
with:
|
||||
args: ${{ matrix.toolchain.name }} cargo machete
|
||||
run: cargo +${{ matrix.toolchain.name }} machete
|
||||
|
||||
- name: Format
|
||||
uses: https://git.kemitix.net/kemitix/rust@v2.5.0
|
||||
with:
|
||||
args: ${{ matrix.toolchain.name }} cargo fmt --all -- --check
|
||||
run: cargo +${{ matrix.toolchain.name }} fmt --all --check
|
||||
|
||||
- name: Clippy
|
||||
uses: https://git.kemitix.net/kemitix/rust@v2.5.0
|
||||
with:
|
||||
args: ${{ matrix.toolchain.name }} cargo hack --feature-powerset clippy
|
||||
run: cargo +${{ matrix.toolchain.name }} hack --feature-powerset clippy
|
||||
|
||||
- name: Build
|
||||
uses: https://git.kemitix.net/kemitix/rust@v2.5.0
|
||||
with:
|
||||
args: ${{ matrix.toolchain.name }} cargo hack --feature-powerset build
|
||||
run: cargo +${{ matrix.toolchain.name }} hack --feature-powerset build
|
||||
|
||||
- name: Test
|
||||
uses: https://git.kemitix.net/kemitix/rust@v2.5.0
|
||||
with:
|
||||
args: ${{ matrix.toolchain.name }} cargo hack --feature-powerset test
|
||||
run: cargo +${{ matrix.toolchain.name }} hack --feature-powerset test
|
||||
|
||||
- name: Mutations
|
||||
uses: https://git.kemitix.net/kemitix/rust@v2.5.0
|
||||
with:
|
||||
args: ${{ matrix.toolchain.name }} cargo mutants -vV --in-place
|
||||
run: cargo +${{ matrix.toolchain.name }} mutants -vV --in-place
|
||||
|
||||
|
|
17
CHANGELOG.md
17
CHANGELOG.md
|
@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## [5.1.0](https://git.kemitix.net/kemitix/kxio/compare/v5.0.0...v5.1.0) - 2025-01-18
|
||||
|
||||
### Added
|
||||
|
||||
- replace openssl with rustls
|
||||
|
||||
### Other
|
||||
|
||||
- *(deps)* update git.kemitix.net/kemitix/rust docker tag to v4
|
||||
- use check-for-ignored
|
||||
- *(deps)* update git.kemitix.net/kemitix/rust docker tag to v3.1.0
|
||||
- check for ignored files being included in repo
|
||||
- upgrade kemitix/rust v3
|
||||
- *(deps)* update https://git.kemitix.net/kemitix/rust action to v2.6.0
|
||||
- *(deps)* update https://git.kemitix.net/kemitix/rust action to v2.5.1
|
||||
- *(net)* add explicit tests for assert_no_unused_plans
|
||||
|
||||
## [5.0.0](https://git.kemitix.net/kemitix/kxio/compare/v4.0.1...v5.0.0) - 2024-12-29
|
||||
|
||||
### Added
|
||||
|
|
20
Cargo.toml
20
Cargo.toml
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "kxio"
|
||||
version = "5.0.0"
|
||||
version = "5.1.0"
|
||||
edition = "2021"
|
||||
authors = ["Paul Campbell <pcampbell@kemitix.net>"]
|
||||
description = "Provides injectable Filesystem and Network resources to make code more testable"
|
||||
|
@ -11,19 +11,16 @@ exclude = [".cargo_home"]
|
|||
[lints.rust]
|
||||
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tarpaulin_include)'] }
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
base64 = "0.22"
|
||||
bytes = "1.8"
|
||||
derive_more = { version = "1.0", features = [
|
||||
"constructor",
|
||||
"display",
|
||||
"from"
|
||||
] }
|
||||
derive_more = { version = "1.0", features = ["constructor", "display", "from"] }
|
||||
http = "1.1"
|
||||
path-clean = "1.0"
|
||||
reqwest = { version = "0.12", features = [ "json" ] }
|
||||
reqwest = { version = "0.12", default-features = false, features = [
|
||||
"json",
|
||||
"rustls-tls",
|
||||
] }
|
||||
url = "2.5"
|
||||
tempfile = "3.10"
|
||||
tokio = { version = "1.41", features = ["sync"] }
|
||||
|
@ -34,10 +31,7 @@ assert2 = "0.3"
|
|||
mutants = "0.0"
|
||||
pretty_assertions = "1.4"
|
||||
test-log = "0.2"
|
||||
tokio = { version = "1.41", features = [
|
||||
"macros",
|
||||
"rt-multi-thread"
|
||||
] }
|
||||
tokio = { version = "1.41", features = ["macros", "rt-multi-thread"] }
|
||||
tokio-test = "0.4"
|
||||
|
||||
[package.metadata.bin]
|
||||
|
|
|
@ -151,6 +151,8 @@ mod tests {
|
|||
|
||||
assert_eq!(contents, "contents");
|
||||
|
||||
net.assert_no_unused_plans();
|
||||
|
||||
// not needed for this test, but should it be needed, we can avoid checking for any
|
||||
// unconsumed request matches.
|
||||
// let mock_net = kxio::net::MockNet::try_from(net).expect("recover mock");
|
||||
|
|
6
justfile
6
justfile
|
@ -10,6 +10,12 @@ build:
|
|||
cargo test --example get
|
||||
cargo mutants --jobs 4
|
||||
|
||||
test-in-docker:
|
||||
docker run --rm -v $PWD:/app/ git.kemitix.net/kemitix/rust:latest cargo test
|
||||
|
||||
shell-in-docker:
|
||||
docker run --rm -it -v $PWD:/app/ git.kemitix.net/kemitix/rust:latest bash
|
||||
|
||||
doc-test:
|
||||
cargo doc
|
||||
cargo test
|
||||
|
|
46
tests/net.rs
46
tests/net.rs
|
@ -53,6 +53,52 @@ async fn test_get_url() {
|
|||
assert_eq!(response.bytes().await.expect("response body"), "Get OK");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_when_all_plans_match_assert_is_ok() {
|
||||
//given
|
||||
let mock_net = kxio::net::mock();
|
||||
|
||||
let url = "https://www.example.com";
|
||||
|
||||
mock_net
|
||||
.on()
|
||||
.get(url)
|
||||
.respond(StatusCode::OK)
|
||||
.body("Get OK")
|
||||
.expect("mock");
|
||||
let net = Net::from(mock_net);
|
||||
|
||||
//when
|
||||
let _response = net.get(url).send().await.expect("response");
|
||||
|
||||
//then
|
||||
net.assert_no_unused_plans();
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[should_panic]
|
||||
async fn test_when_not_all_plans_match_assert_fails() {
|
||||
//given
|
||||
let mock_net = kxio::net::mock();
|
||||
|
||||
let url = "https://www.example.com";
|
||||
|
||||
mock_net
|
||||
.on()
|
||||
.get(url)
|
||||
.respond(StatusCode::OK)
|
||||
.body("Get OK")
|
||||
.expect("mock");
|
||||
let net = Net::from(mock_net);
|
||||
|
||||
//when
|
||||
// request is not made
|
||||
// let _response = net.get(url).send().await.expect("response");
|
||||
|
||||
//then
|
||||
net.assert_no_unused_plans();
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_post_url() {
|
||||
//given
|
||||
|
|
Loading…
Add table
Reference in a new issue