You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

Overview

This page defines test cases for the NDSLabs command line utility (ndslabsctl). 

See also

Starting the API server

The ndslabs-up.sh will create a ~/bin directory and download the latest version of the ndslabsctl binary. A file ~/.ndslabsctl.yaml is also created containing the API server address from Kubernetes.  

If you are not using the ndslabs-startup.sh script, you will need to manually download the ndslabsctl from Github: https://github.com/nds-org/ndslabs/releases/tag/v1.0-alpha

 If the API server is running under docker or Kubernetes, you will need to specify the server address. This can be done on the commandline using the --server flag or by creating a .ndslabsctl.yaml file in your home directory.  For example:

APISERVER=`kubectl describe svc ndslabs-apiserver | grep ^IP | awk '{print $2}'`

echo "server: http://$APISERVER:8083" > ~/.ndslabsctl.yaml

Global preconditions

  • Kubernetes is running
  • API Server is running either as a Kubernetes service or as a standalone Docker container 
  • ndslabsctl has been installed and is in your path

Help

  • Preconditions: none
  • Test steps:
    • ndslabsctl

    • ndslabsctl -h

    • ndslabsctl --help

  • Expected results
    • Any of these commands should display the help/usage information

Authentication/authorization

Login

  • Preconditions:

    • Project has been created or admin user

  • Test steps:
    • ndslabsctl login admin 
    • ndslabsctl login <user>
    • Prompted for password
  • Expected results:
    • Login succeeded
  • Alternative flows
    • Invalid username or password results in login error
  • Notes:
    • Login information is stored in ~/.apictl/.passwd. This files contains the currently logged in user and an authentication token. Removing this file is the equivalent of logging out

Logout

  • Preconditions
    • User is logged in
  • Test steps
    • ndslabsctl logout
    • ndslabsctl list services
  • Expected results:
    • List command results in "unauthorized"

Change password

  • Preconditions:
    • User is logged in
  • Test steps
    • ndslabsctl login <user>
    • ndslabsctl passwd
      • Enter current password
      • Enter new password
      • Confirm new password
  • Expected results
    • Password is changed

Project administration

Add project (admin only)

  • Preconditions:
    • Admin is logged in
  • Test steps
    • ndslabsctl add project <name> <password>
    • ndslabsctl add project -f <project.json>
    • ndslabsctl add project --file <project.json>
  • Expected results
    • Project is added. User can login with specified name and password
  • Alternate flows
    • Project exists with same name (409 conflict)
    • Logged in user is not admin (401 unauthorized)

Sample project file:

{
       "name": "test",
       "description": "testacct",
       "namespace": "test",
       "password": "123456"
}

Delete project (admin only)

  • Preconditions
    • Admin is logged in
  • Test steps
    • ndslabsctl delete project <project>
  • Expected results
    • Project is deleted
  • Alternate flows:
    • Project does not exist (404 not found) 
      • Problem: currently results in 500
    • User is not admin (401 unauthorized)

Get project details (admin or current project only)

  • Preconditions
    • Admin is logged in or current project user is logged in
  • Test steps
    • ndslabsctl get project <project>
  • Expected results
    • Displays project details (as json)
    • Password is redacted
  • Alternate flows:
    • Project does not exist (404)
    • User is not admin and project is not current project (401 unauthorized)

List projects

  • Preconditions
    • Admin is logged in
  • Test steps
    • ndslabsctl list projects
  • Expected results
    • Projects are listed
      • Problem: ID is displayed

Service administration

Add service (admin only)

  • Preconditions:
    • Admin is logged in
  • Test steps
    • ndslabsctl add service -f <service.json>
    • ndslabsctl add service --file <service.json>
  • Expected results
    • Service is added. User can add service/stack.
  • Alternate flows
    • Service exists with same key (409 conflict)
    • Logged in user is not admin (401 unauthorized)
  • Notes:
    • See ndslabs-specs repos for sample services

Delete service (admin only)

  • Preconditions
    • Admin is logged in
  • Test steps
    • ndslabsctl delete service <key>
  • Expected results
    • Service is deleted
  • Alternate flows:
    • Project does not exist (404 not found) 
    • User is not admin (401 unauthorized)
    • Not logged in (401)
    • Not admin user (401)
    • Service is in use by projects (409)
    • Service required by other services (409)
    • No such service (404)

Get service details

  • Preconditions
    • User is logged in
  • Test steps
    • ndslabsctl get service <key>
  • Expected results
    • Displays service spec (as json)
  • Alternate flows:
    • Service does not exist (404

List services

  • Preconditions
    • User is logged in
  • Test steps
    • ndslabsctl list services
  • Expected results
    • Services are listed

Stack administration

  • Admin user can create / start / stop stacks. We will need to revisit the workflow for admin.

Add stack

 

  • Preconditions
    • Logged in
    • Service exists
  • Test steps
    • ndslabsctl add stack <key> <name> 
    • ndslabsctl add stack <key> <name> --opt=<comma-separated list of optional services>
  • Expected results
    • Stack is added
  • Alternate flow
    • Not logged in (401)
    • Service doesn't exist (404)
    • Duplicate stack name (409)

List stacks

List stacks

  • Preconditions:
    • Logged in
    • Stack has been added
  • Test steps
    • ndslabsctl list stacks
  • Expected results
    • Summary of stacks is displayed (name, services, status, SIDs)
  • Alternate flow:
    • Not logged in (401)
    • No stacks (empty list)

Delete stack

  • Preconditions:
    • Logged in
    • Stack exists
    • Stack not running
  • Test steps
    • ndslabsctl delete stack <sid>
    • Stack is deleted (201)
  • Alternate flow
    • Not logged in (401)
    • Stack doesn't exist (404)
    • Stack is running (409)
    • Attached volumes are orphaned

Get stack details

  • Preconditions:
    • Logged in
    • Stack exists
  • Test steps
    • ndslabsctl get stack <sid>
  • Expected results
    • Stack details, including endpoints and config, are displayed
  • Alternate flow
    • Not logged in (401)
    • Stack doesn't exist (404)

Start stack

  • Preconditions
    • Logged in
    • Stack exists and started
  • Test steps
    • ndslabsctl start <sid>
  • Expected results
    • All stack services (service, replication controller, pods) are started and ready
  • Alternate flow
    • Not logged in (401)
    • Stack doesn't exist (404)
    • Stack not started or stopping (409)

Stop stack

  • Preconditions
    • Stack started
  • Test steps
    • ndslabsctl stop <sid>
  • Expected results
    • Stack service, replication controller, pods are stopped (200)
  • Alternative flow
    • Not logged in (401)
    • Stack does not exist (404)
    • Stack not started (200)

Volume administration

Create volume

  • Preconditions
    • Logged in
    • Sufficient quota remaining (not implemented)
  • Test steps
    • ndslabsctl create <vol name> <vol size GB>
      • Creates a detached volume
    • ndslabsctl create <vol name> <vol size GB> <sid>
      • Creates and attaches volume
  • Expected results
    • Volume is created
    • Volume is created and attached
  • Alternate flow
    • Not logged in (401)
    • Insufficient quota (409) (not implemented)
    • Duplicate name (409)
    • Stack doesn't exist (404)

Attach volume

  • Preconditions:
    • Logged in 
    • Volume exits
    • Service exists with no existing attachments
    • Service not running
  • Test steps
    • ndslabsctl attach <vol name> <sid>
  • Expected results
    • Volume is attached to specified service
  • Alternate flow
    • Not logged in (401)
    • Volume doesn't exist (404)
    • Service doesn't exist (404)
    • Service is running (409)
    • Volume is attached (409)

List volumes

  • Preconditions
    • Logged in
    • Volumes exist
  • Test steps
    • ndslabsctl list volumes
  • Expected results
    • Volume details are displayed
  • Alterate flow
    • Not logged in (401)
    • No volumes exist (200)

Detach volume

  • Preconditions
    • Logged in
    • Volume exists and is attached
    • Stack not running
  • Test steps
    • ndslabsctl detach <vol name>
  • Expected results
    • Volume is detached
  • Alternative flow
    • Not logged in (401)
    • Volume doesn't exist (404)
    • Stack is running (409)
    • Volume isn't attached (409)

Delete volume

  • Preconditions
    • Logged in
    • Volume exists
    • Stack not running
  • Test case:
    • ndslabsctl delete <vol name>
  • Expected results:
    • Volume is deleted
  • Alternative flow
    • Not logged in (401)
    • Volume doesn't exist (404)
    • Stack is running (409)

Configuration

Get stack service configuration

  • Preconditions
    • Logged in
    • Stack exists
  • Test case:
    • ndslabsctl get configs <sid>
  • Expected results:
    • Current service configuration options and settings are displayed
    • Problem: resulting in 500 now
  • Alternative flow
    • Not logged in (401)
    • Stack doesn't exist (404)

Set stack service configuration option

  • Preconditions
    • Logged in
    • Stack exists
    • Config exists
  • Test case:
    • ndslabsctl set <sid> <name> <value>
  • Expected results:
    • Specified configuration setting os overriden for the service
  • Alternative flow
    • Not logged in (401)
    • Stack doesn't exist (404)
    • Config doesn't exist or is not overridable (409)

Other

View stack service logs

  • Preconditions
    • Logged in
    • Stack exists
    • Stack started
    • Config exists
  • Test case:
    • ndslabsctl logs <sid> 
    • ndslabsctl logs <sid> --lines=<lines>
  • Expected results:
    • Logs are displayed
    • Last n log lines are displayed
  • Alternative flow
    • Not logged in (401)
    • Stack doesn't exist (404)
    • Stack is not running (404)

 

 

 

  • No labels