zdravko/pkg/k6/k6_test.go

35 lines
494 B
Go
Raw Normal View History

package k6
import (
"context"
2024-02-21 13:09:22 +00:00
"log/slog"
"testing"
)
func TestK6(t *testing.T) {
ctx := context.Background()
2024-02-21 13:09:22 +00:00
logger := slog.Default()
script := `
import http from 'k6/http';
import { sleep } from 'k6';
export const options = {
vus: 10,
duration: '30s',
};
export default function () {
http.get('https://test.k6.io');
sleep(1);
}
`
2024-02-21 13:09:22 +00:00
execution := NewExecution(logger, script)
err := execution.Start(ctx)
if err != nil {
t.Errorf("Error starting execution: %v", err)
}
}