Skip to content

Commit

Permalink
chore/use_param_transform (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrea authored Nov 4, 2021
1 parent e370d75 commit 764550a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions steps/common/steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,11 @@ func (cs Steps) InitializeSteps(ctx context.Context, scenCtx *godog.ScenarioCont
golium.GetContext(ctx).Put(golium.ValueAsString(ctx, key), ip)
return nil
})
scenCtx.Step(`^I store domain "([^"]*)" ip in context "([^"]*)"$`, func(domain, key string) error {
if domain == "" {
scenCtx.Step(`^I store domain "([^"]*)" ip in context "([^"]*)"$`, func(domainParam, key string) error {
if domainParam == "" {
return nil
}
domain := golium.ValueAsString(ctx, domainParam)
command := fmt.Sprintf("ping -c 1 %s | head -1 | grep -oe '[0-9]*\\.[0-9]*\\.[0-9]*\\.[0-9]'", domain)
cmd := exec.Command("/bin/sh", "-c", command)
stdoutStderr, err := cmd.CombinedOutput()
Expand Down

0 comments on commit 764550a

Please sign in to comment.