Skip to content

Commit

Permalink
Merge branch '0.6.0-scripting-dev' into configWasmNoErrors
Browse files Browse the repository at this point in the history
  • Loading branch information
tkmcmaster committed Sep 6, 2023
2 parents f87d7af + 2419eb9 commit 1dd35b2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 19 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ jobs:
# replace the version value in Cargo.toml with the tag version (so we don't need to create extraneous commits for every preview version)
cp Cargo.toml Cargo2.toml
sed "0,/^version = \".*\"/s//version = \"$version\"/" Cargo2.toml > Cargo.toml
echo "version = $version"
echo "Cargo $(grep "^version =" Cargo.toml )"
working-directory: ${{env.working-directory}}

- uses: actions-rs/toolchain@v1
Expand Down Expand Up @@ -306,6 +308,8 @@ jobs:
# replace the version value in Cargo.toml with the tag version (so we don't need to create extraneous commits for every preview version)
cp Cargo.toml Cargo2.toml
sed "0,/^version = \".*\"/s//version = \"$version\"/" Cargo2.toml > Cargo.toml
echo "version = $version"
echo "Cargo $(grep "^version =" Cargo.toml )"
working-directory: ${{env.working-directory}}

- uses: actions-rs/toolchain@v1
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ C:\vcpkg> set VCPKGRS_DYNAMIC=1 (or simply set it as your environment variable)
### v0.6.0
Changes:
- Major changes: Javascript scripting!
- Updated config-wasm to parse legacy and scripting yaml files

Bugs:
- Collect returns an array of strings regardless of input type
- auto-converter removes code templates. Leave in and TODO
- for_each doesn't let you do templates/js
- global loggers may not be running in try script

Bug fixes:
Expand Down
38 changes: 20 additions & 18 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ async fn _create_run(
&env_vars,
)
.map_err(Box::new)?;
debug!("config::LoadTest::from_config finished");
debug!("config::LoadTest::from_config finished: {:?}", config);
let test_runner = match exec_config {
ExecConfig::Try(t) => {
create_try_run_future(config, t, test_ended_tx.clone(), stdout, stderr).map(Either::A)
Expand Down Expand Up @@ -884,31 +884,32 @@ fn create_try_run_future(
let request_body_template = if try_config.skip_body_on {
""
} else if matches!(try_config.format, TryRunFormat::Human) {
"\n${if(request.body != '', '${request.body}', '')}\n\n"
"${request.body != '' ? request.body : ''}\n"
} else {
r#""body": "request.body""#
r#","body": "request.body""#
};
let response_body_template = if try_config.skip_body_on {
""
} else if matches!(try_config.format, TryRunFormat::Human) {
"\n${if(response.body != '', '${response.body}', '')}\n\n"
"${response.body != '' ? JSON.stringify(response.body) : ''}\n"
} else {
r#""body": "response.body""#
r#","body": "response.body""#
};
let select = if matches!(try_config.format, TryRunFormat::Human) {
Query::simple(
format!(
r#""`\n\
Request\n\
========================================\n\
${{request['start-line']}}\n\
${{join(request.headers_all, '\n', ': ')}}\n\
{}
Response (RTT: ${{stats.rtt}}ms)\n\
========================================\n\
${{response['start-line']}}\n\
${{join(response.headers_all, '\n', ': ')}}\n\
{}`""#,
r#"`\
Request\n\
========================================\n\
${{request['start-line']}}\n\
${{join(request['headers_all'], '\n', ': ')}}\n\
{}\
Response (RTT: ${{stats.rtt}}ms)\n\
========================================\n\
${{response['start-line']}}\n\
${{join(response.headers_all, '\n', ': ')}}\n\
{}\n`"#,
request_body_template, response_body_template
),
vec![],
Expand All @@ -920,12 +921,12 @@ fn create_try_run_future(
r#"{{
"request": {{
"start-line": "request['start-line']",
"headers": "request.headers_all",
"headers": "request.headers_all"
{}
}},
"response": {{
"start-line": "response['start-line']",
"headers": "response.headers_all",
"headers": "response.headers_all"
{}
}},
"stats": {{
Expand All @@ -937,6 +938,7 @@ fn create_try_run_future(
.as_str(),
)
};
debug!("create_try_run_future select: {:?}", select);
let to = try_config.file.map_or(LogTo::Stdout, |path| {
LogTo::File(Template::new_literal(path))
});
Expand Down

0 comments on commit 1dd35b2

Please sign in to comment.