generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 224
Open
Description
I'm trying to use aws_smithy_mocks::mock::then_compute_output like so:
use aws_sdk_mediapackagev2::Client;
...
use aws_smithy_mocks::{mock as smithy_mock, mock_client as smithy_mock_client};
...
let list_channels_rule = smithy_mock!(Client::list_channels).then_compute_output(|req| {
ListChannelsOutput::builder()
.set_items(Some(
(0..5)
.map(|i| {
ChannelListConfiguration::builder()
.arn(format!("some-arn-{i}"))
.channel_name(format!("some-channel-{i}"))
.set_channel_group_name(req.channel_group_name.clone())
.created_at(SystemTime::now().into())
.modified_at(SystemTime::now().into())
.build()
.unwrap()
})
.collect(),
))
.build()
});
...but I get the following error: must_match was enabled but no rules matched or all rules were exhausted for Input(TypeErasedBox[!Clone]:ListChannelsInput { channel_group_name: Some("some-group-1"), max_results: None, next_token: None })
From my understanding of the docs, the two tests in my minimal reproduction repo should react the same? but one is and another isn't. Can you help me understand why these are reacting differently? Shouldn't aws_smithy_mocks::mock::then_compute_output be matching on all requests?
I've made a minimal reproducible repo here: https://github.com/giantcow/minimal-repo-then_compute_output-issue/
$ cargo test
Finished `test` profile [unoptimized + debuginfo] target(s) in 0.16s
Running unittests src/lib.rs (target/debug/deps/minimal_repo_then_compute_output_issue-06a00f2473274d11)
running 2 tests
test tests::does_NOT_work_as_expected ... FAILED
test tests::does_work_as_expected ... ok
failures:
---- tests::does_NOT_work_as_expected stdout ----
thread 'tests::does_NOT_work_as_expected' (58528) panicked at /home/cayman/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-smithy-mocks-0.2.1/src/interceptor.rs:176:21:
must_match was enabled but no rules matched or all rules were exhausted for Input(TypeErasedBox[!Clone]:ListChannelsInput { channel_group_name: Some("some-group-1"), max_results: None, next_token: None })
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
tests::does_NOT_work_as_expected
test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
error: test failed, to rerun pass `--lib`
Metadata
Metadata
Assignees
Labels
No labels