Skip to content

Commit

Permalink
Merge branch 'fcsonline:master' into pick-for-with-items-range
Browse files Browse the repository at this point in the history
  • Loading branch information
erkannt authored Jul 25, 2023
2 parents 9a11065 + dfd5548 commit 1bd453d
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
steps:
- uses: actions/checkout@master
- name: Compile and release
uses: rust-build/rust-build.action@latest
uses: rust-build/rust-build.action@v1.4.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RUSTTARGET: ${{ matrix.target }}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@

# Example server
example/server/node_modules

# Editor temp files
.vscode
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "drill"
version = "0.8.2"
version = "0.8.3"
authors = ["Ferran Basora <[email protected]>"]
description = "Drill is a HTTP load testing application written in Rust inspired by Ansible syntax"
repository = "https://github.com/fcsonline/drill"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ production environments.
Full list of cli options, which is available under `drill --help`

```
drill 0.8.2
drill 0.8.3
HTTP load testing application written in Rust inspired by Ansible syntax

USAGE:
Expand Down
6 changes: 6 additions & 0 deletions example/server/Dockerfile-example-server
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM node
WORKDIR /app
COPY package.json ./
RUN npm install
COPY . .
CMD node server.js
14 changes: 14 additions & 0 deletions example/server/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: "3.9"
services:
drill-server:
ports:
- "9000:9000"
image: drill-example-server:latest
build:
context: ./
dockerfile: Dockerfile-example-server
#args:
# buildno: 1
environment:
OUTPUT: 0
DELAY_MS: 100
11 changes: 3 additions & 8 deletions src/actions/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,14 +284,9 @@ impl Runnable for Request {
status,
});

if response.cookies().count() > 0 {
let mut cookies = Map::new();

for cookie in response.cookies() {
cookies.insert(cookie.name().to_string(), json!(cookie.value().to_string()));
}

context.insert("cookies".to_string(), json!(cookies));
for cookie in response.cookies() {
let cookies = context.entry("cookies").or_insert_with(|| json!({})).as_object_mut().unwrap();
cookies.insert(cookie.name().to_string(), json!(cookie.value().to_string()));
}

let data = if let Some(ref key) = self.assign {
Expand Down
5 changes: 3 additions & 2 deletions src/interpolator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ static INTERPOLATION_SUFFIX: &str = "}}";

lazy_static! {
pub static ref INTERPOLATION_REGEX: Regex = {
let regexp = format!("{}{}{}", regex::escape(INTERPOLATION_PREFIX), r" *([a-zA-Z]+[a-zA-Z\-\._0-9\[\]]*) *", regex::escape(INTERPOLATION_SUFFIX));
let regexp = format!("{}{}{}", regex::escape(INTERPOLATION_PREFIX), r" *([a-zA-Z]+[a-zA-Z\-\._\$0-9\[\]]*) *", regex::escape(INTERPOLATION_SUFFIX));

Regex::new(regexp.as_str()).unwrap()
};
Expand Down Expand Up @@ -107,7 +107,7 @@ mod tests {
context.insert(String::from("Array"), json!(["a", "b", "c"]));
context.insert(String::from("Object"), json!({"this": "that"}));
context.insert(String::from("Nested"), json!({"this": {"that": {"those": [{"wow": 1}, {"so": 2}, {"deee": {"eeee": "eeep"}}]}}}));
context.insert(String::from("ArrayNested"), json!([{"a": [{}, {"aa": 2, "aaa": [{"aaaa": 123 }]}]}]));
context.insert(String::from("ArrayNested"), json!([{"a": [{}, {"aa": 2, "aaa": [{"aaaa": 123, "$aaaa": "$123"}]}]}]));

let interpolator = Interpolator::new(&context);

Expand All @@ -119,6 +119,7 @@ mod tests {
assert_eq!(interpolator.resolve("{{ Object }}", true), "{\"this\":\"that\"}".to_string());
assert_eq!(interpolator.resolve("{{ Nested.this.that.those[2].deee.eeee }}", true), "eeep".to_string());
assert_eq!(interpolator.resolve("{{ ArrayNested[0].a[1].aaa[0].aaaa }}", true), "123".to_string());
assert_eq!(interpolator.resolve("{{ ArrayNested[0].a[1].aaa[0].$aaaa }}", true), "$123".to_string());
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions src/tags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ pub struct Tags<'a> {

impl<'a> Tags<'a> {
pub fn new(tags_option: Option<&'a str>, skip_tags_option: Option<&'a str>) -> Self {
let tags: Option<HashSet<&str>> = tags_option.map(|m| m.split(',').into_iter().map(|s| s.trim()).collect());
let skip_tags: Option<HashSet<&str>> = skip_tags_option.map(|m| m.split(',').into_iter().map(|s| s.trim()).collect());
let tags: Option<HashSet<&str>> = tags_option.map(|m| m.split(',').map(|s| s.trim()).collect());
let skip_tags: Option<HashSet<&str>> = skip_tags_option.map(|m| m.split(',').map(|s| s.trim()).collect());

if let (Some(t), Some(s)) = (&tags, &skip_tags) {
if !t.is_disjoint(s) {
Expand Down

0 comments on commit 1bd453d

Please sign in to comment.