-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement tests for the VCH Creation API
- Loading branch information
Showing
4 changed files
with
181 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
tests/test-cases/Group23-VIC-Machine-Service/23-03-VCH-Create.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Test 23-03 - VCH Create | ||
======= | ||
|
||
# Purpose: | ||
To verify vic-machine-server can create a VCH with a specified configuration | ||
|
||
# References: | ||
1. [The design document](../../../doc/design/vic-machine/service.md) | ||
|
||
# Environment: | ||
This test requires a vSphere system where VCHs can be deployed | ||
|
||
# Test Steps: | ||
1. Create a VCH with as minimal a configuration as possible | ||
2. Inspect that VCH using the CLI | ||
3. Create a VCH with a more complex configuration | ||
4. Inspect that VCH using the CLI | ||
|
||
# Expected Outcome: | ||
* The results of 2 should contain the same information as was supplied when the VCH was created in 1. | ||
* The results of 4 should contain the same information as was supplied when the VCH was created in 3. | ||
|
||
# Possible Problems: | ||
None known |
143 changes: 143 additions & 0 deletions
143
tests/test-cases/Group23-VIC-Machine-Service/23-03-VCH-Create.robot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
# 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-03 - VCH Create | ||
Resource ../../resources/Util.robot | ||
Resource ../../resources/Group23-VIC-Machine-Service-Util.robot | ||
Suite Setup Setup | ||
Suite Teardown Teardown | ||
Default Tags | ||
|
||
|
||
*** Keywords *** | ||
Setup | ||
Start VIC Machine Server | ||
Set Test Environment Variables | ||
|
||
|
||
Teardown | ||
Terminate All Processes kill=True | ||
|
||
|
||
Create VCH | ||
[Arguments] ${data} | ||
Post Path Under Target vch ${data} | ||
|
||
|
||
Count VCHs | ||
Get Path Under Target vch | ||
${count}= Run echo '${OUTPUT}' | jq -r '.vchs | length' | ||
${count}= Convert To Integer ${count} | ||
[Return] ${count} | ||
|
||
|
||
*** Test Cases *** | ||
Create minimal VCH | ||
${before}= Count VCHs | ||
${expected}= Evaluate ${before}+1 | ||
Log To Console Found ${before} VCHs, expecting ${expected} after the following creation. | ||
|
||
Create VCH '{"name":"%{VCH-NAME}-api-test-minimal","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"%{PUBLIC_NETWORK}"}}},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' | ||
|
||
Verify Return Code | ||
Verify Status 201 | ||
|
||
${after}= Count VCHs | ||
Should Be Equal As Integers ${expected} ${after} | ||
|
||
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux inspect config --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --name=%{VCH-NAME}-api-test-minimal --format raw | ||
Should Be Equal As Integers ${rc} 0 | ||
|
||
Should Contain ${output} --image-store=ds://%{TEST_DATASTORE} | ||
Should Contain ${output} --bridge-network=%{BRIDGE_NETWORK} | ||
|
||
[Teardown] Run Secret VIC Machine Delete Command %{VCH-NAME}-api-test-minimal | ||
|
||
|
||
Create complex VCH | ||
${before}= Count VCHs | ||
${expected}= Evaluate ${before}+1 | ||
Log To Console Found ${before} VCHs, expecting ${expected} after the following creation. | ||
|
||
Create VCH '{"name":"%{VCH-NAME}-api-test-complex","debug":3,"compute":{"cpu":{"limit":{"units":"MHz","value":2345},"reservation":{"units":"GHz","value":2},"shares":{"level":"high"}},"memory":{"limit":{"units":"MiB","value":1200},"reservation":{"units":"MiB","value":501},"shares":{"number":81910}},"resource":{"name":"%{TEST_RESOURCE}"}},"endpoint":{"cpu":{"sockets":2},"memory":{"units":"MiB","value":3072}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"],"volume_stores":[{"datastore":"ds://%{TEST_DATASTORE}/test-volumes/foo","label":"foo"}],"base_image_size":{"units":"B","value":16000000}},"network":{"bridge":{"ip_range":"172.16.0.0/12","port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"%{PUBLIC_NETWORK}"}}},"registry":{"image_fetch_proxy":{"http":"http://example.com","https":"https://example.com"},"insecure":["https://insecure.example.com"],"whitelist":["10.0.0.0/8"]},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' | ||
|
||
Verify Return Code | ||
Verify Status 201 | ||
|
||
${after}= Count VCHs | ||
Should Be Equal As Integers ${expected} ${after} | ||
|
||
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux inspect config --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --name=%{VCH-NAME}-api-test-complex --format raw | ||
Should Be Equal As Integers ${rc} 0 | ||
|
||
Should Contain ${output} --debug=3 | ||
|
||
Should Contain ${output} --cpu=2345 | ||
Should Contain ${output} --cpu-reservation=2000 | ||
Should Contain ${output} --cpu-shares=high | ||
Should Contain ${output} --memory=1200 | ||
Should Contain ${output} --memory-reservation=501 | ||
Should Contain ${output} --memory-shares=81910 | ||
|
||
Should Contain ${output} --endpoint-cpu=2 | ||
Should Contain ${output} --endpoint-memory=3072 | ||
|
||
Should Contain ${output} --image-store=ds://%{TEST_DATASTORE} | ||
Should Contain ${output} --volume-store=ds://%{TEST_DATASTORE}/test-volumes/foo:foo | ||
Should Contain ${output} --base-image-size=16MB | ||
|
||
Should Contain ${output} --bridge-network=%{BRIDGE_NETWORK} | ||
|
||
Should Contain ${output} --insecure-registry=https://insecure.example.com | ||
Should Contain ${output} --whitelist-registry=10.0.0.0/8 | ||
Should Contain ${output} --whitelist-registry=https://insecure.example.com | ||
|
||
[Teardown] Run Secret VIC Machine Delete Command %{VCH-NAME}-api-test-complex | ||
|
||
|
||
Fail to create VCH with invalid operations credentials | ||
Create VCH '{"name":"%{VCH-NAME}-api-bad-ops","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"endpoint":{"operations_credentials":{"user":"invalid","password":"invalid"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"%{PUBLIC_NETWORK}"}}},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' | ||
|
||
Verify Return Code | ||
Verify Status 400 | ||
|
||
Should Contain ${output} operations credentials | ||
|
||
|
||
Fail to create VCH with invalid datastore | ||
Create VCH '{"name":"%{VCH-NAME}-api-bad-datastore","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}-invalid"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"%{PUBLIC_NETWORK}"}}},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' | ||
|
||
Verify Return Code | ||
Verify Status 400 | ||
|
||
Should Contain ${output} datastore | ||
|
||
|
||
Fail to create VCH with invalid compute | ||
Create VCH '{"name":"%{VCH-NAME}-api-bad-compute","compute":{"resource":{"name":"%{TEST_RESOURCE}-invalid"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"%{PUBLIC_NETWORK}"}}},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' | ||
|
||
Verify Return Code | ||
Verify Status 400 | ||
|
||
Should Contain ${output} compute resource | ||
|
||
|
||
Fail to create VCH without network | ||
Create VCH '{"name":"%{VCH-NAME}-api-bad-network","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' | ||
|
||
Verify Return Code | ||
Verify Status 400 | ||
|
||
Should Contain ${output} network |