8000 GitHub - ryan-chae/xk6-ssh: Client extension for interacting with a host over SSH as part of your k6 test.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
forked from grafana/xk6-ssh

Client extension for interacting with a host over SSH as part of your k6 test.

License

Notifications You must be signed in to change notification settings

ryan-chae/xk6-ssh

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚠️ This is a proof of concept

As this is a proof of concept, it won't be supported by the k6 team. It may also break in the future as xk6 evolves. USE AT YOUR OWN RISK! Any issues with the tool should be raised here.



xk6-ssh

A k6 extension for using of SSH in testing. Built for k6 using xk6.

Build

To build a k6 binary with this extension, first ensure you have the prerequisites:

Then:

  1. Download xk6:
$ go install github.com/k6io/xk6/cmd/xk6@latest
  1. Build the binary:
$ xk6 build --with github.com/k6io/xk6-ssh@latest

Example

import ssh from 'k6/x/ssh';

export default function () {
  ssh.connect({
    username: 'USERNAME',
	  host: "HOST_ADDRESS",
	  port: 22
  })
  console.log(ssh.run('pwd'))
}

Result output:

$ ./k6 run script.js

          /\      |‾‾| /‾‾/   /‾‾/   
     /\  /  \     |  |/  /   /  /    
    /  \/    \    |     (   /   ‾‾\  
   /          \   |  |\  \ |  (‾)  | 
  / __________ \  |__| \__\ \_____/ .io

  execution: local
     script: ../xk6-ssh/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[0001] /home/userfolder                                 source=console

running (00m01.4s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [======================================] 1 VUs  00m01.4s/10m0s  1/1 iters, 1 per VU

     data_received........: 0 B 0 B/s
     data_sent............: 0 B 0 B/s
     iteration_duration...: avg=1.41s min=1.41s med=1.41s max=1.41s p(90)=1.41s p(95)=1.41s
     iterations...........: 1   0.706079/s
     vus..................: 1   min=1 max=1
     vus_max..............: 1   min=1 max=1

Inspect examples folder for more details.

FAQ

How to start sudo commands?

Basically we don't provide sudo password autofill. We suggest to use /etc/sudoers for this purpose. Please checkout this article for more details.

About

Client extension for interacting with a host over SSH as part of your k6 test.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%
0