mirror of
https://github.com/mentos1386/zdravko.git
synced 2024-11-22 15:53:45 +00:00
36 lines
518 B
Go
36 lines
518 B
Go
package k6
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"go.k6.io/k6/cmd/state"
|
|
)
|
|
|
|
func TestK6(t *testing.T) {
|
|
ctx := context.Background()
|
|
|
|
state := state.NewGlobalState(ctx)
|
|
|
|
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);
|
|
}
|
|
`
|
|
|
|
execution := NewExecution(state, script)
|
|
|
|
err := execution.Start(ctx)
|
|
if err != nil {
|
|
t.Errorf("Error starting execution: %v", err)
|
|
}
|
|
}
|