Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

K6 module #1721

Merged
merged 18 commits into from
Oct 9, 2023
Merged
12 changes: 11 additions & 1 deletion modules/k6/examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package k6_test

import (
"context"
"fmt"
"path/filepath"

"github.com/testcontainers/testcontainers-go/modules/k6"
Expand All @@ -11,7 +12,7 @@ func ExampleRunContainer() {
// runK6Container {
ctx := context.Background()

absPath, err := filepath.Abs("./scripts/test.js")
absPath, err := filepath.Abs("./scripts/pass.js")
if err != nil {
panic(err)
}
Expand All @@ -26,5 +27,14 @@ func ExampleRunContainer() {
panic(err)
}
}()

// assert the result of the test
state, err := container.State(ctx)
if err != nil {
panic(err)
}
if state.ExitCode != 0 {
mdelapenya marked this conversation as resolved.
Show resolved Hide resolved
panic(fmt.Errorf("test failed with exit code %d", state.ExitCode))
}
// }
}