Overview
This page defines test cases for the NDSLabs command line utility (ndslabsctl).
See also
Starting the API server
- eval $(docker run --rm -t ndslabs/system-shell usage docker)
- kube-up.sh
- If needed, download the latest copy of ndslabsctl
- wget https://github.com/nds-org/ndslabs/releases/download/v1.0-alpha/ndslabsctl-linux-amd64 -O /usr/local/bin/ndslabsctl
- chmod +x ndslabsctl
- If testing a new version of API server
- vi /usr/local/lib/ndslabs/apiserver
- Change latest -> test
- docker rmi ndslabs/apiserver:test
- ndslabs-up.sh
- "ndslabsctl list projects" to confirm things are working
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
- Issues:
- help command still references "apictl"
Project administration
Add project (admin only)
- Test steps
- ndslabsctl add project <name> <password>
- ndslabsctl add project -f <project.json>
- ndslabsctl add project --file <project.json>
- Expected results
- Prompted for admin password
- Project is added. User can login with specified name and password
- Alternate flows
- Project exists with same name (409 conflict)
- Incorrect admin password (401 unauthorized)
- Sample Data:
{ "name": "test", "description": "testacct", "namespace": "test", "password": "123456", "storageQuota": 10 }
- Test steps
Delete project (admin only)
- Test steps
- ndslabsctl delete project <project>
- Expected results
- Prompted for admin password
- Project is deleted
- Alternate flows:
- Project does not exist (404 not found)
Incorrect admin password (401 unauthorized)
- Test steps
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)
- Problem: Can only get details of currently logged in project -> admin user can no longer get project details
- Project is not current project (401 unauthorized)
- Project does not exist (404)
- Preconditions
List projects
- Test steps
- ndslabsctl list projects
- Expected results
- Prompted for admin password
- Projects are listed
- Alternate flows:
- Incorrect admin password (401 unauthorized)
Authentication/authorization
Login
Preconditions:
Project has been created
- Test steps:
- ndslabsctl login <user>
- Prompted for password
- Expected results:
- Login succeeded
- Alternative flows
- Invalid username / password (401 unauthorized)
- 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
- Possible Issues:
- It is possible to execute login while already logged in.
- This may be intentional to allow you to easily switch namespaces.
- It is possible to execute login while already logged in.
Logout
- Preconditions
- User is logged in
- Test steps
- ndslabsctl logout
- ndslabsctl list services
- Expected results:
- List command results in "unauthorized"
- Issues
- Attempting to logout without logging in first yields:
"Error removing passwd data: remove /home/core/.apictl/.passwd: no such file or directory"
- Attempting to logout without logging in first yields:
Change password
- Preconditions:
- User is logged in
- Test steps
- ndslabsctl login <user>
- ndslabsctl passwd
- Enter current password
- Enter new password
- Confirm new password
- Alternate flows:
- User not logged in (401 unauthorized)
- Password mismatch yield error message: "Passwords do not match"
- Expected results
- Password is changed
Service administration
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)
- Preconditions
List services
- Preconditions
- User is logged in
- Test steps
- ndslabsctl list services
- Expected results
- Services are listed
- Alternate flows:
- User not logged in (401 unauthorized)
Add service (admin only)
- Test steps
- ndslabsctl add service -f <service.json>
- ndslabsctl add service --file <service.json>
- Expected results
- Prompted for admin password
- Service is added
- "ndslabsctl list services" now shows added service
- Alternate flows
- Service exists with same key (409 conflict)
- Problem: value is replaced in etcd instead of error thrown - this may be intentional
- Should not replace service if being used in a stack
- Prompt for confirmation on replace?
- Problem: value is replaced in etcd instead of error thrown - this may be intentional
- Incorrect admin password (401 unauthorized)
- Service exists with same key (409 conflict)
- Sample Data:
{ "key": "whalesay", "label": "Docker Whalesay Example", "image": "ndslabs/cowsay-php", "description": "An example of a custom spec loaded into NDSLabs", "isStack": true, "isService": true, "isPublic": true, "isStandalone": true, "ports": [ { "port": 80, "protocol": "http" } ] }
- Test steps
Delete service (admin only)
- Test steps
- ndslabsctl delete service <key>
- Expected results
- Prompted for admin password
- Service is deleted
- "ndslabsctl list services" no longer shows deleted service
- Alternate flows:
- Incorrect admin password (401 unauthorized)
- Service is in use by projects (409)
- Service required by other services (409)
- No such service (404)
- Test steps
Volume administration
Create volume
- Preconditions
- Logged in
- Sufficient quota remaining (not implemented)
- Service exists with no existing attachments
- Service not running
- Test steps
- ndslabsctl add volume <vol name> <vol size GB>
- Creates a detached volume
- ndslabsctl add volume <vol name> <vol size GB> <sid>
- Creates and attaches volume
- ndslabsctl add volume <vol name> <vol size GB>
- Expected results
- Volume is created
- Volume is created and attached
- Alternate flows
- Not logged in (401)
- Insufficient quota (409) (not implemented)
- Duplicate name (409)
- Stack service already has a volume attached (409)
- Stack service doesn't exist (404)
- Preconditions
Attach volume
- Preconditions:
- Logged in
- Volume exists
- 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 flows
- Not logged in (401)
- Volume doesn't exist (404)
- Service doesn't exist (404)
- Service is running (409)
- Volume is attached (409)
- Problem: Reattaches volume to new service without throwing error
- Issues:
- It is possible to attach a single volume to any kind of service. This may be intentional.
- Preconditions:
List volumes
- Preconditions
- Logged in
- Volumes exist
- Test steps
- ndslabsctl list volumes
- Expected results
- Volume details are displayed
- Alternate flows
- Not logged in (401)
- No volumes exist (200)
- Preconditions
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 flows
- Not logged in (401)
- Volume doesn't exist (404)
- Stack is running (409)
- Problem: Was able to detach from running stack without error
- Volume isn't attached (409)
- Problem: Was able to detach multiple times without error
- Problem: Was able to detach multiple times without error
- Preconditions
Delete volume
- Preconditions
- Logged in
- Volume exists
- Stack not running
- Test case:
- ndslabsctl delete <vol name>
- Expected results:
- Volume is deleted
- Alternative flows
- Not logged in (401)
- Volume doesn't exist (404)
- Stack is running (409)
- Preconditions
Stack administration
- Admin user can create / start / stop stacks. We will need to revisit the workflow for admin.
- Resolution: Admin user can no longer login. User is prompted for admin password for add/delete project/service.
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 flows
- Not logged in (401)
- Service doesn't exist (404)
- Duplicate stack name (409)
- Preconditions
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)
- Preconditions:
Delete stack
- Preconditions:
- Logged in
- Stack exists
- Stack not running
- Test steps
- ndslabsctl delete stack <sid>
- Stack is deleted (201)
- Alternate flows
- Not logged in (401)
- Stack doesn't exist (404)
- Stack is running (409)
- Attached volumes are orphaned
- Preconditions:
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 flows
- Not logged in (401)
- Stack doesn't exist (404)
- Preconditions:
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 flows
- Not logged in (401)
- Stack doesn't exist (404)
- Stack not started or stopping (409)
- Preconditions
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)
- Preconditions
Configuration
List configuration options for spec
- Preconditions
- Logged in
- Service exists
- Test case:
- ndslabsctl list configs <service key(s)>
- Expected results:
- Possible service configuration options are displayed
- Alternative flow
- Not logged in (401)
- Service does not exist (404)
- Problem: currently throws 500 error
- Issues:
- Help text references "service ids", should be "service keys" for consistency
- Preconditions
Get stack service configuration
- Preconditions
- Logged in
- Stack exists
- Test case:
- ndslabsctl get stack <stack id>
- Expected results:
- Current service configuration options and settings are displayed
- Alternative flow
- Not logged in (401)
- Stack does not exist (404)
- Problem: currently throws 500 error
- Preconditions
Set stack service configuration option
- Preconditions
- Logged in
- Stack exists
- Config exists
- Test case:
- ndslabsctl set <service id> <name> <value>
- Expected results:
- Specified configuration setting os overriden for the service
- Alternative flow
- Not logged in (401)
- Stack doesn't exist (404)
- Problem: currently throws 500 error
Config doesn't exist or is not overridable (409)
- Problem: No output given, appears to be no-op?
- Preconditions
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)
- Problem: currently throws 500 error
- Stack is not running (404)
- Problem: No output given, appears to be no-op?
- Preconditions
Other problems:
- Volumes are referred by name not ID
- Quota stuff