Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ go run examples/server_endpoint/test_server.go 3000
Add delays between commands for stability after the endpoint from a previous command is up: ⏱️

````bash
```bash docci-output-contains="GOOD" docci-wait-for-endpoint=http://localhost:3000/health|30
```bash docci-output-contains="GOOD" docci-wait-for-endpoint=http://localhost:3000/health|5
VALUE=$(curl http://localhost:3000/health)
echo "Got value: $VALUE"
```
Expand Down
2 changes: 1 addition & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ tasks:
cmds:
- mkdir -p $GOPATH/bin
- task build
- cp out/docci $GOPATH/bin/docci
- cp out/docci `go env GOPATH`/bin/docci
generates:
- out/docci

Expand Down
10 changes: 2 additions & 8 deletions docci.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,7 @@ func RunDocciFileWithOptions(filePath string, opts types.DocciOpts) DocciResult

// Build executable script with validation markers
log.Debug("Building executable script")
script, validationMap, assertFailureMap := parser.BuildExecutableScriptWithOptions(blocks, types.DocciOpts{
HideBackgroundLogs: hideBackgroundLogs,
KeepRunning: keepRunning,
})
script, validationMap, assertFailureMap := parser.BuildExecutableScriptWithOptions(blocks, opts)

// Execute the script
log.Debug("Executing script")
Expand Down Expand Up @@ -222,10 +219,7 @@ func RunDocciFilesWithOptions(filePaths []string, opts types.DocciOpts) DocciRes

// Build executable script with validation markers
log.Debug("Building executable script from merged blocks")
script, validationMap, assertFailureMap := parser.BuildExecutableScriptWithOptions(allBlocks, types.DocciOpts{
HideBackgroundLogs: hideBackgroundLogs,
KeepRunning: keepRunning,
})
script, validationMap, assertFailureMap := parser.BuildExecutableScriptWithOptions(allBlocks, opts)

// Execute the script
log.Debug("Executing merged script")
Expand Down
6 changes: 3 additions & 3 deletions parser/script_templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ fi

// Background block template
backgroundBlockTemplate = `# Background block {{INDEX}}{{FILE_INFO}}
setsid bash -c '{
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this did not work on macos

{{CONTENT}}}' > /tmp/docci_bg_{{INDEX}}.out 2>&1 &
(
{{CONTENT}}) > /tmp/docci_bg_{{INDEX}}.out 2>&1 &
DOCCI_BG_PID_{{INDEX}}=$!
echo 'Started background process {{INDEX}} with PID '$DOCCI_BG_PID_{{INDEX}}

Expand Down Expand Up @@ -64,7 +64,7 @@ while true; do
exit 1
fi

if curl -s -f --max-time 5 "$endpoint_url" > /dev/null 2>&1; then
if wget -q --timeout=5 --tries=1 --spider "$endpoint_url" > /dev/null 2>&1; then
echo "Endpoint $endpoint_url is ready"
break
fi
Expand Down