mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-18 20:15:14 +02:00
refactor(dynamic): add SQS loopback HTTP emulator with real SDK compatibility, extend stub event recording and endpoint rewriting logic across Java and Python
This commit is contained in:
parent
0903231189
commit
433036aead
6 changed files with 765 additions and 39 deletions
|
|
@ -208,6 +208,11 @@ fn message_handler_node_uses_sqs_loopback() {
|
|||
let spec = make_spec(Lang::JavaScript, "jobs", "handler", entry_file("sqs_node"));
|
||||
let h = lang::emit(&spec).expect("emit ok");
|
||||
assert!(h.source.contains("NyxSqsLoopback"));
|
||||
assert!(h.source.contains("_nyxTryRealSqs"));
|
||||
assert!(h.source.contains("@aws-sdk/client-sqs"));
|
||||
assert!(h.source.contains("SendMessageCommand"));
|
||||
assert!(h.source.contains("ReceiveMessageCommand"));
|
||||
assert!(h.source.contains("DeleteMessageCommand"));
|
||||
assert!(h.source.contains("receiveMessage"));
|
||||
assert!(h.source.contains("deleteMessage"));
|
||||
assert!(h.source.contains("'deliver'"));
|
||||
|
|
@ -217,6 +222,46 @@ fn message_handler_node_uses_sqs_loopback() {
|
|||
assert!(h.source.contains("_nyxRecordBrokerPublish"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn message_handler_python_sqs_tries_real_boto3_client_first() {
|
||||
let spec = make_spec_with_adapter(
|
||||
Lang::Python,
|
||||
"jobs",
|
||||
"handler",
|
||||
entry_file("sqs_python"),
|
||||
"sqs-python",
|
||||
);
|
||||
let h = lang::emit(&spec).expect("emit ok");
|
||||
assert!(h.source.contains("_nyx_try_real_sqs"));
|
||||
assert!(h.source.contains("boto3.client(\"sqs\""));
|
||||
assert!(h.source.contains("send_message"));
|
||||
assert!(h.source.contains("receive_message"));
|
||||
assert!(h.source.contains("delete_message"));
|
||||
assert!(h.source.contains("NyxSqsLoopback"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn message_handler_java_sqs_tries_real_aws_sdk_client_first() {
|
||||
let spec = make_spec_with_adapter(
|
||||
Lang::Java,
|
||||
"jobs",
|
||||
"onMessage",
|
||||
entry_file("sqs_java"),
|
||||
"sqs-java",
|
||||
);
|
||||
let h = lang::emit(&spec).expect("emit ok");
|
||||
assert!(h.source.contains("nyxTryRealSqs"));
|
||||
assert!(
|
||||
h.source
|
||||
.contains("software.amazon.awssdk.services.sqs.SqsClient")
|
||||
);
|
||||
assert!(h.source.contains("SendMessageRequest"));
|
||||
assert!(h.source.contains("ReceiveMessageRequest"));
|
||||
assert!(h.source.contains("DeleteMessageRequest"));
|
||||
assert!(h.command.iter().any(|arg| arg == ".:lib/*"));
|
||||
assert!(h.source.contains("NyxSqsLoopback"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn message_handler_go_uses_nyx_handlers_registry() {
|
||||
let spec = make_spec(Lang::Go, "my-sub", "OnMessage", entry_file("pubsub_go"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue