szkiba / xk6-mock

A k6 extension for mocking HTTP(S) servers during test development.
http://ivan.szkiba.hu/xk6-mock/
MIT License
14 stars 5 forks source link

Can't build extension with the xk6-out-influxdb extension #3

Closed jsclifford closed 1 year ago

jsclifford commented 2 years ago

Getting error every time when building xk6-mock with https://github.com/grafana/xk6-output-influxdb. Wondering if this can be adjusted to work together as I am trying to upgrade to influxdb-v2 and have mocking as well.

Command: xk6 build v0.38.3 --with github.com/grafana/xk6-output-influxdb@latest --with github.com/szkiba/xk6-mock@latest

# github.com/szkiba/xk6-mock
/home/jocliff/.gvm/pkgsets/go1.18.3/global/pkg/mod/github.com/szkiba/xk6-mock@v0.1.2/http.go:13:8: undefined: http.GlobalHTTP
/home/jocliff/.gvm/pkgsets/go1.18.3/global/pkg/mod/github.com/szkiba/xk6-mock@v0.1.2/http.go:25:8: undefined: http.HTTP
/home/jocliff/.gvm/pkgsets/go1.18.3/global/pkg/mod/github.com/szkiba/xk6-mock@v0.1.2/http.go:29:15: undefined: common.GetRuntime
/home/jocliff/.gvm/pkgsets/go1.18.3/global/pkg/mod/github.com/szkiba/xk6-mock@v0.1.2/http.go:36:20: undefined: http.ToURL
/home/jocliff/.gvm/pkgsets/go1.18.3/global/pkg/mod/github.com/szkiba/xk6-mock@v0.1.2/http.go:62:29: undefined: http.HTTP_METHOD_GET
/home/jocliff/.gvm/pkgsets/go1.18.3/global/pkg/mod/github.com/szkiba/xk6-mock@v0.1.2/http.go:68:29: undefined: http.HTTP_METHOD_HEAD
/home/jocliff/.gvm/pkgsets/go1.18.3/global/pkg/mod/github.com/szkiba/xk6-mock@v0.1.2/http.go:72:29: undefined: http.HTTP_METHOD_POST
/home/jocliff/.gvm/pkgsets/go1.18.3/global/pkg/mod/github.com/szkiba/xk6-mock@v0.1.2/http.go:76:29: undefined: http.HTTP_METHOD_PUT
/home/jocliff/.gvm/pkgsets/go1.18.3/global/pkg/mod/github.com/szkiba/xk6-mock@v0.1.2/http.go:80:29: undefined: http.HTTP_METHOD_PATCH
/home/jocliff/.gvm/pkgsets/go1.18.3/global/pkg/mod/github.com/szkiba/xk6-mock@v0.1.2/http.go:84:29: undefined: http.HTTP_METHOD_DELETE
/home/jocliff/.gvm/pkgsets/go1.18.3/global/pkg/mod/github.com/szkiba/xk6-mock@v0.1.2/http.go:84:29: too many errors
2022/06/06 13:40:12 [INFO] Cleaning up temporary folder: /tmp/buildenv_2022-06-06-1339.1643346115
2022/06/06 13:40:12 [FATAL] exit status 2

Go Version: 1.17.11 xk6 Version: latest OS: WSL2 on Windows 10

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.4 LTS
Release:        20.04
Codename:       focal
AntonParaskiv commented 1 year ago

it doesn't build with k6 version >= v0.33.0 even with only one xk6-mock

Command: xk6 build v0.33.0 --with github.com/szkiba/xk6-mock

2022/10/04 19:12:48 [INFO] Temporary folder: /Users/antonparaskiv/GolandProjects/shipment-ext/buildenv_2022-10-04-1912.4138967645
2022/10/04 19:12:48 [INFO] Initializing Go module
2022/10/04 19:12:48 [INFO] exec (timeout=10s): /Users/antonparaskiv/sdk/go1.17.13/bin/go mod init k6 
go: creating new go.mod: module k6
2022/10/04 19:12:48 [INFO] Pinning versions
2022/10/04 19:12:48 [INFO] exec (timeout=0s): /Users/antonparaskiv/sdk/go1.17.13/bin/go mod edit -require github.com/szkiba/xk6-mock@latest 
2022/10/04 19:12:48 [INFO] exec (timeout=0s): /Users/antonparaskiv/sdk/go1.17.13/bin/go mod tidy -compat=1.17 
2022/10/04 19:12:48 [INFO] exec (timeout=0s): /Users/antonparaskiv/sdk/go1.17.13/bin/go mod tidy -compat=1.17 
2022/10/04 19:12:48 [INFO] Writing main module: /Users/antonparaskiv/GolandProjects/shipment-ext/buildenv_2022-10-04-1912.4138967645/main.go
2022/10/04 19:12:48 [INFO] exec (timeout=0s): /Users/antonparaskiv/sdk/go1.17.13/bin/go mod edit -require go.k6.io/k6@v0.33.0 
2022/10/04 19:12:48 [INFO] exec (timeout=0s): /Users/antonparaskiv/sdk/go1.17.13/bin/go mod tidy -compat=1.17 
2022/10/04 19:12:48 [INFO] exec (timeout=0s): /Users/antonparaskiv/sdk/go1.17.13/bin/go mod tidy -compat=1.17 
2022/10/04 19:12:49 [INFO] Build environment ready
2022/10/04 19:12:49 [INFO] Building k6
2022/10/04 19:12:49 [INFO] exec (timeout=0s): /Users/antonparaskiv/sdk/go1.17.13/bin/go mod tidy -compat=1.17 
2022/10/04 19:12:49 [INFO] exec (timeout=0s): /Users/antonparaskiv/sdk/go1.17.13/bin/go build -o /Users/antonparaskiv/GolandProjects/shipment-ext/k6 -ldflags -w -s -trimpath 
# github.com/szkiba/xk6-mock
../../../go/pkg/mod/github.com/szkiba/xk6-mock@v0.1.2/http.go:36:15: undefined: "go.k6.io/k6/js/modules/k6/http".ToURL
../../../go/pkg/mod/github.com/szkiba/xk6-mock@v0.1.2/http.go:41:10: cannot assign error to err in multiple assignment
../../../go/pkg/mod/github.com/szkiba/xk6-mock@v0.1.2/http.go:51:12: cannot assign httpext.URL to orig in multiple assignment
../../../go/pkg/mod/github.com/szkiba/xk6-mock@v0.1.2/http.go:51:12: cannot assign error to err in multiple assignment
2022/10/04 19:12:49 [INFO] Cleaning up temporary folder: /Users/antonparaskiv/GolandProjects/shipment-ext/buildenv_2022-10-04-1912.4138967645
2022/10/04 19:12:49 [FATAL] exit status 2

but it's ok for k6 version v0.32.0 xk6 build v0.32.0 --with github.com/szkiba/xk6-mock

other extensions may require newer version of k6

szkiba commented 1 year ago

Thank you for feedback. It's fixed now, version v0.2.0 (the minimum k6 version is v0.43.0)

szkiba commented 1 year ago

fixed in v0.2.0