Skip to content

Commit

Permalink
basic VCH API inspect tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AngieCris committed May 3, 2018
1 parent a93702b commit fc10c0a
Show file tree
Hide file tree
Showing 3 changed files with 174 additions and 14 deletions.
23 changes: 10 additions & 13 deletions tests/resources/Group23-VIC-Machine-Service-Util.robot
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*** Settings ***
Documentation This resource contains keywords which are helpful for using curl to test the vic-machine API.

*** Variables ***
${HTTP_PORT} 1337
${HTTPS_PORT} 31337
Expand Down Expand Up @@ -78,6 +77,11 @@ Delete Path Under Target
Set Test Variable ${OUTPUT}
Set Test Variable ${STATUS}

Get Service Version String
${rc} ${output}= Run And Return Rc And Output curl -s -w "\n\%{http_code}\n" -X GET "http://127.0.0.1:${HTTP_PORT}/container/version"
${output} ${status}= Split String From Right ${output} \n 1
[Return] ${output}


Verify Return Code
Should Be Equal As Integers ${RC} 0
Expand Down Expand Up @@ -146,15 +150,8 @@ Property Should Not Be Empty
${actual}= Run echo '${OUTPUT}' | jq -r '${jq}'
Should Not Be Empty ${actual}

Verify VCH List Empty
${vchs}= Run echo '${OUTPUT}' | jq -r '.vchs[]'
Log ${vchs}
Length Should Be ${vchs} 0

Get Docker Params API
[Arguments] ${vch_name}
Get Path Under Target vch
${docker_host}= Run echo '${OUTPUT}' | jq -r '.vchs[] | select(.name=="${vch_name}").docker_host'
Set Test Variable ${docker_host}
Should Not Be Empty ${docker_host}
Should Not Be Equal ${docker_host} null
Property Length Should Be
[Arguments] ${jq} ${expected}

${actual}= Run echo '${OUTPUT}' | jq '${jq} | length'
Should Be Equal As Integers ${actual} ${expected}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ Verify VCH Power State
[Arguments] ${expected}
Property Should Be Equal .vchs[] | select(.name=="%{VCH-NAME}").power_state ${expected}

Verify VCH List Empty
Property Length Should Be .vchs 0


*** Test Cases ***
Get VCH List
Expand Down Expand Up @@ -99,7 +102,6 @@ Verify VCH List Power States
Get VCH List
Verify VCH Power State poweredOff


# TODO: Add test for compute resource (once relevant code is updated to use ID instead of name)
# TODO: Add test for compute resource within datacenter (once relevant code is updated to use ID instead of name)

Expand All @@ -120,3 +122,15 @@ Get VCH List Within Invalid Datacenter and Compute Resource

Verify Return Code
Verify Status Not Found

Get Empty VCH List When No VCH deployed
Cleanup VIC Appliance On Test Server

Get VCH List

Verify Return Code
Verify Status Ok

Verify VCH List Empty

[Teardown] NONE
149 changes: 149 additions & 0 deletions tests/test-cases/Group23-VIC-Machine-Service/23-04-VCH-Inspect.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# Copyright 2017 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License

*** Settings ***
Documentation Test 23-04 - VCH Inspect
Resource ../../resources/Util.robot
Resource ../../resources/Group23-VIC-Machine-Service-Util.robot
Suite Setup Setup
Suite Teardown Teardown

Default Tags

*** Keywords ***
Install VIC Appliance With Ops Credentials
Install VIC Appliance To Test Server certs=${true} additional-args=--ops-user=%{VCH_OPS_USERNAME} --ops-password=%{VCH_OPS_PASSWORD} --ops-grant-perms --debug 1

Setup
Start VIC Machine Server
Install VIC Appliance With Ops Credentials

${id}= Get VCH ID %{VCH-NAME}
${dc-id}= Get Datacenter ID

Set Suite Variable ${VCH-ID} ${id}
Set Suite Variable ${DC-ID} ${dc-id}

Teardown
Cleanup VIC Appliance On Test Server
Terminate All Processes kill=True

Inspect VCH
Get Path Under Target vch/${VCH-ID}

Inspect VCH Using Session
Get Path Under Target Using Session vch/${VCH-ID}

Inspect VCH Within Datacenter
Get Path Under Target datacenter/${DC-ID}/vch/${VCH-ID}

Inspect VCH Within Datacenter Using Session
Get Path Under Target Using Session datacenter/${DC-ID}/vch/${VCH-ID}

Verify VCH Inspect Output
# basic
Property Should Be Equal .debug 1
Property Should Be Equal .name %{VCH-NAME}

# networks
Property Should Be Equal .network.bridge.ip_range 172.16.0.0/12
Property Should Not Be Empty .network.bridge.port_group
Property Should Be Equal .network.public.nameservers[0] null
Property Should Not Be Empty .network.public.port_group
Property Should Be Equal .network.container[0].alias public
Property Should Not Be Empty .network.container[0].port_grou

# cert
${domain}= Get Environment Variable DOMAIN ''
Run Keyword If $domain != '' Property Should Contain .auth.server.certificate.pem -----BEGIN CERTIFICATE-----
Property Should Be Equal .auth.server.private_key.pem null

# compute
Property Should Not Be Empty .compute.resource.id

# storage
Property Should Be Equal .storage.base_image_size.value 8000000
Property Should Be Equal .storage.base_image_size.units KB

Property Length Should Be .storage.image_stores 1
Property Should Contain .storage.image_stores[0] %{TEST_DATASTORE}
Property Length Should Be .storage.volume_stores 1
Property Should Contain .storage.volume_stores[0].datastore %{TEST_DATASTORE}/%{VCH-NAME}-VOL
Property Should Be Equal .storage.volume_stores[0].label default

# ops creds
Property Should Be Equal .endpoint.operations_credentials.user %{VCH_OPS_USERNAME}
Property Should Be Equal .endpoint.operations_credentials.password null
Property Should Be Equal .endpoint.operations_credentials.grant_permissions true

# connection
Property Should Be Equal .runtime.docker_host %{DOCKER_HOST}
Property Should Be Equal .runtime.admin_portal %{VIC-ADMIN}
Property Should Be Equal .runtime.power_state poweredOn
Property Should Contain .runtime.upgrade_status Up to date

# version
${version}= Get Service Version String
Property Should Be Equal .version ${version}


*** Test Cases ***
Get VCH
Inspect VCH

Verify Return Code
Verify Status Ok
Verify VCH Inspect Output


Get VCH Using Session
Inspect VCH Using Session

Verify Return Code
Verify Status Ok
Verify VCH Inspect Output


Get VCH Within Datacenter
Inspect VCH Within Datacenter

Verify Return Code
Verify Status Ok
Verify VCH Inspect Output


Get VCH Within Datacenter Using Session
Inspect VCH Within Datacenter Using Session

Verify Return Code
Verify Status Ok
Verify VCH Inspect Output


Get VCH Within Invalid Datacenter
Get Path Under Target datacenter/INVALID/vch/${VCH-ID}

Verify Return Code
Verify Status Not Found


Get Invalid VCH
Get Path Under Target /vch/INVALID

Verify Return Code
Verify Status Not Found


Get Invalid VCH Within Datacenter
Get Path Under Target /datacenter/${DC-ID}/vch/INVALID

0 comments on commit fc10c0a

Please sign in to comment.