Giter VIP home page Giter VIP logo

loadimpact-cli's Introduction

Load Impact CLI Build Status Coverage Status

This is the Command line interface for Load Impact API version 3 and Load Impact Version 3.0 (Lua based scripting). If you are looking for the CLI for version 4.0, please refer to the k6 github repo.

The CLI can perform the following operations:

  • user scenarios: listing, creating, retrieving, validating, updating, deleting
  • data stores: listing, downloading, creating
  • tests: listing, running
  • metrics: list
  • For all other use cases, reference the REST API at http://developer.loadimpact.com/api/index.html

Install

PyPI PyPI

As a general recommendation, install loadimpact-cli in a virtualenv and make sure you use a recently upgraded pip install. See issue #13 for some ideas if you are having trouble installing.

Install using setup.py

cd loadimpact-cli
python setup.py install

Install using pip

pip install loadimpact-cli

Configuration

Before running the CLI you need to add your Load Impact V3 API token to the config file. You can generate a Load Impact V3 API token selecting CLI from the integrations page.

The config file will be placed:

For MacOSX:

/Users/<YOUR_USER_NAME>/Library/Application Support/LoadImpact/config.ini

For Linux:

~/.config/LoadImpact/config.ini

For Windows:

\AppData\LoadImpact\config.ini

The config file should look like this:

[user_settings]
api_token=your_api_token

You can also specify the default project you want to work with here by adding the id of the project you wish to work with:

[user_settings]
api_token=your_api_token
default_project=2

Optionally, if you don't want to edit the config-file you can set default project and api key as environment variables instead:

export LOADIMPACT_API_V3_TOKEN='your_api_token'
export LOADIMPACT_DEFAULT_PROJECT=1

Running the cli

$ loadimpact
Usage: loadimpact [OPTIONS] COMMAND [ARGS]...

Options:
  --version  Show the version and exit.
  --help     Show this message and exit.

Commands:
  data-store
  metric
  organization
  test
  user-scenario

Working with organizations and projects

Listing organizations

$ loadimpact organization list

Listing the projects of an organization

Listing the projects of an organization with id 1. This will help you find the project you want to use as default project.

$ loadimpact organization projects 1

Working with User Scenarios scripts

A User Scenario is a object that contains a script that defines your user behavior. This script should be written in Lua.

Listing the User scenarios in a project.

In order to list the User scenarios in a project you need to specify a project id. Either you add this to the config or export them as an environment variable as mentioned above.

$ loadimpact user-scenario list

Or you can add it using the project_id-flag.

$ loadimpact user-scenario list --project_id=1

Listing the user-scenarios prints the scripts of the user-scenarios of the specified projects.

Creating a new User Scenario

In order to create a new User Scenario you need to have specified the project you want the User scenario to belong to in some of the ways mentioned under "Listing the User scenarios in a project."

You also need to specify the path to the script file you want to create the User scenario with.

$ loadimpact user-scenario create /path/to/script.lua 'script name' --project_id=1


You can also add a Data store to your user-scenario, either by using the id of an existing one:

$ loadimpact data-store list
ID: NAME:
43  Load Impact Basic
23  Fake Customers
$ loadimpact user-scenario create /path/to/script.lua 'script name' --project_id=1 --datastore_id=43


Or you can add a new Data store file using --datastore_file, this will create a new Data store in the project and add it to the User scenario.

$ loadimpact user-scenario create /path/to/script.lua 'script name' --project_id=1 --datastore_file=/path/to/datastore.csv

Getting a User Scenario.

To get a User scenario script you'll need the id of that user scenario.

$ loadimpact user-scenario get 1

Updating a User Scenario

To update the script of a User scenario you need to specify the id of the scenario you wan't to update and the script you want to upload for it.

$ loadimpact user-scenario update 1 /path/to/script.lua

Validating a User Scenario

In order to be able to use a script it has to be valid, you can check if a script is valid by using the command validate. This will validate your script row by row. Please note that this command can takes some time to finish as we actually fire the script up and send some requests.

$ loadimpact user-scenario validate 1

Deleting a User Scenario

You can delete a User Scenario with the delete command. This will delete the entire User Scenario, not just remove the script. Since this is a destructive action you'll need to verify it.

$ loadimpact user-scenario delete 1

If you need to bypass the verifying you can add the --yes flag.

$ loadimpact user-scenario delete 1 --yes

Working with Data stores

A Data store contains a .csv-file where you define values you want to use in your test. A Data store can be reused in many tests, making test-setups easier. For example a Data store .csv-file can contain URL:s for a test.

Listing Data stores

The data-store list command lists the Data stores in the project.

$ loadimpact data-store list

Downloading a Data store

The data-store download command will download the .csv-file of the specified Data store. If the --file_name-flag is omitted the file will be saved in the current directory as DATA-STORE-ID.csv

$ loadimpact data-store download 1 --file_name /path/where/you/want/file.csv

Creating a Data store

The data-store create command will create a new Data store containing the file specified.

$ loadimpact data-store create  'Your Data store name' /path/to/file.csv

Updating a Data store

The data-store update command will update the file of the specified Data store.

$ loadimpact data-store update 1 /path/to/file.csv

Deleting a Data store

The data-store delete command will delete an existing Data store. Since this is a destructive action you'll need to verify it.

$ loadimpact data-store delete 1

If you need to bypass the verifying you can add the --yes flag.

$ loadimpact data-store delete 1 --yes

Working with Tests

Listing Tests

The test list command lists the Tests you have access to:

$ loadimpact test list

ID: NAME:           LAST RUN DATE:        LAST RUN STATUS:    CONFIG:
123 My test name    2017-01-02 03:04:05   Finished            50 users 2s
456 My second test  2017-02-03 12:34:56   Aborted by user     10 users 5s; 100 users 60s

By default, it will display the first 20 Tests, ordered by their last run date, from all the Projects from all the Organizations you have access to. This can be narrowed down by the --project_id and the --limit flags. For example, the following command:

$ loadimpact test list --project_id 100 --project_id 200 --limit 5

Will display the five most recent Tests from projects 100 and 200.

The output truncates the values of several columns (Name and Config) for the purposes of readability. This can be overriden by the --full-width argument, which will cause the information to be displayed fully and separated by tab characters (\t).

Running Tests

The test run command launches a Test Run from an existing Test:

$ loadimpact test run 123

The command will periodically print the metrics collected during the test run (defaulting to VUs, requests/second, bandwidth, VU load time and failure rate) until the test run is finished:

$ loadimpact test run 123

TEST_RUN_ID:
456

'Initializing test ...'
TIMESTAMP:           VUs [1]: reqs/s [1]: bandwidth [1]: user load time [1]: failure rate [1]:
2017-01-02 03:04:00  5.0      6.626671    89340.2656     -                   -
2017-01-02 03:04:03  8.0      3.956092    53336.0410     -                   -
2017-01-02 03:04:06  10.0     2.644981    35659.6385     -                   -
2017-01-02 03:04:09  15.0     3.970042    53524.1070     -                   -
2017-01-02 03:04:12  17.0     2.646911    35685.6541     -                   -
2017-01-02 03:04:15  20.0     3.969141    53511.9623     -                   -
2017-01-02 03:04:18  22.0     6.613472    89162.8336     235.73              -
2017-01-02 03:04:21  25.0     5.289569    71313.9719     234.3               -
...

This output can be disabled by the --quiet flag. The metrics displayed can also be selected using the --metric flag (in the case of default metrics) or the --raw_metric flag (that allows the passing of parameters for the metrics as defined the in the documentation directly):

$ loadimpact test run 123 --metric bandwidth --raw_metric __li_url_XYZ:1:225:200:GET

Please note that the default metrics (the ones selected by using the --metric flag) will by default display the first aggregation function for the aggregated world load zone.

The output displays the values using fixed width, truncating if needed, for the purposes of readability. This can be overriden by the --full-width argument, which will cause the information to be displayed fully and separated by tab characters (\t).

If the test run finishes with a failure status then the CLI will exit with a non-zero exit code. This is helpful in combination with thresholds when using the CLI in an automation pipeline using tools and services like Jenkins, CircleCI, TeamCity etc.

Working with Metrics

Listing Metrics

The metric list command lists the Metrics available for a Test Run:

$ loadimpact metric list 789

NAME:                                                    ARGUMENT NAME:  TYPE:
__li_bandwidth:1                                         bandwidth       common
__li_bandwidth:13                                        bandwidth       common
__li_clients_active:1                                    clients_active  common
__li_clients_active:13                                   clients_active  common
__li_user_load_time:1                                    user_load_time  common
__li_user_load_time:13                                   user_load_time  common
__li_url_69e369c64ef5e40f6fd8566e4163860d:13:225:200:GET -               url
__li_url_69e369c64ef5e40f6fd8566e4163860d:1:225:200:GET  -               url
...

The list of metrics to output can be narrowed down by metric type by using the --type flag:

$ loadimpact metric list 789 --type common --type log

Contribute!

If you wan't to contribute, please check out the repository and install the dependencys in a virtualenv using pip. The tests can be run with setup.py

$ python setup.py test

If you've found a bug or something isn't working properly, please don't hesitate to create a ticket for us!

loadimpact-cli's People

Contributors

ana-yankova avatar markjmeier avatar ppcano avatar robingustafsson avatar rymdsnigel avatar wol-soft avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

loadimpact-cli's Issues

Forbidden error when list scenarios

This command returns the project id and organisation OK.
loadimpact organization list

However, when I attempt to list user-scenarios:
loadimpact user-scenario list

Traceback (most recent call last):
  File "/Users/lewisa29/.pyenv/versions/3.5.1/bin/loadimpact", line 9, in <module>
    load_entry_point('loadimpact-cli==1.0.6', 'console_scripts', 'loadimpact')()
  File "/Users/lewisa29/.pyenv/versions/3.5.1/lib/python3.5/site-packages/loadimpactcli/loadimpact_cli.py", line 37, in run_cli
    cli()
  File "/Users/lewisa29/.pyenv/versions/3.5.1/lib/python3.5/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/Users/lewisa29/.pyenv/versions/3.5.1/lib/python3.5/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/Users/lewisa29/.pyenv/versions/3.5.1/lib/python3.5/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/lewisa29/.pyenv/versions/3.5.1/lib/python3.5/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/lewisa29/.pyenv/versions/3.5.1/lib/python3.5/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/lewisa29/.pyenv/versions/3.5.1/lib/python3.5/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/Users/lewisa29/.pyenv/versions/3.5.1/lib/python3.5/site-packages/loadimpactcli/userscenario_commands.py", line 50, in list_scenarios
    userscenarios = client.list_user_scenarios(project_id)
  File "/Users/lewisa29/.pyenv/versions/3.5.1/lib/python3.5/site-packages/loadimpact3/clients.py", line 109, in list_user_scenarios
    return UserScenario.list(self, project_id=project_id)
  File "/Users/lewisa29/.pyenv/versions/3.5.1/lib/python3.5/site-packages/loadimpact3/resources.py", line 161, in list
    response = client.get(path)
  File "/Users/lewisa29/.pyenv/versions/3.5.1/lib/python3.5/site-packages/loadimpact3/clients.py", line 53, in wrapper
    return func(*args, **kwargs)
  File "/Users/lewisa29/.pyenv/versions/3.5.1/lib/python3.5/site-packages/loadimpact3/clients.py", line 168, in get
    return self._check_response(response)
  File "/Users/lewisa29/.pyenv/versions/3.5.1/lib/python3.5/site-packages/loadimpact3/clients.py", line 231, in _check_response
    msg, response=response)
loadimpact3.exceptions.ForbiddenError: {"error":{"message":"You do not have permission to perform this action.","code":4}} (https://api.loadimpact.com/v3/user-scenarios?project_id=3044266)

Updating a user scenario with a data store fails

If you try to update a user scenario that is connected to a data store,

loadimpact user-scenario update ###### user-scenarios/app.lua

It gives this error -

{"error":{"message":"You do not have permissions to access one or more of the specified user scenario's data stores","code":5003}}

Saving it in the web interface works fine. And when I disassociate the datastore with the scenario, it uploads fine via the CLI. I've also tried upload the data store via the user-scenario create --datastore_file method, and while it uploads fine initially, updates still result in this error.

Here's the full traceback -

  File "/usr/local/bin/loadimpact", line 9, in <module>
    load_entry_point('loadimpact-cli==1.0.6', 'console_scripts', 'loadimpact')()
  File "build/bdist.macosx-10.11-x86_64/egg/loadimpactcli/loadimpact_cli.py", line 37, in run_cli
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "build/bdist.macosx-10.11-x86_64/egg/loadimpactcli/userscenario_commands.py", line 107, in update_scenario
  File "build/bdist.macosx-10.11-x86_64/egg/loadimpactcli/userscenario_commands.py", line 142, in update_user_scenario_script
  File "/usr/local/lib/python2.7/site-packages/loadimpact3/resources.py", line 327, in update_scenario
    return super(UserScenario, self).update(self.client, self.id, data)
  File "/usr/local/lib/python2.7/site-packages/loadimpact3/resources.py", line 142, in update
    headers='', data=data, file_object=file_object)
  File "/usr/local/lib/python2.7/site-packages/loadimpact3/clients.py", line 53, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/loadimpact3/clients.py", line 221, in put
    return self._check_response(response)
  File "/usr/local/lib/python2.7/site-packages/loadimpact3/clients.py", line 231, in _check_response
    msg, response=response)
loadimpact3.exceptions.ForbiddenError: {"error":{"message":"You do not have permissions to access one or more of the specified user scenario's data stores","code":5003}} (https://api.loadimpact.com/v3/user-scenarios/######)

Cannot install package with pip on Ubuntu or MacOS

  1. First I tried "pip install loadimpact-cli" according to instructions in README.md:
Ragnars-MacBook-Air:~ ragnarlonn$ pip install loadimpact-cli
Collecting loadimpact-cli
  Downloading loadimpact-cli-1.0.6.tar.gz
Collecting setuptools>=18 (from loadimpact-cli)
  Downloading setuptools-34.0.2-py2.py3-none-any.whl (387kB)
    100% |████████████████████████████████| 389kB 786kB/s 
Collecting click (from loadimpact-cli)
  Downloading click-6.7-py2.py3-none-any.whl (71kB)
    100% |████████████████████████████████| 71kB 4.8MB/s 
Collecting loadimpact-v3 (from loadimpact-cli)
  Downloading loadimpact-v3-0.0.3.tar.gz
Collecting tzlocal (from loadimpact-cli)
  Downloading tzlocal-1.3.tar.gz
Requirement already satisfied (use --upgrade to upgrade): six in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from loadimpact-cli)
Collecting mock (from loadimpact-cli)
  Downloading mock-2.0.0-py2.py3-none-any.whl (56kB)
    100% |████████████████████████████████| 61kB 1.7MB/s 
Collecting appdirs>=1.4.0 (from setuptools>=18->loadimpact-cli)
  Downloading appdirs-1.4.0-py2.py3-none-any.whl
Collecting packaging>=16.8 (from setuptools>=18->loadimpact-cli)
  Downloading packaging-16.8-py2.py3-none-any.whl
Collecting requests (from loadimpact-v3->loadimpact-cli)
  Downloading requests-2.13.0-py2.py3-none-any.whl (584kB)
    100% |████████████████████████████████| 593kB 1.2MB/s 
Requirement already satisfied (use --upgrade to upgrade): pytz in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from tzlocal->loadimpact-cli)
Collecting funcsigs>=1; python_version < "3.3" (from mock->loadimpact-cli)
  Downloading funcsigs-1.0.2-py2.py3-none-any.whl
Collecting pbr>=0.11 (from mock->loadimpact-cli)
  Downloading pbr-1.10.0-py2.py3-none-any.whl (96kB)
    100% |████████████████████████████████| 102kB 2.2MB/s 
Requirement already satisfied (use --upgrade to upgrade): pyparsing in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from packaging>=16.8->setuptools>=18->loadimpact-cli)
Building wheels for collected packages: loadimpact-cli, loadimpact-v3, tzlocal
  Running setup.py bdist_wheel for loadimpact-cli ... done
  Stored in directory: /Users/ragnarlonn/Library/Caches/pip/wheels/1b/08/b7/b398baf90e3c8065103e89106c2042b1941b5316dc1d90e156
  Running setup.py bdist_wheel for loadimpact-v3 ... done
  Stored in directory: /Users/ragnarlonn/Library/Caches/pip/wheels/9d/d7/e6/5ae811e3067ad65219b6e8a5f568aad0377e57bdeb64d9c1e2
  Running setup.py bdist_wheel for tzlocal ... done
  Stored in directory: /Users/ragnarlonn/Library/Caches/pip/wheels/80/19/a8/635ad9f4ad8a63b49d073c55cbca31fb5898ce2560ed145a69
Successfully built loadimpact-cli loadimpact-v3 tzlocal
Installing collected packages: appdirs, packaging, setuptools, click, requests, loadimpact-v3, tzlocal, funcsigs, pbr, mock, loadimpact-cli
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 317, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 742, in install
    **kwargs
  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 831, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 1032, in move_wheel_files
    isolated=self.isolated,
  File "/Library/Python/2.7/site-packages/pip/wheel.py", line 346, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/Library/Python/2.7/site-packages/pip/wheel.py", line 324, in clobber
    shutil.copyfile(srcfile, destfile)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 83, in copyfile
    with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/appdirs.py'
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
  1. So, "permission denied" indicates lack of privileges to install. So I tried sudo:ing the command (README.md should maybe use "sudo" in the cmd line example)
Ragnars-MacBook-Air:~ ragnarlonn$ sudo pip install loadimpact-cli
Password:
The directory '/Users/ragnarlonn/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/ragnarlonn/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting loadimpact-cli
Collecting tzlocal (from loadimpact-cli)
Collecting loadimpact-v3 (from loadimpact-cli)
Requirement already satisfied (use --upgrade to upgrade): six in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from loadimpact-cli)
Collecting setuptools>=18 (from loadimpact-cli)
  Downloading setuptools-34.0.2-py2.py3-none-any.whl (387kB)
    100% |████████████████████████████████| 389kB 505kB/s 
Collecting mock (from loadimpact-cli)
  Downloading mock-2.0.0-py2.py3-none-any.whl (56kB)
    100% |████████████████████████████████| 61kB 2.1MB/s 
Collecting click (from loadimpact-cli)
  Downloading click-6.7-py2.py3-none-any.whl (71kB)
    100% |████████████████████████████████| 71kB 1.5MB/s 
Requirement already satisfied (use --upgrade to upgrade): pytz in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from tzlocal->loadimpact-cli)
Collecting requests (from loadimpact-v3->loadimpact-cli)
  Downloading requests-2.13.0-py2.py3-none-any.whl (584kB)
    100% |████████████████████████████████| 593kB 1.3MB/s 
Collecting appdirs>=1.4.0 (from setuptools>=18->loadimpact-cli)
  Downloading appdirs-1.4.0-py2.py3-none-any.whl
Collecting packaging>=16.8 (from setuptools>=18->loadimpact-cli)
  Downloading packaging-16.8-py2.py3-none-any.whl
Collecting funcsigs>=1; python_version < "3.3" (from mock->loadimpact-cli)
  Downloading funcsigs-1.0.2-py2.py3-none-any.whl
Collecting pbr>=0.11 (from mock->loadimpact-cli)
  Downloading pbr-1.10.0-py2.py3-none-any.whl (96kB)
    100% |████████████████████████████████| 102kB 1.6MB/s 
Requirement already satisfied (use --upgrade to upgrade): pyparsing in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from packaging>=16.8->setuptools>=18->loadimpact-cli)
Installing collected packages: tzlocal, requests, loadimpact-v3, appdirs, packaging, setuptools, funcsigs, pbr, mock, click, loadimpact-cli
  Found existing installation: setuptools 1.1.6
    Uninstalling setuptools-1.1.6:
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 317, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 736, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 742, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 299, in move
    copytree(src, real_dst, symlinks=True)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 208, in copytree
    raise Error, errors
Error: [('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', '/tmp/pip-xlSv70-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', "[Errno 1] Operation not permitted: '/tmp/pip-xlSv70-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', '/tmp/pip-xlSv70-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-xlSv70-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', '/tmp/pip-xlSv70-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', "[Errno 1] Operation not permitted: '/tmp/pip-xlSv70-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', '/tmp/pip-xlSv70-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-xlSv70-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', '/tmp/pip-xlSv70-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', "[Errno 1] Operation not permitted: '/tmp/pip-xlSv70-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib'")]
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
  1. No idea what caused that error. I'll try cloning the repo and using setup.py instead:

[after cloning and CDing into the loadimpact-cli dir]

sudo python setup.py install
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'test_requires'
  warnings.warn(msg)
running install
Checking .pth file support in /Library/Python/2.7/site-packages/
/usr/bin/python -E -c pass
TEST PASSED: /Library/Python/2.7/site-packages/ appears to support .pth files
running bdist_egg
running egg_info
creating loadimpact_cli.egg-info
writing requirements to loadimpact_cli.egg-info/requires.txt
writing loadimpact_cli.egg-info/PKG-INFO
writing top-level names to loadimpact_cli.egg-info/top_level.txt
writing dependency_links to loadimpact_cli.egg-info/dependency_links.txt
writing entry points to loadimpact_cli.egg-info/entry_points.txt
writing manifest file 'loadimpact_cli.egg-info/SOURCES.txt'
file loadimpactcli.py (for module loadimpactcli) not found
reading manifest file 'loadimpact_cli.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '__pycache__' found anywhere in distribution
writing manifest file 'loadimpact_cli.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.11-intel/egg
running install_lib
running build_py
file loadimpactcli.py (for module loadimpactcli) not found
creating build
creating build/lib
creating build/lib/loadimpactcli
copying loadimpactcli/__init__.py -> build/lib/loadimpactcli
copying loadimpactcli/client.py -> build/lib/loadimpactcli
copying loadimpactcli/config.py -> build/lib/loadimpactcli
copying loadimpactcli/datastore_commands.py -> build/lib/loadimpactcli
copying loadimpactcli/errors.py -> build/lib/loadimpactcli
copying loadimpactcli/loadimpact_cli.py -> build/lib/loadimpactcli
copying loadimpactcli/organization_commands.py -> build/lib/loadimpactcli
copying loadimpactcli/userscenario_commands.py -> build/lib/loadimpactcli
copying loadimpactcli/version.py -> build/lib/loadimpactcli
file loadimpactcli.py (for module loadimpactcli) not found
creating build/bdist.macosx-10.11-intel
creating build/bdist.macosx-10.11-intel/egg
creating build/bdist.macosx-10.11-intel/egg/loadimpactcli
copying build/lib/loadimpactcli/__init__.py -> build/bdist.macosx-10.11-intel/egg/loadimpactcli
copying build/lib/loadimpactcli/client.py -> build/bdist.macosx-10.11-intel/egg/loadimpactcli
copying build/lib/loadimpactcli/config.py -> build/bdist.macosx-10.11-intel/egg/loadimpactcli
copying build/lib/loadimpactcli/datastore_commands.py -> build/bdist.macosx-10.11-intel/egg/loadimpactcli
copying build/lib/loadimpactcli/errors.py -> build/bdist.macosx-10.11-intel/egg/loadimpactcli
copying build/lib/loadimpactcli/loadimpact_cli.py -> build/bdist.macosx-10.11-intel/egg/loadimpactcli
copying build/lib/loadimpactcli/organization_commands.py -> build/bdist.macosx-10.11-intel/egg/loadimpactcli
copying build/lib/loadimpactcli/userscenario_commands.py -> build/bdist.macosx-10.11-intel/egg/loadimpactcli
copying build/lib/loadimpactcli/version.py -> build/bdist.macosx-10.11-intel/egg/loadimpactcli
byte-compiling build/bdist.macosx-10.11-intel/egg/loadimpactcli/__init__.py to __init__.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/loadimpactcli/client.py to client.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/loadimpactcli/config.py to config.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/loadimpactcli/datastore_commands.py to datastore_commands.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/loadimpactcli/errors.py to errors.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/loadimpactcli/loadimpact_cli.py to loadimpact_cli.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/loadimpactcli/organization_commands.py to organization_commands.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/loadimpactcli/userscenario_commands.py to userscenario_commands.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/loadimpactcli/version.py to version.pyc
installing package data to build/bdist.macosx-10.11-intel/egg
running install_data
copying README.md -> build/bdist.macosx-10.11-intel/egg/
creating build/bdist.macosx-10.11-intel/egg/EGG-INFO
copying loadimpact_cli.egg-info/PKG-INFO -> build/bdist.macosx-10.11-intel/egg/EGG-INFO
copying loadimpact_cli.egg-info/SOURCES.txt -> build/bdist.macosx-10.11-intel/egg/EGG-INFO
copying loadimpact_cli.egg-info/dependency_links.txt -> build/bdist.macosx-10.11-intel/egg/EGG-INFO
copying loadimpact_cli.egg-info/entry_points.txt -> build/bdist.macosx-10.11-intel/egg/EGG-INFO
copying loadimpact_cli.egg-info/requires.txt -> build/bdist.macosx-10.11-intel/egg/EGG-INFO
copying loadimpact_cli.egg-info/top_level.txt -> build/bdist.macosx-10.11-intel/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/loadimpact_cli-1.0.6-py2.7.egg' and adding 'build/bdist.macosx-10.11-intel/egg' to it
removing 'build/bdist.macosx-10.11-intel/egg' (and everything under it)
Processing loadimpact_cli-1.0.6-py2.7.egg
Copying loadimpact_cli-1.0.6-py2.7.egg to /Library/Python/2.7/site-packages
Adding loadimpact-cli 1.0.6 to easy-install.pth file
Installing loadimpact script to /usr/local/bin

Installed /Library/Python/2.7/site-packages/loadimpact_cli-1.0.6-py2.7.egg
Processing dependencies for loadimpact-cli==1.0.6
Searching for mock
Reading https://pypi.python.org/simple/mock/
Best match: mock 2.0.0
Downloading https://pypi.python.org/packages/0c/53/014354fc93c591ccc4abff12c473ad565a2eb24dcd82490fae33dbf2539f/mock-2.0.0.tar.gz#md5=0febfafd14330c9dcaa40de2d82d40ad
Processing mock-2.0.0.tar.gz
Writing /tmp/easy_install-2hFZun/mock-2.0.0/setup.cfg
Running mock-2.0.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-2hFZun/mock-2.0.0/egg-dist-tmp-Nq2iHD
error: Installed distribution setuptools 1.1.6 conflicts with requirement setuptools>=17.1
  1. Seems installation was partly successful, but something went wrong at the end. I do have a binary in /usr/local, trying to run that:
Ragnars-MacBook-Air:loadimpact-cli ragnarlonn$ /usr/local/bin/loadimpact 
Traceback (most recent call last):
  File "/usr/local/bin/loadimpact", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2793, in <module>
    working_set.require(__requires__)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 673, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 576, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: mock

No luck. It's definitely not plug-and-play for me, this app! After upgrading pip I still get the same error when trying to do 'sudo pip install loadimpact-cli', so the old pip version doesn't seem to have anything to do with it.

`loadimpact run` exits if the test result request fails

When running a test, the CLI exits if the request to the test result endpoint v3/test-runs/XXXX/results fails.

[04:22:57] :	 [Step 5/5] TEST_RUN_ID:
[04:22:57] :	 [Step 5/5] XXXXX
[04:22:57] :	 [Step 5/5] Initializing test ...
[04:24:45] :	 [Step 5/5] TIMESTAMP:                VUs [1]:         reqs/s [1]:      bandwidth [1]:   user load time [1]: failure rate [1]:
.....
[04:42:57]W:	 [Step 5/5] Traceback (most recent call last):
[04:42:57]W:	 [Step 5/5]   File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\Scripts\loadimpact-script.py", line 11, in <module>
[04:42:57]W:	 [Step 5/5]     load_entry_point('loadimpact-cli==1.2.0', 'console_scripts', 'loadimpact')()
[04:42:57]W:	 [Step 5/5]   File "c:\users\administrator\appdata\local\programs\python\python36-32\lib\site-packages\loadimpactcli\loadimpact_cli.py", line 41, in run_cli
[04:42:57]W:	 [Step 5/5]     cli()
[04:42:57]W:	 [Step 5/5]   File "c:\users\administrator\appdata\local\programs\python\python36-32\lib\site-packages\click\core.py", line 722, in __call__
[04:42:57]W:	 [Step 5/5]     return self.main(*args, **kwargs)
[04:42:57]W:	 [Step 5/5]   File "c:\users\administrator\appdata\local\programs\python\python36-32\lib\site-packages\click\core.py", line 697, in main
[04:42:57]W:	 [Step 5/5]     rv = self.invoke(ctx)
[04:42:57]W:	 [Step 5/5]   File "c:\users\administrator\appdata\local\programs\python\python36-32\lib\site-packages\click\core.py", line 1066, in invoke
[04:42:57]W:	 [Step 5/5]     return _process_result(sub_ctx.command.invoke(sub_ctx))
[04:42:57]W:	 [Step 5/5]   File "c:\users\administrator\appdata\local\programs\python\python36-32\lib\site-packages\click\core.py", line 1066, in invoke
[04:42:57]W:	 [Step 5/5]     return _process_result(sub_ctx.command.invoke(sub_ctx))
[04:42:57]W:	 [Step 5/5]   File "c:\users\administrator\appdata\local\programs\python\python36-32\lib\site-packages\click\core.py", line 895, in invoke
[04:42:57]W:	 [Step 5/5]     return ctx.invoke(self.callback, **ctx.params)
[04:42:57]W:	 [Step 5/5]   File "c:\users\administrator\appdata\local\programs\python\python36-32\lib\site-packages\click\core.py", line 535, in invoke
[04:42:57]W:	 [Step 5/5]     return callback(*args, **kwargs)
[04:42:57]W:	 [Step 5/5]   File "c:\users\administrator\appdata\local\programs\python\python36-32\lib\site-packages\loadimpactcli\test_commands.py", line 108, in run_test
[04:42:57]W:	 [Step 5/5]     for i, data in enumerate(stream(poll_rate=3)):
[04:42:57]W:	 [Step 5/5]   File "c:\users\administrator\appdata\local\programs\python\python36-32\lib\site-packages\loadimpact3\resources.py", line 394, in __call__
[04:42:57]W:	 [Step 5/5]     results = TestRunResults.list(self.test_run.client, self.test_run.id, {'ids': ','.join(q)})
[04:42:57]W:	 [Step 5/5]   File "c:\users\administrator\appdata\local\programs\python\python36-32\lib\site-packages\loadimpact3\resources.py", line 200, in list
[04:42:57]W:	 [Step 5/5]     data=json.dumps(data))
[04:42:57]W:	 [Step 5/5]   File "c:\users\administrator\appdata\local\programs\python\python36-32\lib\site-packages\loadimpact3\clients.py", line 54, in wrapper
[04:42:57]W:	 [Step 5/5]     return func(*args, **kwargs)
[04:42:57]W:	 [Step 5/5]   File "c:\users\administrator\appdata\local\programs\python\python36-32\lib\site-packages\loadimpact3\clients.py", line 214, in post
[04:42:57]W:	 [Step 5/5]     return self._check_response(response)
[04:42:57]W:	 [Step 5/5]   File "c:\users\administrator\appdata\local\programs\python\python36-32\lib\site-packages\loadimpact3\clients.py", line 254, in _check_response
[04:42:57]W:	 [Step 5/5]     raise ServerError(msg, response=response)
[04:42:57]W:	 [Step 5/5] loadimpact3.exceptions.ServerError: {"error":{"message":"An unexpected error occurred","code":0}} (https://api.loadimpact.com/v3/test-runs/XXXX/results)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.