Skip to content

Commit

Permalink
Add nofail
Browse files Browse the repository at this point in the history
  • Loading branch information
federicotdn committed Jan 31, 2025
1 parent c99f444 commit 9341848
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ Sometimes it's hard to predict how a SUT might fail. For those cases, [describe]

{{< code >}}

<!-- md-k6:nofail -->

```javascript
import { describe, expect } from 'https://jslib.k6.io/k6chaijs/4.3.4.3/index.js';

Expand Down
15 changes: 11 additions & 4 deletions scripts/md-k6.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import tempfile
from collections import namedtuple

Script = namedtuple("Script", ["text", "options", "env"])
Script = namedtuple("Script", ["text", "options", "env", "text_hash"])

SKIP = "skip"
SKIP_ALL = "skipall"
Expand Down Expand Up @@ -203,7 +203,15 @@ def main() -> None:
key, value = opt.removeprefix(ENV).split("=")
env[key] = value

scripts.append(Script(text="\n".join(lines[1:]), options=options, env=env))
script_text = "\n".join(lines[1:])
scripts.append(
Script(
text=script_text,
options=options,
env=env,
text_hash=hashlib.sha256(script_text.encode("utf-8")).hexdigest()[:16],
)
)

if ":" in args.blocks:
range_parts = args.blocks.split(":")
Expand Down Expand Up @@ -232,9 +240,8 @@ def main() -> None:
print("Number of code blocks (scripts) to run:", to_run)

for i, script in enumerate(scripts[start:end]):
script_hash = hashlib.sha256(script.text.encode("utf-8")).hexdigest()[:16]
print(
f"Running script #{i + 1} (of {to_run}) (hash: {script_hash}, options: {script.options}):\n"
f"Running script #{i + 1} (of {to_run}) (hash: {script.text_hash}, options: {script.options}):\n"
)
print_code(script)
run_k6(script, args.duration, args.verbose)
Expand Down

0 comments on commit 9341848

Please sign in to comment.