diff --git a/operator_test.go b/operator_test.go index 68a4bd00..7f06b228 100644 --- a/operator_test.go +++ b/operator_test.go @@ -285,13 +285,13 @@ func TestLoad(t *testing.T) { {"testdata/book/**/*", "nonexistent", "", "", 0}, {"testdata/book/**/*", "", "eb33c9aed04a7f1e03c1a1246b5d7bdaefd903d3", "", 1}, {"testdata/book/**/*", "", "eb33c9a", "", 1}, - {"testdata/book/**/*", "", "", "http", 15}, + {"testdata/book/**/*", "", "", "http", 16}, {"testdata/book/**/*", "", "", "openapi3", 9}, - {"testdata/book/**/*", "", "", "http,openapi3", 15}, + {"testdata/book/**/*", "", "", "http,openapi3", 16}, {"testdata/book/**/*", "", "", "http and openapi3", 9}, {"testdata/book/**/*", "", "", "http and nothing", 0}, - {"testdata/book/**/*", "", "", "http or nothing", 15}, - {"testdata/book/**/*", "", "", "http and not openapi3", 6}, + {"testdata/book/**/*", "", "", "http or nothing", 16}, + {"testdata/book/**/*", "", "", "http and not openapi3", 7}, {"testdata/book/needs_3.yml", "", "", "", 1}, // Runbooks that are only in the needs section are not counted at Load } @@ -699,8 +699,8 @@ func TestSkipIncluded(t *testing.T) { RUNN_LABEL string want int }{ - {"testdata/book/include_*", false, "", "", 5}, - {"testdata/book/include_*", true, "", "", 2}, + {"testdata/book/include_*", false, "", "", 6}, + {"testdata/book/include_*", true, "", "", 3}, {"testdata/book/include_*", true, "include_a.yml", "", 1}, {"testdata/book/include_*", true, "", "label_include_a", 1}, } diff --git a/testdata/book/include_http.yml b/testdata/book/include_http.yml new file mode 100644 index 00000000..d1cae012 --- /dev/null +++ b/testdata/book/include_http.yml @@ -0,0 +1,30 @@ +desc: For include http test +labels: + - http +runners: + req: + endpoint: ${HTTPBIN_END_POINT:-https://httpbin.org/} +vars: + parameter: null +if: included +steps: + get: + desc: get + req: + /get?parameter={{ vars.parameter }}: + get: + body: null + test: | + steps.get.res.status == 200 + && steps.get.res.body.args.parameter == string(vars.parameter) + post: + desc: post + req: + /post: + post: + body: + application/json: + parameter: '{{ steps.get.res.body.args.parameter }}' + test: | + steps.post.res.status == 200 + && fromJSON(steps.post.res.body.data).parameter == steps.get.res.body.args.parameter diff --git a/testdata/book/loop_and_include.yml b/testdata/book/loop_and_include.yml new file mode 100644 index 00000000..c3fd7acc --- /dev/null +++ b/testdata/book/loop_and_include.yml @@ -0,0 +1,16 @@ +desc: For loop & include test +vars: + patterns: + - 1 + - 2 + - 3 + - 4 +steps: + loop: + desc: loop + loop: + count: len(vars.patterns) + include: + path: ./include_http.yml + vars: + parameter: '{{ vars.patterns[i] }}'