grafana / xk6-sql

Use SQL databases from k6 tests.
http://sql.x.k6.io
Apache License 2.0
114 stars 57 forks source link

k6/x/sql still unknown after creating binary: GoError: unknown module: k6/x/sql #65

Closed IamKoN closed 6 months ago

IamKoN commented 6 months ago

k6 script, vendor.js:

import http from "k6/http";
import { check, sleep } from "k6";
import jsonpath from "https://jslib.k6.io/jsonpath/1.0.2/index.js"; 
import sql from 'k6/x/sql';

project directory: image

cmds used to build xk6-sql binary:

xk6 build --with github.com/grafana/xk6-sql
xk6 build master --with github.com/grafana/xk6-sql

both work to create the binary in the working dir, but when running k6 run vendor.js I get the same error each time:

ERRO[0000] GoError: unknown module: k6/x/sql
at go.k6.io/k6/js.(*requireImpl).require-fm (native)
at file:///C:/repos/.../app/k6_test/vendor.js:4:0(44)  hint="script exception"
kempsterc commented 6 months ago

Try

./k6 run vendor.js

If you run ./k6 version What do you get?

IamKoN commented 6 months ago

Try

./k6 run vendor.js

If you run ./k6 version What do you get?

k6.exe v0.50.0 (go1.22.2, windows/amd64) Extensions: github.com/grafana/xk6-sql v0.4.0, k6/x/sql [js]

./k6 run vendor.js worked, thank you! Not sure why that made the difference, but much appreciated.

kempsterc commented 6 months ago

Try ./k6 run vendor.js If you run ./k6 version What do you get?

k6.exe v0.50.0 (go1.22.2, windows/amd64) Extensions: github.com/grafana/xk6-sql v0.4.0, k6/x/sql [js]

./k6 run vendor.js worked, thank you! Not sure why that made the difference, but much appreciated.

When you build k6 with extensions, it creates a new binary. So you'd execute it that why. If you check the log out put of when it was created, there is a message there explaining :)