up9
TypeScript icon, indicating that this package has built-in type declarations

2.13.0 • Public • Published

up9

oclif Version Downloads/week License

Usage

$ npm install -g up9
$ up9 COMMAND
running command...
$ up9 (-v|--version|version)
up9/2.13.0 linux-x64 node-v17.3.0
$ up9 --help [COMMAND]
USAGE
  $ up9 COMMAND
...

Stateless Authentication (CI support)

Pass API key to a command in order to execute it with one-time authentication (without having to run auth:login). ENV is optional and defaults to up9.app.

Option 1: With environemnt variable

export UP9_CREDENTIALS=CLIENT_ID:CLIENT_SECRET[:ENV]
up9 COMMAND

Option 2: With flags

up9 COMMAND --client-id CLIENT_ID --client-secret CLIENT_SECRET [--env ENV]

Commands

up9 agent

Manage agents

USAGE
  $ up9 agent

up9 agent:forget AGENTID

USAGE
  $ up9 agent:forget AGENTID

up9 agent:list

USAGE
  $ up9 agent:list

OPTIONS
  -x, --extended          show extra columns
  --columns=columns       only show provided columns (comma-separated)
  --csv                   output is csv format [alias: --output=csv]
  --filter=filter         filter property by partial string matching, ex: name=foo
  --no-header             hide table header from output
  --no-truncate           do not truncate output to fit screen
  --output=csv|json|yaml  output in a more machine friendly format
  --sort=sort             property to sort by (prepend '-' for descending)

up9 agent:set-workspace AGENTID WORKSPACE

Set agent to a workspace

USAGE
  $ up9 agent:set-workspace AGENTID WORKSPACE

up9 auth

Manage authentication to up9 api

USAGE
  $ up9 auth

up9 auth:apikey

Get an api key

USAGE
  $ up9 auth:apikey

up9 auth:login

Logs in to up9

USAGE
  $ up9 auth:login

OPTIONS
  --client-id=client-id
  --client-secret=client-secret
  --env=stg.up9.com              [INTERNAL] Set to dev env

up9 auth:logout

USAGE
  $ up9 auth:logout

up9 auth:show

Shows authentication status

USAGE
  $ up9 auth:show

up9 calibrate:run WORKSPACE [SUBSYSTEM] [ENV-PROFILE]

USAGE
  $ up9 calibrate:run WORKSPACE [SUBSYSTEM] [ENV-PROFILE]

ARGUMENTS
  WORKSPACE
  SUBSYSTEM    [default: all]
  ENV-PROFILE  Name of environment profile to use. If none passed, takes first profile by alphanumeric order.

OPTIONS
  --revision-id=revision-id

up9 calibrate:run-local MODEL SUBSYSTEM

USAGE
  $ up9 calibrate:run-local MODEL SUBSYSTEM

OPTIONS
  --auth-payload-file=auth-payload-file
  --env-profile-config-file=env-profile-config-file
  --revision-id=revision-id
  --services-config-file=services-config-file

up9 mock:switch

Switch environments to use mocks (ALPHA)

USAGE
  $ up9 mock:switch

OPTIONS
  -a, --all                  Reset all mocked services to live

  -d, --directory=directory  Set the directory with mockintosh.yaml and data. Using this flag will override the
                             mockintosh configuration from --workspace, but will not update up9.app

  -h, --help                 show CLI help

  -r, --reset                Reset services from mocked to live

  -s, --services=services

  -w, --workspace=workspace  Set UP9 Workspace. Using this flag will override previous --directory runs

EXAMPLES
  $ up9 mock:switch -w default
  $ up9 mock:switch -w default -s serviceName.serviceNamespace
  $ up9 mock:switch -d directory_path
  $ up9 mock:switch -d directory_path -s serviceName.serviceNamespace
  $ up9 mock:switch --reset
  $ up9 mock:switch --reset --all

up9 model:artifacts WORKSPACE

USAGE
  $ up9 model:artifacts WORKSPACE

OPTIONS
  --revision=revision
  --subsystem=subsystem

up9 model:clone-profile WORKSPACE PROFILENAME NEWPROFILENAME AGENTNAME

USAGE
  $ up9 model:clone-profile WORKSPACE PROFILENAME NEWPROFILENAME AGENTNAME

OPTIONS
  --subSystem=subSystem

up9 model:compare MODELA REVA SUBSYSA MODELB REVB SUBSYSB

USAGE
  $ up9 model:compare MODELA REVA SUBSYSA MODELB REVB SUBSYSB

up9 model:create WORKSPACE

USAGE
  $ up9 model:create WORKSPACE

up9 model:share MODEL

USAGE
  $ up9 model:share MODEL

OPTIONS
  --no-model-ok  create share link even when the model does not currently exist

up9 postman:push WORKSPACE

PushPostman

USAGE
  $ up9 postman:push WORKSPACE

OPTIONS
  -a, --apikey=apikey  Postman API Key

EXAMPLES
  up9 postman:push default --apikey PMAK-123123123123123-123123123123123123123
  up9 postman:push default

  Learn how to create your API Key on https://go.postman.co/settings/me/api-keys

up9 postman:set WORKSPACE

setPostmmanKey

USAGE
  $ up9 postman:set WORKSPACE

OPTIONS
  -a, --apikey=apikey  (required) Postman API Key
  -h, --help           show CLI help

EXAMPLES
  up9 postman:set default --apikey PMAK-123123123123123123123-123123123123123

  Learn how to create your API Key on https://go.postman.co/settings/me/api-keys

up9 tap

Manage tapping

USAGE
  $ up9 tap

up9 tap:create-docker-compose [MODEL]

Creates a docker compose file for tapper services

USAGE
  $ up9 tap:create-docker-compose [MODEL]

OPTIONS
  -i, --in-compose-file=in-compose-file    path to docker-compose file containing the services to tap (defaults to
                                           docker-compose.y[a]ml if exists)

  -o, --out-compose-file=out-compose-file  path to docker-compose file that will contain the tapper services (defaults
                                           to docker-compose-up9.y[a]ml)

  --agent-name=agent-name                  override agent name

  --standalone                             standalone mode - does not connect to up9 cloud

up9 tap:disable TAPPINGSOURCEID

USAGE
  $ up9 tap:disable TAPPINGSOURCEID

up9 tap:enable TAPPINGSOURCEID

USAGE
  $ up9 tap:enable TAPPINGSOURCEID

up9 tap:forget TAPPINGSOURCEID

Delete a tapping source

USAGE
  $ up9 tap:forget TAPPINGSOURCEID

up9 tap:freeze MODEL

USAGE
  $ up9 tap:freeze MODEL

up9 tap:list

USAGE
  $ up9 tap:list

OPTIONS
  -x, --extended          show extra columns
  --columns=columns       only show provided columns (comma-separated)
  --csv                   output is csv format [alias: --output=csv]
  --filter=filter         filter property by partial string matching, ex: name=foo
  --no-header             hide table header from output
  --no-truncate           do not truncate output to fit screen
  --output=csv|json|yaml  output in a more machine friendly format
  --sort=sort             property to sort by (prepend '-' for descending)

up9 tap:set-model MODEL TAPPINGSOURCEID

USAGE
  $ up9 tap:set-model MODEL TAPPINGSOURCEID

up9 tap:start MODEL

Starts a browser-based tapper (puppeteer)

USAGE
  $ up9 tap:start MODEL

up9 tap:start-container MODEL

Starts a docker container tapper

USAGE
  $ up9 tap:start-container MODEL

up9 tap:upload DIR WORKSPACE

Upload HAR files to UP9

USAGE
  $ up9 tap:upload DIR WORKSPACE

up9 test

Manage tests

USAGE
  $ up9 test

up9 test:auth-detect-browser-based MODEL [SUBSYSTEM]

USAGE
  $ up9 test:auth-detect-browser-based MODEL [SUBSYSTEM]

up9 test:auth-verify AUTH-CONFIG-FILE

USAGE
  $ up9 test:auth-verify AUTH-CONFIG-FILE

up9 test:run WORKSPACE COLLECTION

USAGE
  $ up9 test:run WORKSPACE COLLECTION

OPTIONS
  --extraEnvFilePath=extraEnvFilePath  Path to extra env vars passed to the test run
  --junit                              Download the test run summary in JUnit format
  --junit-filename=junit-filename      Override the default junit filename

ALIASES
  $ up9 test:run-collection

up9 test:run-local WORKSPACE COLLECTION

USAGE
  $ up9 test:run-local WORKSPACE COLLECTION

OPTIONS
  --auth-payload-file=auth-payload-file
  --env-profile-config-file=env-profile-config-file
  --junit                                            Download the test run summary in JUnit format
  --junit-filename=junit-filename                    Override the default junit filename
  --services-config-file=services-config-file

up9 update [CHANNEL]

update the up9 CLI

USAGE
  $ up9 update [CHANNEL]

See code: @oclif/plugin-update

Authentication

General

When running tests locally with the up9 test:run-local command, it is possible to supply an environment profile compatible authentication spec Supply a --env-profile-config-file flag, pointing to a .json file in the following format:

{
   "authentication": {
      "assignments": {
         "payloadId": "myAuthHelperConfig1"
      },
      "configurations": {
         "myAuthHelperConfig1": {
            "type": "authHelper", // See authentication types below
            "spec": {
                ...
            }
      }
   }
}

Supported Authentication Types

Custom Code

You can provide custom code by providing it as base64 encoded python code.

Code example

def custom_auth() -> AuthenticationPayload:
  resp = requests.post('https://auth-server.com/token', json={'secret': 'MY_SECRET'})
  token = resp.json()['access_code']

  # Any print() will be logged as debug data
  print('Received token: {token}')

  # Note: you must return a valid AuthenticationPayload object
  return AuthenticationPayload(headers={"Authorization": token})

Configuration

{
   "authentication": {
      "assignments": {
         "payloadId": "myCustomCode1"
      },
      "configurations": {
         "myCustomCode1": {
            "type": "customCode",
            "spec": {
                "customCode": "ZGVmIGN1c3RvbV9hdXRoKCkgLT4gQXV0aGVudGljYXRpb25QYXlsb2FkOgogIHJlc3AgPSByZXF1ZXN0cy5wb3N0KCdodHRwczovL2F1dGgtc2VydmVyLmNvbS90b2tlbicsIGpzb249eydzZWNyZXQnOiAnTVlfU0VDUkVUJ30pCiAgdG9rZW4gPSByZXNwLmpzb24oKVsnYWNjZXNzX2NvZGUnXQoKICAjIEFueSBwcmludCgpIHdpbGwgYmUgbG9nZ2VkIGFzIGRlYnVnIGRhdGEKICBwcmludCgnUmVjZWl2ZWQgdG9rZW46IHt0b2tlbn0nKQoKICAjIE5vdGU6IHlvdSBtdXN0IHJldHVybiBhIHZhbGlkIEF1dGhlbnRpY2F0aW9uUGF5bG9hZCBvYmplY3QKICByZXR1cm4gQXV0aGVudGljYXRpb25QYXlsb2FkKGhlYWRlcnM9eyJBdXRob3JpemF0aW9uIjogdG9rZW59KQ=="
            }
      }
   }
}

Basic Auth

{
   "authentication": {
      "assignments": {
         "payloadId": "myBasicAuth1"
      },
      "configurations": {
         "myBasicAuth1": {
            "type": "basicAuth",
            "spec": {
                "username": "user1",
                "password": "pass1"
            }
      }
   }
}

Headers

{
   "authentication": {
      "assignments": {
         "payloadId": "myHeadersConfig1"
      },
      "configurations": {
         "myHeadersConfig1": {
            "type": "headers",
            "spec": {
                "headers": [
                    {
                        "key": "Auth1",
                        "value": "Bearer ..."
                    },
                    ...
                ]
            }
      }
   }
}

Browser-Based ("Auth Helper")

For browser-based authentication use cases, you can generate an initial env profile configuration using the test:auth-detect-browser-based command. The spec value (see example above) should be as follows:

{
    "formURL": "<URL>", // Form login URL
    "username": "<USERNAME>", // Typed into login form
    "password": "<PASSWORD>", // Typed into login form
    // Headers needed for authenticated API requests. These will be extracted from observed HTTP requests.
    // Optional - if not supplied, only cookie header will be extracted upon successful login form submission
    "headers": {  
        "x-my-api-key": {},
        "authorization": {
        }    
    },
    // URLs to visit after successful form submission, in case additional browsing is needed in order to generate the 
    // necessary cookies or headers
    "additionalUrls": [
        "http://myurl.com"
    ]
}

Troubleshooting

Log

Log file is located in $HOME/.config/up9/up9.log

Refer to it and share with UP9 team when you reporting any problems.

Debug output

Use -d switch to print debug output, see examples below.

Regular usage example

$ up9 auth login
Already logged in to stg.testr.io as: user@up9.com

With debug output

$ up9 auth login -d
  Login: Running command Login
  Already logged in to stg.testr.io as: user@up9.com
  AuthProvider: Logged in to environment: stg.testr.io
  Login: Command exited

Readme

Keywords

Package Sidebar

Install

npm i up9

Weekly Downloads

2

Version

2.13.0

License

MIT

Unpacked Size

369 kB

Total Files

193

Last publish

Collaborators

  • shahartestr
  • testr