Closed jokuniew closed 1 week ago
I noticed that too, and would like to know the answer. For the time being, I'm able to build by pointing to the specific commit, in case it helps:
xk6 build --with github.com/grafana/xk6-exec@d9fdfce4ac85e6f0c42100794b0e51047f5dd0f6
@jokuniew @vvakar I can't reproduce the error you mention.
The example is working as expected. The command executed with the continue_on_error
option does not abort the test, but the last one, which does not use this option, aborts it.
$ k6 version
k6 v0.51.0 (go1.22.4, linux/amd64)
Extensions:
github.com/grafana/xk6-exec v0.4.0, k6/x/exec [js]
$k6 run examples/script.js
....
INFO[0000] lun 02 sep 2024 20:03:26 CEST source=console
INFO[0000] ERROR: GoError: exit status 2 source=console
INFO[0000] STDERR: ls: cannot access 'NO_SUCH_DIR': No such file or directory source=console
INFO[0000] 2024/09/02 20:03:26 chdir sub-directory: no such file or directory on command: ls -a -l
@pablochacin It's very curious. I pasted the full terminal log below showing that the 0.4.0 version is somehow missing the fix, but the specific commit has it:
$ xk6 build --with github.com/grafana/xk6-exec
...
cmdradmin@cmdr-testing:~/xk6-exec$ ./k6 version
k6 v0.51.0 (go1.22.4, linux/amd64)
Extensions:
github.com/grafana/xk6-exec v0.4.0, k6/x/exec [js]
cmdradmin@cmdr-testing:~/xk6-exec$ ./k6 run examples/script.js
/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .io
execution: local
script: examples/script.js
output: -
scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
* default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)
INFO[0000] Tue Sep 3 09:14:17 UTC 2024 source=console
INFO[0000] 2024/09/03 09:14:17 exit status 2 on command: ls -a NO_SUCH_DIR
-----------------------------------------------------------------------------------
cmdradmin@cmdr-testing:~/xk6-exec$ xk6 build --with github.com/grafana/xk6-exec@d9fdfce4ac85e6f0c42100794b0e51047f5dd0f6
...
cmdradmin@cmdr-testing:~/xk6-exec$ ./k6 version
k6 v0.51.0 (go1.22.4, linux/amd64)
Extensions:
github.com/grafana/xk6-exec v0.3.1-0.20240709114410-d9fdfce4ac85, k6/x/exec [js]
cmdradmin@cmdr-testing:~/xk6-exec$ ./k6 run examples/script.js
/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .io
execution: local
script: examples/script.js
output: -
scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
* default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)
INFO[0000] Tue Sep 3 09:14:50 UTC 2024 source=console
INFO[0000] ERROR: GoError: exit status 2 source=console
INFO[0000] STDERR: ls: cannot access 'NO_SUCH_DIR': No such file or directory source=console
INFO[0000] 2024/09/03 09:14:50 chdir sub-directory: no such file or directory on command: ls -a -l
To avoid any golang/binary misconfiguration I've tried to use xk6 through docker image with v0.51.0
k6 just like @pablochacin has and still the same behavior occurs
docker run --rm -it -u "$(id -u):$(id -g)" -v "${PWD}:/xk6" grafana/xk6 build v0.51.0 --with github.com/grafana/xk6-exec@v0.4.0
./k6 version
k6 v0.51.0 (go1.22.4, linux/amd64)
Extensions:
github.com/grafana/xk6-exec v0.4.0, k6/x/exec [js]
./k6 run examples/script.js
/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .io
execution: local
script: examples/script.js
output: -
scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
* default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)
INFO[0000] Tue Sep 3 09:08:04 AM UTC 2024 source=console
INFO[0000] 2024/09/03 09:08:04 exit status 2 on command: ls -a NO_SUCH_DIR
@vvakar @jokuniew Apparently, v0.4.0
was corrupted in the goland proxy cache. I released v0.4.1
which introduces no changes, but generates a new entry in the proxy's cache. Thos should fix the use.
v0.4.1 works, thanks!! :)
Fixed in release v0.4.1
I can also confirm that v0.4.1 works fine. Thanks @pablochacin ! ;)
I've built and installed k6 with latest xk6-exec
then run
k6 run examples/script.js
the example introduced in #24the output i get
I expected to see logs like "ERROR: " or "STDERR: " in this example but actually my test panic and stopped.
I can't handle exec.command errors in try catch statement
@pablochacin @vvakar