You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by jv...@redhat.com on 2013/03/06 23:49:03 UTC
[PATCH] SITE: Improvements Add white box unit test description.
From: Joe VLcek <jv...@redhat.com>
Including descriptions for excution and re-recording of
the VCR fixture YAML data.
---
site/content/how-to-contribute.md | 3 +
site/content/running-the-white-box-tests.md | 59 ++++
.../update-vcr-test-fixtures-data-example.md | 179 ++++++++++++
site/content/white-box-tests-layout.md | 141 ++++++++++
site/content/white-box-tests.md | 55 ++++
site/content/why-update-vcr-test-fixtures-data.md | 109 ++++++++
site/output/how-to-contribute.html | 10 +-
site/output/running-the-white-box-tests.html | 183 ++++++++++++
.../update-vcr-test-fixtures-data-example.html | 311 +++++++++++++++++++++
site/output/white-box-tests-layout.html | 265 ++++++++++++++++++
site/output/white-box-tests.html | 180 ++++++++++++
site/output/why-update-vcr-test-fixtures-data.html | 233 +++++++++++++++
12 files changed, 1723 insertions(+), 5 deletions(-)
create mode 100644 site/content/running-the-white-box-tests.md
create mode 100644 site/content/update-vcr-test-fixtures-data-example.md
create mode 100644 site/content/white-box-tests-layout.md
create mode 100644 site/content/white-box-tests.md
create mode 100644 site/content/why-update-vcr-test-fixtures-data.md
create mode 100644 site/output/running-the-white-box-tests.html
create mode 100644 site/output/update-vcr-test-fixtures-data-example.html
create mode 100644 site/output/white-box-tests-layout.html
create mode 100644 site/output/white-box-tests.html
create mode 100644 site/output/why-update-vcr-test-fixtures-data.html
diff --git a/site/content/how-to-contribute.md b/site/content/how-to-contribute.md
index 8487851..b9ebab2 100644
--- a/site/content/how-to-contribute.md
+++ b/site/content/how-to-contribute.md
@@ -26,6 +26,9 @@ Deltacloud project is a free open source software licensed under the <a href="ht
<li>
<a href="#documentation">Write documentation</a>
</li>
+ <li>
+ <a href="/white-box-tests.html">Validate contributions using the white box tests</a>
+ </li>
</ul>
<br/>
diff --git a/site/content/running-the-white-box-tests.md b/site/content/running-the-white-box-tests.md
new file mode 100644
index 0000000..542cd34
--- /dev/null
+++ b/site/content/running-the-white-box-tests.md
@@ -0,0 +1,59 @@
+---
+site_name: Deltacloud API
+title: Running the Whitebox Tests
+---
+
+<br/>
+
+<ul class="breadcrumb">
+ <li>
+ <a href="white-box-tests.html">White Box Tests?</a> <span class="divider">/</span>
+ </li>
+ <li class="active">Running The White Box Tests</li>
+</ul>
+
+<h3>Running the white box tests</h3>
+
+<p>The tests can be executed in groups, using tasks in the Rakefile, or
+ individually.</p>
+
+<ul>
+ <li>
+ <p>Examples using rake tasks to executed groups of tests.</p>
+ </li>
+
+ <ul>
+ <li>
+ <p>Rake task to run <b><u><i>all</i></u></b> the tests: </p>
+ <pre>
+ % rake test # Run all tests
+ </pre>
+ </li>
+
+ <li>
+ <p>Rake task to run the various <b><u><i>Frontend </i></u></b> tests: </p>
+ <pre>
+ % rake test:base # Run tests for base
+ % rake test:cimi:models # Run tests for models
+ % rake test:ec2 # Run tests for ec2
+ </pre>
+ </li>
+
+ <li>
+ <p>Rake task to run the various <b><u><i>Driver </i></u></b> tests: </p>
+ <pre>
+ % rake test:drivers:ec2 # Run tests for ec2
+ % rake test:drivers:mock # Run tests for mock
+ % rake test:drivers:rhevm # Run tests for rhevm
+ </pre>
+ </li>
+ </ul>
+
+ <li>
+ <p>Example manually running an <b><u><i>individual</i></u></b> test: </p>
+ <pre>
+ % bundle exec ruby tests/drivers/ec2/realms_test.rb
+ </pre>
+ </li>
+
+</ul>
diff --git a/site/content/update-vcr-test-fixtures-data-example.md b/site/content/update-vcr-test-fixtures-data-example.md
new file mode 100644
index 0000000..7942b60
--- /dev/null
+++ b/site/content/update-vcr-test-fixtures-data-example.md
@@ -0,0 +1,179 @@
+---
+site_name: Deltacloud API
+title: Updating VCR Fixtures Example
+---
+
+<br/>
+
+<ul class="breadcrumb">
+ <li>
+ <a href="white-box-tests.html">White Box Tests?</a> <span class="divider">/</span>
+ </li>
+ <li class="active">Updating VCR Fixtures Example</li>
+</ul>
+
+<h3>An Example of Re-recording the VCR test fixtures.</h3>
+
+<p>
+Below is an example of recording new fixtures for the test:
+<i><u><b>server/tests/drivers/rhevm/instance_test.rb</b></u></i>
+tests.
+<p>
+
+<ol>
+ <li>
+ <p> Create ${HOME}/.deltacloud/config</p>
+
+ <pre>
+ rhevm:
+ user: 'admin@internal'
+ password: 'localpassword'
+ provider: 'https://16.1.1.3/api;b9bb11c2-f397-4f41-a57b-7ac15a894779'
+ mock:
+ user: mockuser
+ password: mockpassword
+ provider: compute
+ </li>
+
+ <li>
+ <p>Modify the test source to have the realm, instance, image & provider
+ for a live cloud provider.</p>
+
+ <pre>
+ % vim server/tests/drivers/rhevm/instance_test.rb
+ ...
+ TST_REALM = '12345678-123a-123b-123c-123456789abc'
+ TST_INSTANCE = '23456781-23a1-23b1-23c1-23456789abce'
+ TST_IMAGE = '34567812-3a12-3b12-3c12-3456789abcef'
+ ...
+ @driver = Deltacloud::Test::config.driver(:rhevm,
+ provider="https://16.1.1.3/api;b9bb11c2-f397-4f41-a57b-7ac15a894779")
+ </pre>
+
+ </li>
+
+ <li>
+ <p>Set the VCR record mode to :record => :all</p>
+
+ <pre>
+ % vim server/tests/drivers/rhevm/common.rb
+ ...
+ # Set :record to :all, when re-recording and between re-record attemps
+ # be sure to clear fixtures/*.yml files which can be done with "git checkout".
+ # e.g.:
+ c.default_cassette_options = { :record => :all }
+ # c.default_cassette_options = { :record => :none }
+ ...
+ </pre>
+
+ </li>
+
+
+ <li>
+ <p>Run the test in record mode</p>
+
+ <pre>
+ % cd YOUR-REPO/deltacloud/server
+
+ # Record only the single test
+ % ruby tests/drivers/rhevm/instance_test.rb
+
+ or
+
+ # Record the drivers:rhevm tests:
+ % rake test:drivers:rhevm
+
+ or
+
+ # Record all the tests:
+ % rake test
+ </pre>
+
+ </li>
+
+ <li>
+ <p>Remove the user:password creds from the fixture.</p>
+
+ <p>
+ The recorded fixture will contain live creds. For security reasons
+ it is best to either change the credentials on the cloud provider or
+ remove them from the fixture YAML file. Removing them from the fixture
+ YAML file can easily be accomplished using sed.
+ </p>
+
+ <pre>
+ e.g.:
+ for i in $(ls tests/drivers/rhevm/fixtures/test_0*.yml); do \
+ echo $i; \
+ cat $i | sed s/admin%40internal:localpassword/fakeuser:fakepassword/ > $i.new; \
+ mv $i.new $i; \
+ done
+ </pre>
+
+ </li>
+
+ <li>
+ <p>Remove ${HOME}/.deltacloud/config</p>
+
+ <p>
+ This is done to avoid using the credentials from the config file
+ during non-recording test runs.
+ </p>
+
+ <pre>
+ e.g.: (note it might be best to save it in ".ORIG" for future re-recordings.)
+ mv ${HOME}/.deltacloud/config ${HOME}/.deltacloud/config.ORIG
+ </pre>
+ </li>
+
+ <li>
+ <p>Turn off record mode.
+
+ <p>To turn off record mode set the record mode to { :record => :none }</p>
+
+ <pre>
+ % vim server/tests/drivers/rhevm/common.rb
+ ...
+ # Set :record to :all, when re-recording and between re-record attemps
+ # be sure to clear fixtures/*.yml files which can be done with "git checkout".
+ # e.g.:
+ # c.default_cassette_options = { :record => :all }
+ c.default_cassette_options = { :record => :none }
+ ...
+ </pre>
+
+ </li>
+
+ <li>
+ <p>Remove trailing white space from the fixtures YAML files.</p>
+
+ <p>
+ Recording can place trailing white space in the fixtures YAML files
+ which can be removed or ignored.
+ </p>
+
+ <p>There are many ways to accomplish this.</p>
+ </li>
+
+ <li>
+ <p>Confirm all tests run in mock mode</p>
+
+ <pre>
+ % cd <REPO>/deltacloud/server
+
+ # Run only the single tests that had been re-recorded
+ % ruby tests/drivers/rhevm/instance_test.rb
+
+ and
+
+ # Run all tests in that section:
+ % rake test:drivers:rhevm
+
+ and
+
+ # Record all the tests:
+ % rake test
+ </pre>
+ </li>
+
+</ol>
diff --git a/site/content/white-box-tests-layout.md b/site/content/white-box-tests-layout.md
new file mode 100644
index 0000000..9e0bd3f
--- /dev/null
+++ b/site/content/white-box-tests-layout.md
@@ -0,0 +1,141 @@
+---
+site_name: Deltacloud API
+title: White Box Tests Source Description
+---
+
+<br/>
+
+<ul class="breadcrumb">
+ <li>
+ <a href="white-box-tests.html">White Box Tests?</a> <span class="divider">/</span>
+ </li>
+ <li class="active">White Box Tests Source Description</li>
+</ul>
+
+<h3>Where Are The White Box Tests:</h3>
+
+<p>The following depicts where in the deltacloud directory source structure the
+white box tests are located:</p>
+<div class="row">
+ <div class="span1"></div>
+ <div class="span10 offset1">
+<pre>
+deltacloud
+|-----------------------------------------------------------------------------
+|-d--> server
+ |---------------------------------------------------------------------------
+ |-d-->tests Contains unit tests for drivers
+ |---------------------------------------------------------------------------
+ |-d-->cimi Contains Frontend CIMI tests
+ |-------------------------------------------------------------------------
+ |-d-->deltacloud Contains Frontend deltacloud tests
+ |-------------------------------------------------------------------------
+ |-d-->ec2 Contains Frontend ec2 tests
+ |-------------------------------------------------------------------------
+ |-d-->drivers Contains Backend driver gem tests
+ |-------------------------------------------------------------------------
+ |-d-->base
+ |-d-->ec2
+ |-d-->fgcp
+ |-d-->gogrid
+ |-d-->google Contains the varios driver tests
+ |-d-->mock and
+ |-d-->models VCR YAML fixtures
+ |-d-->openstack
+ |-d-->rhevm
+ |-------------------------------------------------------------------------
+ |-d-->helpers Contains helper code common to multiple tests
+ |-------------------------------------------------------------------------
+ |-f-->test_helper.rb Contains the common test helper routes
+ |-------------------------------------------------------------------------
+</pre>
+
+ </div>
+</div>
+
+<br/>
+
+<h3>Driver tests</h3>
+
+<u><b>REPO</b>/deltacloud/server/tests/drivers</u>
+
+<br/>
+
+<p>
+This directory provides all the <i><b>driver</b></i> tests. Each driver tests is
+placed into a separate directory with the driver name. Everything that touchs
+the driver API goes here as well. It is good practice to divide the tests into
+logical collections, in this case driver methods.
+</p>
+
+<p>
+Driver tests use the Deltacloud::new method to create new instance of a driver.
+This method is usually called in a <i>before</i> block and takes two parameters:
+<i>driver name</i> and <i>credentials</i>. The driver methods can be called
+directly on the instance of Deltacloud::new.
+</p>
+
+<p>
+Some driver tests may use the <a href="https://github.com/vcr/vcr">VCR</a> gem
+to record and then mock the real communication with the backend server. The fixtures
+are maintained in the <i>tests/drivers/<b>DRIVER</b>/fixtures</i> directory.
+</p>
+
+<p>
+For more informations about recording, look at the file: <i>tests/drivers/ec2/common.rb</i>,
+<a href="why-update-vcr-test-fixtures-data.html">Why Updating the VCR Fixtures</a>
+and <a href="update-vcr-test-fixtures-data-example.html">Updating VCR Fixtures Example</a>
+</p>
+
+<h3>Test Helpers</h3>
+
+<u><b>REPO</b>/deltacloud/server/tests/helpers</u>
+
+<br/>
+
+<p>
+The <i>base</i> directory contain tests for Deltacloud::Driver class and the Library
+class.
+</p>
+
+<h3>Frontend tests</h3>
+
+<p>
+In addition to the default <i>deltacloud</i> frontend Deltacloud may also
+operate using different frontends. In this case, instead of exposing the
+DC API specification to the client, Deltacloud will provide its drivers
+API through different frontends (like CIMI or Amazon EC2).
+</p>
+
+<p>
+Some tests might use the Mock driver to call the <i>control</i> blocks in Rabbit
+collections. These tests are <b>not</b> driver tests, they just use the mock
+driver to make sure the Rabbit operation <i>control blocks</i> works as expected
+and they provide expected output.
+</p>
+
+<u><b>REPO</b>/deltacloud/server/tests/deltacloud</u>
+
+<p>
+This directory provides tests for Deltacloud API frontend. It contains tests
+for collections that this frontend provides and also tests helpers that this
+frontend use.
+</p>
+
+<u><b>REPO</b>/deltacloud/server/tests/ec2</u>
+
+<p>
+This directory provides tests for the EC2 frontend. Tests make sure that mapping
+between EC2 actions and Deltacloud driver API works correctly. All tests
+relevant to EC2 frontend tests should go here. **NOTE** this directory does not
+provide Amazon EC2 driver tests.
+</p>
+
+<u><b>REPO</b>/deltacloud/server/tests/cimi</u>
+
+<p>
+This directory provides tests for the CIMI frotend. They make sure that
+JSON/XML serialization of the CIMI models works correctly. Also there are tests
+to make sure the output provided by CIMI collections is correct.
+</p>
+
diff --git a/site/content/white-box-tests.md b/site/content/white-box-tests.md
new file mode 100644
index 0000000..8afb32a
--- /dev/null
+++ b/site/content/white-box-tests.md
@@ -0,0 +1,55 @@
+---
+site_name: Deltacloud API
+title: White Box Tests
+---
+
+<br/>
+
+<ul class="breadcrumb">
+ <li>
+ <a href="/how-to-contribute.html#how">How to contribute?</a> <span class="divider">/</span>
+ </li>
+ <li class="active">Validate Contributions Using the White Box Tests</li>
+</ul>
+
+<h3>Validate Contributions Using the White Box Tests</h3>
+
+<p>
+Deltacloud contains automated API tests, that are driven using pre-recorded
+<a href="https://github.com/vcr/vcr">VCR</a> YAML files called <i>fixtures</i>.
+The test source and fixtures are maintained in the deltacloud source tree
+under: <i><b>REPO/deltacloud/server/tests</i>
+</p>
+
+<p>
+In some cases it might be necessarey to re-record the VCR fixtures for
+particular tests. For example, this could become necessarey, if new
+functionality or a bug fix alters the exchange with the backend cloud
+provider.
+</p>
+
+<p>
+The process for updating the test data involves exercising the tests against a live
+cloud provider and recording the live API exchange into the VCR fixtures YAML files.
+After which the tests can more quickly and easily be run using the recorded VCR
+fixtures without the need to accessess a live cloud provider.
+</p>
+
+<h4 id="how">Dealing With the White Box Test</h4>
+
+<ul class="nav nav-list">
+ <li class="nav-header"></li>
+ <li>
+ <a href="/white-box-tests-layout.html">White Box Tests Source Description</a>
+ </li>
+ <li>
+ <a href="/running-the-white-box-tests.html">Running The White Box Tests</a>
+ </li>
+ <li>
+ <a href="/why-update-vcr-test-fixtures-data.html">Why Update The VCR Fixtures?</a>
+ </li>
+ <li>
+ <a href="/update-vcr-test-fixtures-data-example.html">Updating VCR Fixtures Example</a>
+ </li>
+</ul>
+
diff --git a/site/content/why-update-vcr-test-fixtures-data.md b/site/content/why-update-vcr-test-fixtures-data.md
new file mode 100644
index 0000000..ce6e176
--- /dev/null
+++ b/site/content/why-update-vcr-test-fixtures-data.md
@@ -0,0 +1,109 @@
+---
+site_name: Deltacloud API
+title: Why Update The VCR Fixtures
+---
+
+<br/>
+
+<ul class="breadcrumb">
+ <li>
+ <a href="white-box-tests.html">White Box Tests?</a> <span class="divider">/</span>
+ </li>
+ <li class="active">Why Update The VCR Fixtures</li>
+</ul>
+
+<p>
+Deltacloud uses pre-recorded <a href="https://github.com/vcr/vcr">VCR</a> YAML
+files called <i>fixtures</i> to allow test execution without the need for a live
+cloud provider.
+</p>
+
+<p>
+The <i>fixtures</i> YAML files are located under:
+<u><b>REPO</b>/deltacloud/server/tests/drivers/<i>driver name</i>/fixtures</u>
+</p>
+
+<p>
+A live cloud provider, with valid credentials, needs to be used in order to
+<a href="https://www.relishapp.com/vcr/vcr/v/1-6-0/docs/record-modes">record</a>
+the fixtures YAML files but once recorded the tests can then be executed without
+a live cloud provider.
+</p>
+
+<p>
+Because valid credentials are used to record the VCR fixtures data care must be
+taken to either alter the credentials on the live cloud provider or remove them
+from the fixtures data after doing the recording.
+More on how to do this can be found in
+<a href="update-vcr-test-fixtures-data-example.html">Updating VCR Fixtures Example</a>
+</p>
+
+<h3>Why VCR data May Need Updating:</h3>
+
+<p>
+In some cases you will need to re-record the VCR fixtures for particular test.
+This happen when a request is made to the backend cloud provider that a
+test does not yet exercise. <b>For Example:</b>
+</p>
+
+<ul>
+ <li>
+ <p>
+ A bug is fixed in the EC2 driver, where <i>images()</i> method had not work properly.
+ </p>
+ <ol>
+ <li>
+ <p>Open <i>tests/drivers/ec2/images_tests.rb</i></p>
+ </li>
+ <li>
+ <p>Add a new test to capture this bug.</p>
+ <p>At the end of this file and add a the new code:</p>
+ <pre>
+ it 'should provide correct output' do
+ # assertions go here
+ end
+ </pre>
+ </li>
+ </ol>
+ </li>
+
+ <li>
+ <p>
+ Scenario: You added new collection <i>oranges()</i> into RHEV-M driver.
+ </p>
+ <ol>
+ <li>
+ <p>Write all driver methods tests here: <i>tests/drivers/rhevm/oranges_tests.rb</i></p>
+ </li>
+ <li>
+ <p>Create <i>tests/deltacloud/collections/oranges_collection_tests.rb</i></p>
+ </li>
+ <li>
+ <p>Write all collection operations tests here ^^</p>
+ </li>
+ </ol>
+ </li>
+
+ <li>
+ <p>
+ A bug is fixed in the Deltacloud frontend where <i>/api/images/123/create</i>
+ operation does not provide correct status code. You corrected it.
+ </p>
+ <ol>
+ <li>
+ <p>Open 'tests/deltacloud/collections/images_collection_test.rb'</p>
+ </li>
+ <li>
+ <p>Locate this line: </p>
+ <pre>
+ it 'allow to create and destroy the new image' do</p>
+ </pre>
+ </li>
+ <li>
+ <p>Provide the correct value into 'status.must_equal' method</p>
+ </li>
+ </ol>
+ </li>
+
+</ul>
+
diff --git a/site/output/how-to-contribute.html b/site/output/how-to-contribute.html
index 08a8664..1bbf70c 100644
--- a/site/output/how-to-contribute.html
+++ b/site/output/how-to-contribute.html
@@ -103,7 +103,7 @@
<h4 id="how">How can I contribute?</h4>
<ul class="nav nav-list">
- <li class="nav-header">
+<li class="nav-header">
</li>
<li>
<a href="send-patch.html">Send a patch</a>
@@ -120,9 +120,10 @@
<li>
<a href="#documentation">Write documentation</a>
</li>
-</ul>
-
-<p><br></p>
+ <li>
+ <a href="white-box-tests.html">Validate contributions using the white box tests</a>
+ </li>
+</ul><p><br></p>
<h3>Overview of the Deltacloud directory structure</h3>
@@ -182,7 +183,6 @@ deltacloud
<h3 id="documentation">Writing documentation</h3>
<p>You can also contribute with a piece of documentation. There are still things which needs to be described. If you found one like that and you are interested in writing a couple of sentences about the particular issue, please, don’t hesitate to do it and <a href="http://mail-archives.apache.org/mod_mbox/deltacloud-dev/">send us</a> your contribution. We really appreciate your help.</p>
-
<footer class="footer">
<p class="pull-right"><span class='icon-circle-arrow-up'> </span><a href="#">Back to top</a></p>
<div class='row'>
diff --git a/site/output/running-the-white-box-tests.html b/site/output/running-the-white-box-tests.html
new file mode 100644
index 0000000..efb8ea7
--- /dev/null
+++ b/site/output/running-the-white-box-tests.html
@@ -0,0 +1,183 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <title>Running the Whitebox Tests</title>
+ <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
+ <!--[if lt IE 9]>
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+ <![endif]-->
+
+ <!-- Le JavaScript -->
+ <script src="/assets/js/jquery-1.7.1.min.js" type="text/javascript"></script>
+ <script src="/assets/js/bootstrap-dropdown.js" type="text/javascript"></script>
+ <script src="/assets/js/jquery.tweet.js" type="text/javascript"></script>
+ <script src="/assets/js/application.js" type="text/javascript"></script>
+ <script src="/assets/js/bootstrap-transition.js"></script>
+ <script src="/assets/js/bootstrap-alert.js"></script>
+ <script src="/assets/js/bootstrap-modal.js"></script>
+ <script src="/assets/js/bootstrap-scrollspy.js"></script>
+ <script src="/assets/js/bootstrap-tab.js"></script>
+ <script src="/assets/js/bootstrap-tooltip.js"></script>
+ <script src="/assets/js/bootstrap-popover.js"></script>
+ <script src="/assets/js/bootstrap-button.js"></script>
+ <script src="/assets/js/bootstrap-collapse.js"></script>
+ <script src="/assets/js/bootstrap-carousel.js"></script>
+ <script src="/assets/js/bootstrap-typeahead.js"></script>
+
+ <!-- Le styles -->
+ <link href="/assets/css/bootstrap.css" rel="stylesheet">
+ <link href="/assets/css/application.css" rel="stylesheet">
+ <link rel="shortcut icon" href="/assets/img/favicon.ico">
+ </head>
+
+ <body>
+
+ <div class="navbar navbar-fixed-top">
+ <div class="navbar-inner">
+ <div class="container">
+ <a class="brand" href="/"><img src="/assets/img/logo.png" width="152"
+ alt="Deltacloud API"/></a>
+ <ul class="nav top-nav">
+ <li><a href="/">Home</a></li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">About<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/about.html">What is Deltacloud?</a></li>
+ <li><a href="/supported-providers.html">Supported Providers</a></li>
+ </ul>
+ </li>
+ <li><a href="/download.html">Download</a></li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">Installation<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/install-deltacloud.html">Install Deltacloud</a></li>
+ <li><a href="/run-deltacloud-server.html">Run the Deltacloud Server</a></li>
+ </ul>
+ </li>
+ <li class="dropdown">
+ <a href="/usage.html" class="dropdown-toggle" data-toggle="dropdown">Usage<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/usage.html#usingapi">Using API</a></li>
+ <li><a href="/usage.html#clients">Client Libraries</a></li>
+ <li><a href="/command-tools.html">Command Line Tools</a></li>
+ </ul>
+ </li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">Contribute<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/getting-sources.html">Getting Sources</a></li>
+ <li><a href="/how-to-contribute.html">How Can I Contribute?</a></li>
+ </ul>
+ </li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">API<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/rest-api.html">Deltacloud REST API</a></li>
+ <li><a href="/curl-examples.html">Deltacloud API cURL examples</a></li>
+ <li><a href="/drivers.html">Drivers API</a></li>
+ </ul>
+ </li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">CIMI<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/cimi-rest.html">CIMI REST API</a></li>
+ <li><a href="/cimi-curl.html">CIMI cURL Examples</a></li>
+ </ul>
+ </li>
+ <li><a href="/contact.html">Contact</a></li>
+</ul>
+
+ </div>
+ </div>
+
+ </div>
+
+ <div class="container content">
+
+ <p><br></p>
+
+<ul class="breadcrumb">
+<li>
+ <a href="white-box-tests.html">White Box Tests?</a> <span class="divider">/</span>
+ </li>
+ <li class="active">Running The White Box Tests</li>
+</ul><h3>Running the white box tests</h3>
+
+<p>The tests can be executed in groups, using tasks in the Rakefile, or
+ individually.</p>
+
+<ul>
+<li>
+ <p>Examples using rake tasks to executed groups of tests.</p>
+ </li>
+
+ <ul>
+<li>
+ <p>Rake task to run <b><u><i>all</i></u></b> the tests: </p>
+ <pre>
+ % rake test # Run all tests
+ </pre>
+ </li>
+
+ <li>
+ <p>Rake task to run the various <b><u><i>Frontend </i></u></b> tests: </p>
+ <pre>
+ % rake test:base # Run tests for base
+ % rake test:cimi:models # Run tests for models
+ % rake test:ec2 # Run tests for ec2
+ </pre>
+ </li>
+
+ <li>
+ <p>Rake task to run the various <b><u><i>Driver </i></u></b> tests: </p>
+ <pre>
+ % rake test:drivers:ec2 # Run tests for ec2
+ % rake test:drivers:mock # Run tests for mock
+ % rake test:drivers:rhevm # Run tests for rhevm
+ </pre>
+ </li>
+ </ul>
+<li>
+ <p>Example manually running an <b><u><i>individual</i></u></b> test: </p>
+ <pre>
+ % bundle exec ruby tests/drivers/ec2/realms_test.rb
+ </pre>
+ </li>
+
+</ul>
+
+ <footer class="footer">
+ <p class="pull-right"><span class='icon-circle-arrow-up'> </span><a href="#">Back to top</a></p>
+ <div class='row'>
+ <div class='span3'>
+ <img src="/assets/img/asf.png" alt="Apache Software Foundation"/>
+ </div>
+ <div class='span9'>
+ <strong>Apache Deltacloud</strong> is a top-level project at the <a
+ href="http://www.apache.org">Apache Software Foundation</a>,
+ having graduated from the ASF Incubator in October
+ 2011. Through a collaborative and meritocratic development process, Apache
+ projects deliver enterprise-grade, freely available software products that
+ attract large communities of users.
+ </div>
+ </div>
+ </footer>
+
+ </div> <!-- /container -->
+
+<!-- Piwik -->
+<script type="text/javascript">
+var pkBaseURL = (("https:" == document.location.protocol) ? "https://stats.salasaga.org/aeolus/piwik/" : "http://stats.salasaga.org/aeolus/piwik/");
+document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
+</script><script type="text/javascript">
+try {
+var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 2);
+piwikTracker.trackPageView();
+piwikTracker.enableLinkTracking();
+} catch( err ) {}
+</script><noscript><p><img src="http://stats.salasaga.org/aeolus/piwik/piwik.php?idsite=2" style="border:0" alt="" /></p></noscript>
+<!-- End Piwik Tracking Code -->
+
+ </body>
+</html>
diff --git a/site/output/update-vcr-test-fixtures-data-example.html b/site/output/update-vcr-test-fixtures-data-example.html
new file mode 100644
index 0000000..ef709b6
--- /dev/null
+++ b/site/output/update-vcr-test-fixtures-data-example.html
@@ -0,0 +1,311 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <title>Updating VCR Fixtures Example</title>
+ <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
+ <!--[if lt IE 9]>
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+ <![endif]-->
+
+ <!-- Le JavaScript -->
+ <script src="/assets/js/jquery-1.7.1.min.js" type="text/javascript"></script>
+ <script src="/assets/js/bootstrap-dropdown.js" type="text/javascript"></script>
+ <script src="/assets/js/jquery.tweet.js" type="text/javascript"></script>
+ <script src="/assets/js/application.js" type="text/javascript"></script>
+ <script src="/assets/js/bootstrap-transition.js"></script>
+ <script src="/assets/js/bootstrap-alert.js"></script>
+ <script src="/assets/js/bootstrap-modal.js"></script>
+ <script src="/assets/js/bootstrap-scrollspy.js"></script>
+ <script src="/assets/js/bootstrap-tab.js"></script>
+ <script src="/assets/js/bootstrap-tooltip.js"></script>
+ <script src="/assets/js/bootstrap-popover.js"></script>
+ <script src="/assets/js/bootstrap-button.js"></script>
+ <script src="/assets/js/bootstrap-collapse.js"></script>
+ <script src="/assets/js/bootstrap-carousel.js"></script>
+ <script src="/assets/js/bootstrap-typeahead.js"></script>
+
+ <!-- Le styles -->
+ <link href="/assets/css/bootstrap.css" rel="stylesheet">
+ <link href="/assets/css/application.css" rel="stylesheet">
+ <link rel="shortcut icon" href="/assets/img/favicon.ico">
+ </head>
+
+ <body>
+
+ <div class="navbar navbar-fixed-top">
+ <div class="navbar-inner">
+ <div class="container">
+ <a class="brand" href="/"><img src="/assets/img/logo.png" width="152"
+ alt="Deltacloud API"/></a>
+ <ul class="nav top-nav">
+ <li><a href="/">Home</a></li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">About<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/about.html">What is Deltacloud?</a></li>
+ <li><a href="/supported-providers.html">Supported Providers</a></li>
+ </ul>
+ </li>
+ <li><a href="/download.html">Download</a></li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">Installation<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/install-deltacloud.html">Install Deltacloud</a></li>
+ <li><a href="/run-deltacloud-server.html">Run the Deltacloud Server</a></li>
+ </ul>
+ </li>
+ <li class="dropdown">
+ <a href="/usage.html" class="dropdown-toggle" data-toggle="dropdown">Usage<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/usage.html#usingapi">Using API</a></li>
+ <li><a href="/usage.html#clients">Client Libraries</a></li>
+ <li><a href="/command-tools.html">Command Line Tools</a></li>
+ </ul>
+ </li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">Contribute<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/getting-sources.html">Getting Sources</a></li>
+ <li><a href="/how-to-contribute.html">How Can I Contribute?</a></li>
+ </ul>
+ </li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">API<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/rest-api.html">Deltacloud REST API</a></li>
+ <li><a href="/curl-examples.html">Deltacloud API cURL examples</a></li>
+ <li><a href="/drivers.html">Drivers API</a></li>
+ </ul>
+ </li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">CIMI<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/cimi-rest.html">CIMI REST API</a></li>
+ <li><a href="/cimi-curl.html">CIMI cURL Examples</a></li>
+ </ul>
+ </li>
+ <li><a href="/contact.html">Contact</a></li>
+</ul>
+
+ </div>
+ </div>
+
+ </div>
+
+ <div class="container content">
+
+ <p><br></p>
+
+<ul class="breadcrumb">
+<li>
+ <a href="white-box-tests.html">White Box Tests?</a> <span class="divider">/</span>
+ </li>
+ <li class="active">Updating VCR Fixtures Example</li>
+</ul><h3>An Example of Re-recording the VCR test fixtures.</h3>
+
+<p>
+Below is an example of recording new fixtures for the test:
+<i><u><b>server/tests/drivers/rhevm/instance_test.rb</b></u></i>
+tests.
+</p><p>
+
+</p><ol>
+<li>
+ <p> Create ${HOME}/.deltacloud/config</p>
+
+ <pre>
+ rhevm:
+ user: 'admin@internal'
+ password: 'localpassword'
+ provider: 'https://16.1.1.3/api;b9bb11c2-f397-4f41-a57b-7ac15a894779'
+ mock:
+ user: mockuser
+ password: mockpassword
+ provider: compute
+
+
+ </pre>
+</li>
+<li>
+ <p>Modify the test source to have the realm, instance, image & provider
+ for a live cloud provider.</p>
+
+ <pre>
+ % vim server/tests/drivers/rhevm/instance_test.rb
+ ...
+ TST_REALM = '12345678-123a-123b-123c-123456789abc'
+ TST_INSTANCE = '23456781-23a1-23b1-23c1-23456789abce'
+ TST_IMAGE = '34567812-3a12-3b12-3c12-3456789abcef'
+ ...
+ @driver = Deltacloud::Test::config.driver(:rhevm,
+ provider="https://16.1.1.3/api;b9bb11c2-f397-4f41-a57b-7ac15a894779")
+ </pre>
+
+ </li>
+
+ <li>
+ <p>Set the VCR record mode to :record => :all</p>
+
+ <pre>
+ % vim server/tests/drivers/rhevm/common.rb
+ ...
+ # Set :record to :all, when re-recording and between re-record attemps
+ # be sure to clear fixtures/*.yml files which can be done with "git checkout".
+ # e.g.:
+ c.default_cassette_options = { :record => :all }
+ # c.default_cassette_options = { :record => :none }
+ ...
+ </pre>
+
+ </li>
+
+
+ <li>
+ <p>Run the test in record mode</p>
+
+ <pre>
+ % cd YOUR-REPO/deltacloud/server
+
+ # Record only the single test
+ % ruby tests/drivers/rhevm/instance_test.rb
+
+ or
+
+ # Record the drivers:rhevm tests:
+ % rake test:drivers:rhevm
+
+ or
+
+ # Record all the tests:
+ % rake test
+ </pre>
+
+ </li>
+
+ <li>
+ <p>Remove the user:password creds from the fixture.</p>
+
+ <p>
+ The recorded fixture will contain live creds. For security reasons
+ it is best to either change the credentials on the cloud provider or
+ remove them from the fixture YAML file. Removing them from the fixture
+ YAML file can easily be accomplished using sed.
+ </p>
+
+ <pre>
+ e.g.:
+ for i in $(ls tests/drivers/rhevm/fixtures/test_0*.yml); do \
+ echo $i; \
+ cat $i | sed s/admin%40internal:localpassword/fakeuser:fakepassword/ > $i.new; \
+ mv $i.new $i; \
+ done
+ </pre>
+
+ </li>
+
+ <li>
+ <p>Remove ${HOME}/.deltacloud/config</p>
+
+ <p>
+ This is done to avoid using the credentials from the config file
+ during non-recording test runs.
+ </p>
+
+ <pre>
+ e.g.: (note it might be best to save it in ".ORIG" for future re-recordings.)
+ mv ${HOME}/.deltacloud/config ${HOME}/.deltacloud/config.ORIG
+ </pre>
+ </li>
+
+ <li>
+ <p>Turn off record mode.
+
+ </p>
+<p>To turn off record mode set the record mode to { :record => :none }</p>
+
+ <pre>
+ % vim server/tests/drivers/rhevm/common.rb
+ ...
+ # Set :record to :all, when re-recording and between re-record attemps
+ # be sure to clear fixtures/*.yml files which can be done with "git checkout".
+ # e.g.:
+ # c.default_cassette_options = { :record => :all }
+ c.default_cassette_options = { :record => :none }
+ ...
+ </pre>
+
+
+
+ </li>
+<li>
+ <p>Remove trailing white space from the fixtures YAML files.</p>
+
+ <p>
+ Recording can place trailing white space in the fixtures YAML files
+ which can be removed or ignored.
+ </p>
+
+ <p>There are many ways to accomplish this.</p>
+ </li>
+
+ <li>
+ <p>Confirm all tests run in mock mode</p>
+
+ <pre>
+ % cd <repo>/deltacloud/server
+
+ # Run only the single tests that had been re-recorded
+ % ruby tests/drivers/rhevm/instance_test.rb
+
+ and
+
+ # Run all tests in that section:
+ % rake test:drivers:rhevm
+
+ and
+
+ # Record all the tests:
+ % rake test
+
+
+
+
+</repo></pre>
+</li>
+</ol>
+
+ <footer class="footer">
+ <p class="pull-right"><span class='icon-circle-arrow-up'> </span><a href="#">Back to top</a></p>
+ <div class='row'>
+ <div class='span3'>
+ <img src="/assets/img/asf.png" alt="Apache Software Foundation"/>
+ </div>
+ <div class='span9'>
+ <strong>Apache Deltacloud</strong> is a top-level project at the <a
+ href="http://www.apache.org">Apache Software Foundation</a>,
+ having graduated from the ASF Incubator in October
+ 2011. Through a collaborative and meritocratic development process, Apache
+ projects deliver enterprise-grade, freely available software products that
+ attract large communities of users.
+ </div>
+ </div>
+ </footer>
+
+ </div> <!-- /container -->
+
+<!-- Piwik -->
+<script type="text/javascript">
+var pkBaseURL = (("https:" == document.location.protocol) ? "https://stats.salasaga.org/aeolus/piwik/" : "http://stats.salasaga.org/aeolus/piwik/");
+document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
+</script><script type="text/javascript">
+try {
+var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 2);
+piwikTracker.trackPageView();
+piwikTracker.enableLinkTracking();
+} catch( err ) {}
+</script><noscript><p><img src="http://stats.salasaga.org/aeolus/piwik/piwik.php?idsite=2" style="border:0" alt="" /></p></noscript>
+<!-- End Piwik Tracking Code -->
+
+ </body>
+</html>
diff --git a/site/output/white-box-tests-layout.html b/site/output/white-box-tests-layout.html
new file mode 100644
index 0000000..8ab9d2c
--- /dev/null
+++ b/site/output/white-box-tests-layout.html
@@ -0,0 +1,265 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <title>White Box Tests Source Description</title>
+ <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
+ <!--[if lt IE 9]>
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+ <![endif]-->
+
+ <!-- Le JavaScript -->
+ <script src="/assets/js/jquery-1.7.1.min.js" type="text/javascript"></script>
+ <script src="/assets/js/bootstrap-dropdown.js" type="text/javascript"></script>
+ <script src="/assets/js/jquery.tweet.js" type="text/javascript"></script>
+ <script src="/assets/js/application.js" type="text/javascript"></script>
+ <script src="/assets/js/bootstrap-transition.js"></script>
+ <script src="/assets/js/bootstrap-alert.js"></script>
+ <script src="/assets/js/bootstrap-modal.js"></script>
+ <script src="/assets/js/bootstrap-scrollspy.js"></script>
+ <script src="/assets/js/bootstrap-tab.js"></script>
+ <script src="/assets/js/bootstrap-tooltip.js"></script>
+ <script src="/assets/js/bootstrap-popover.js"></script>
+ <script src="/assets/js/bootstrap-button.js"></script>
+ <script src="/assets/js/bootstrap-collapse.js"></script>
+ <script src="/assets/js/bootstrap-carousel.js"></script>
+ <script src="/assets/js/bootstrap-typeahead.js"></script>
+
+ <!-- Le styles -->
+ <link href="/assets/css/bootstrap.css" rel="stylesheet">
+ <link href="/assets/css/application.css" rel="stylesheet">
+ <link rel="shortcut icon" href="/assets/img/favicon.ico">
+ </head>
+
+ <body>
+
+ <div class="navbar navbar-fixed-top">
+ <div class="navbar-inner">
+ <div class="container">
+ <a class="brand" href="/"><img src="/assets/img/logo.png" width="152"
+ alt="Deltacloud API"/></a>
+ <ul class="nav top-nav">
+ <li><a href="/">Home</a></li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">About<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/about.html">What is Deltacloud?</a></li>
+ <li><a href="/supported-providers.html">Supported Providers</a></li>
+ </ul>
+ </li>
+ <li><a href="/download.html">Download</a></li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">Installation<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/install-deltacloud.html">Install Deltacloud</a></li>
+ <li><a href="/run-deltacloud-server.html">Run the Deltacloud Server</a></li>
+ </ul>
+ </li>
+ <li class="dropdown">
+ <a href="/usage.html" class="dropdown-toggle" data-toggle="dropdown">Usage<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/usage.html#usingapi">Using API</a></li>
+ <li><a href="/usage.html#clients">Client Libraries</a></li>
+ <li><a href="/command-tools.html">Command Line Tools</a></li>
+ </ul>
+ </li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">Contribute<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/getting-sources.html">Getting Sources</a></li>
+ <li><a href="/how-to-contribute.html">How Can I Contribute?</a></li>
+ </ul>
+ </li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">API<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/rest-api.html">Deltacloud REST API</a></li>
+ <li><a href="/curl-examples.html">Deltacloud API cURL examples</a></li>
+ <li><a href="/drivers.html">Drivers API</a></li>
+ </ul>
+ </li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">CIMI<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/cimi-rest.html">CIMI REST API</a></li>
+ <li><a href="/cimi-curl.html">CIMI cURL Examples</a></li>
+ </ul>
+ </li>
+ <li><a href="/contact.html">Contact</a></li>
+</ul>
+
+ </div>
+ </div>
+
+ </div>
+
+ <div class="container content">
+
+ <p><br></p>
+
+<ul class="breadcrumb">
+<li>
+ <a href="white-box-tests.html">White Box Tests?</a> <span class="divider">/</span>
+ </li>
+ <li class="active">White Box Tests Source Description</li>
+</ul><h3>Where Are The White Box Tests:</h3>
+
+<p>The following depicts where in the deltacloud directory source structure the
+white box tests are located:</p>
+<div class="row">
+ <div class="span1"></div>
+ <div class="span10 offset1">
+<pre>
+deltacloud
+|-----------------------------------------------------------------------------
+|-d--> server
+ |---------------------------------------------------------------------------
+ |-d-->tests Contains unit tests for drivers
+ |---------------------------------------------------------------------------
+ |-d-->cimi Contains Frontend CIMI tests
+ |-------------------------------------------------------------------------
+ |-d-->deltacloud Contains Frontend deltacloud tests
+ |-------------------------------------------------------------------------
+ |-d-->ec2 Contains Frontend ec2 tests
+ |-------------------------------------------------------------------------
+ |-d-->drivers Contains Backend driver gem tests
+ |-------------------------------------------------------------------------
+ |-d-->base
+ |-d-->ec2
+ |-d-->fgcp
+ |-d-->gogrid
+ |-d-->google Contains the varios driver tests
+ |-d-->mock and
+ |-d-->models VCR YAML fixtures
+ |-d-->openstack
+ |-d-->rhevm
+ |-------------------------------------------------------------------------
+ |-d-->helpers Contains helper code common to multiple tests
+ |-------------------------------------------------------------------------
+ |-f-->test_helper.rb Contains the common test helper routes
+ |-------------------------------------------------------------------------
+</pre>
+
+ </div>
+</div>
+
+<p><br></p>
+
+<h3>Driver tests</h3>
+
+<u><b>REPO</b>/deltacloud/server/tests/drivers</u>
+
+<p><br></p>
+
+<p>
+This directory provides all the <i><b>driver</b></i> tests. Each driver tests is
+placed into a separate directory with the driver name. Everything that touchs
+the driver API goes here as well. It is good practice to divide the tests into
+logical collections, in this case driver methods.
+</p>
+
+<p>
+Driver tests use the Deltacloud::new method to create new instance of a driver.
+This method is usually called in a <i>before</i> block and takes two parameters:
+<i>driver name</i> and <i>credentials</i>. The driver methods can be called
+directly on the instance of Deltacloud::new.
+</p>
+
+<p>
+Some driver tests may use the <a href="https://github.com/vcr/vcr">VCR</a> gem
+to record and then mock the real communication with the backend server. The fixtures
+are maintained in the <i>tests/drivers/<b>DRIVER</b>/fixtures</i> directory.
+</p>
+
+<p>
+For more informations about recording, look at the file: <i>tests/drivers/ec2/common.rb</i>,
+<a href="why-update-vcr-test-fixtures-data.html">Why Updating the VCR Fixtures</a>
+and <a href="update-vcr-test-fixtures-data-example.html">Updating VCR Fixtures Example</a>
+</p>
+
+<h3>Test Helpers</h3>
+
+<u><b>REPO</b>/deltacloud/server/tests/helpers</u>
+
+<p><br></p>
+
+<p>
+The <i>base</i> directory contain tests for Deltacloud::Driver class and the Library
+class.
+</p>
+
+<h3>Frontend tests</h3>
+
+<p>
+In addition to the default <i>deltacloud</i> frontend Deltacloud may also
+operate using different frontends. In this case, instead of exposing the
+DC API specification to the client, Deltacloud will provide its drivers
+API through different frontends (like CIMI or Amazon EC2).
+</p>
+
+<p>
+Some tests might use the Mock driver to call the <i>control</i> blocks in Rabbit
+collections. These tests are <b>not</b> driver tests, they just use the mock
+driver to make sure the Rabbit operation <i>control blocks</i> works as expected
+and they provide expected output.
+</p>
+
+<u><b>REPO</b>/deltacloud/server/tests/deltacloud</u>
+
+<p>
+This directory provides tests for Deltacloud API frontend. It contains tests
+for collections that this frontend provides and also tests helpers that this
+frontend use.
+</p>
+
+<u><b>REPO</b>/deltacloud/server/tests/ec2</u>
+
+<p>
+This directory provides tests for the EC2 frontend. Tests make sure that mapping
+between EC2 actions and Deltacloud driver API works correctly. All tests
+relevant to EC2 frontend tests should go here. **NOTE** this directory does not
+provide Amazon EC2 driver tests.
+</p>
+
+<u><b>REPO</b>/deltacloud/server/tests/cimi</u>
+
+<p>
+This directory provides tests for the CIMI frotend. They make sure that
+JSON/XML serialization of the CIMI models works correctly. Also there are tests
+to make sure the output provided by CIMI collections is correct.
+</p>
+
+ <footer class="footer">
+ <p class="pull-right"><span class='icon-circle-arrow-up'> </span><a href="#">Back to top</a></p>
+ <div class='row'>
+ <div class='span3'>
+ <img src="/assets/img/asf.png" alt="Apache Software Foundation"/>
+ </div>
+ <div class='span9'>
+ <strong>Apache Deltacloud</strong> is a top-level project at the <a
+ href="http://www.apache.org">Apache Software Foundation</a>,
+ having graduated from the ASF Incubator in October
+ 2011. Through a collaborative and meritocratic development process, Apache
+ projects deliver enterprise-grade, freely available software products that
+ attract large communities of users.
+ </div>
+ </div>
+ </footer>
+
+ </div> <!-- /container -->
+
+<!-- Piwik -->
+<script type="text/javascript">
+var pkBaseURL = (("https:" == document.location.protocol) ? "https://stats.salasaga.org/aeolus/piwik/" : "http://stats.salasaga.org/aeolus/piwik/");
+document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
+</script><script type="text/javascript">
+try {
+var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 2);
+piwikTracker.trackPageView();
+piwikTracker.enableLinkTracking();
+} catch( err ) {}
+</script><noscript><p><img src="http://stats.salasaga.org/aeolus/piwik/piwik.php?idsite=2" style="border:0" alt="" /></p></noscript>
+<!-- End Piwik Tracking Code -->
+
+ </body>
+</html>
diff --git a/site/output/white-box-tests.html b/site/output/white-box-tests.html
new file mode 100644
index 0000000..80c86db
--- /dev/null
+++ b/site/output/white-box-tests.html
@@ -0,0 +1,180 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <title>White Box Tests</title>
+ <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
+ <!--[if lt IE 9]>
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+ <![endif]-->
+
+ <!-- Le JavaScript -->
+ <script src="/assets/js/jquery-1.7.1.min.js" type="text/javascript"></script>
+ <script src="/assets/js/bootstrap-dropdown.js" type="text/javascript"></script>
+ <script src="/assets/js/jquery.tweet.js" type="text/javascript"></script>
+ <script src="/assets/js/application.js" type="text/javascript"></script>
+ <script src="/assets/js/bootstrap-transition.js"></script>
+ <script src="/assets/js/bootstrap-alert.js"></script>
+ <script src="/assets/js/bootstrap-modal.js"></script>
+ <script src="/assets/js/bootstrap-scrollspy.js"></script>
+ <script src="/assets/js/bootstrap-tab.js"></script>
+ <script src="/assets/js/bootstrap-tooltip.js"></script>
+ <script src="/assets/js/bootstrap-popover.js"></script>
+ <script src="/assets/js/bootstrap-button.js"></script>
+ <script src="/assets/js/bootstrap-collapse.js"></script>
+ <script src="/assets/js/bootstrap-carousel.js"></script>
+ <script src="/assets/js/bootstrap-typeahead.js"></script>
+
+ <!-- Le styles -->
+ <link href="/assets/css/bootstrap.css" rel="stylesheet">
+ <link href="/assets/css/application.css" rel="stylesheet">
+ <link rel="shortcut icon" href="/assets/img/favicon.ico">
+ </head>
+
+ <body>
+
+ <div class="navbar navbar-fixed-top">
+ <div class="navbar-inner">
+ <div class="container">
+ <a class="brand" href="/"><img src="/assets/img/logo.png" width="152"
+ alt="Deltacloud API"/></a>
+ <ul class="nav top-nav">
+ <li><a href="/">Home</a></li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">About<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/about.html">What is Deltacloud?</a></li>
+ <li><a href="/supported-providers.html">Supported Providers</a></li>
+ </ul>
+ </li>
+ <li><a href="/download.html">Download</a></li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">Installation<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/install-deltacloud.html">Install Deltacloud</a></li>
+ <li><a href="/run-deltacloud-server.html">Run the Deltacloud Server</a></li>
+ </ul>
+ </li>
+ <li class="dropdown">
+ <a href="/usage.html" class="dropdown-toggle" data-toggle="dropdown">Usage<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/usage.html#usingapi">Using API</a></li>
+ <li><a href="/usage.html#clients">Client Libraries</a></li>
+ <li><a href="/command-tools.html">Command Line Tools</a></li>
+ </ul>
+ </li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">Contribute<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/getting-sources.html">Getting Sources</a></li>
+ <li><a href="/how-to-contribute.html">How Can I Contribute?</a></li>
+ </ul>
+ </li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">API<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/rest-api.html">Deltacloud REST API</a></li>
+ <li><a href="/curl-examples.html">Deltacloud API cURL examples</a></li>
+ <li><a href="/drivers.html">Drivers API</a></li>
+ </ul>
+ </li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">CIMI<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/cimi-rest.html">CIMI REST API</a></li>
+ <li><a href="/cimi-curl.html">CIMI cURL Examples</a></li>
+ </ul>
+ </li>
+ <li><a href="/contact.html">Contact</a></li>
+</ul>
+
+ </div>
+ </div>
+
+ </div>
+
+ <div class="container content">
+
+ <p><br></p>
+
+<ul class="breadcrumb">
+<li>
+ <a href="how-to-contribute.html#how">How to contribute?</a> <span class="divider">/</span>
+ </li>
+ <li class="active">Validate Contributions Using the White Box Tests</li>
+</ul><h3>Validate Contributions Using the White Box Tests</h3>
+
+<p>
+Deltacloud contains automated API tests, that are driven using pre-recorded
+<a href="https://github.com/vcr/vcr">VCR</a> YAML files called <i>fixtures</i>.
+The test source and fixtures are maintained in the deltacloud source tree
+under: <i><b>REPO/deltacloud/server/tests
+
+
+</b></i></p><p>
+In some cases it might be necessarey to re-record the VCR fixtures for
+particular tests. For example, this could become necessarey, if new
+functionality or a bug fix alters the exchange with the backend cloud
+provider.
+</p>
+
+<p>
+The process for updating the test data involves exercising the tests against a live
+cloud provider and recording the live API exchange into the VCR fixtures YAML files.
+After which the tests can more quickly and easily be run using the recorded VCR
+fixtures without the need to accessess a live cloud provider.
+</p>
+
+<h4 id="how">Dealing With the White Box Test</h4>
+
+<ul class="nav nav-list">
+<li class="nav-header">
+ </li>
+<li>
+ <a href="white-box-tests-layout.html">White Box Tests Source Description</a>
+ </li>
+ <li>
+ <a href="running-the-white-box-tests.html">Running The White Box Tests</a>
+ </li>
+ <li>
+ <a href="why-update-vcr-test-fixtures-data.html">Why Update The VCR Fixtures?</a>
+ </li>
+ <li>
+ <a href="update-vcr-test-fixtures-data-example.html">Updating VCR Fixtures Example</a>
+ </li>
+</ul>
+
+ <footer class="footer">
+ <p class="pull-right"><span class='icon-circle-arrow-up'> </span><a href="#">Back to top</a></p>
+ <div class='row'>
+ <div class='span3'>
+ <img src="/assets/img/asf.png" alt="Apache Software Foundation"/>
+ </div>
+ <div class='span9'>
+ <strong>Apache Deltacloud</strong> is a top-level project at the <a
+ href="http://www.apache.org">Apache Software Foundation</a>,
+ having graduated from the ASF Incubator in October
+ 2011. Through a collaborative and meritocratic development process, Apache
+ projects deliver enterprise-grade, freely available software products that
+ attract large communities of users.
+ </div>
+ </div>
+ </footer>
+
+ </div> <!-- /container -->
+
+<!-- Piwik -->
+<script type="text/javascript">
+var pkBaseURL = (("https:" == document.location.protocol) ? "https://stats.salasaga.org/aeolus/piwik/" : "http://stats.salasaga.org/aeolus/piwik/");
+document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
+</script><script type="text/javascript">
+try {
+var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 2);
+piwikTracker.trackPageView();
+piwikTracker.enableLinkTracking();
+} catch( err ) {}
+</script><noscript><p><img src="http://stats.salasaga.org/aeolus/piwik/piwik.php?idsite=2" style="border:0" alt="" /></p></noscript>
+<!-- End Piwik Tracking Code -->
+
+ </body>
+</html>
diff --git a/site/output/why-update-vcr-test-fixtures-data.html b/site/output/why-update-vcr-test-fixtures-data.html
new file mode 100644
index 0000000..f06354d
--- /dev/null
+++ b/site/output/why-update-vcr-test-fixtures-data.html
@@ -0,0 +1,233 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <title>Why Update The VCR Fixtures</title>
+ <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
+ <!--[if lt IE 9]>
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+ <![endif]-->
+
+ <!-- Le JavaScript -->
+ <script src="/assets/js/jquery-1.7.1.min.js" type="text/javascript"></script>
+ <script src="/assets/js/bootstrap-dropdown.js" type="text/javascript"></script>
+ <script src="/assets/js/jquery.tweet.js" type="text/javascript"></script>
+ <script src="/assets/js/application.js" type="text/javascript"></script>
+ <script src="/assets/js/bootstrap-transition.js"></script>
+ <script src="/assets/js/bootstrap-alert.js"></script>
+ <script src="/assets/js/bootstrap-modal.js"></script>
+ <script src="/assets/js/bootstrap-scrollspy.js"></script>
+ <script src="/assets/js/bootstrap-tab.js"></script>
+ <script src="/assets/js/bootstrap-tooltip.js"></script>
+ <script src="/assets/js/bootstrap-popover.js"></script>
+ <script src="/assets/js/bootstrap-button.js"></script>
+ <script src="/assets/js/bootstrap-collapse.js"></script>
+ <script src="/assets/js/bootstrap-carousel.js"></script>
+ <script src="/assets/js/bootstrap-typeahead.js"></script>
+
+ <!-- Le styles -->
+ <link href="/assets/css/bootstrap.css" rel="stylesheet">
+ <link href="/assets/css/application.css" rel="stylesheet">
+ <link rel="shortcut icon" href="/assets/img/favicon.ico">
+ </head>
+
+ <body>
+
+ <div class="navbar navbar-fixed-top">
+ <div class="navbar-inner">
+ <div class="container">
+ <a class="brand" href="/"><img src="/assets/img/logo.png" width="152"
+ alt="Deltacloud API"/></a>
+ <ul class="nav top-nav">
+ <li><a href="/">Home</a></li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">About<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/about.html">What is Deltacloud?</a></li>
+ <li><a href="/supported-providers.html">Supported Providers</a></li>
+ </ul>
+ </li>
+ <li><a href="/download.html">Download</a></li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">Installation<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/install-deltacloud.html">Install Deltacloud</a></li>
+ <li><a href="/run-deltacloud-server.html">Run the Deltacloud Server</a></li>
+ </ul>
+ </li>
+ <li class="dropdown">
+ <a href="/usage.html" class="dropdown-toggle" data-toggle="dropdown">Usage<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/usage.html#usingapi">Using API</a></li>
+ <li><a href="/usage.html#clients">Client Libraries</a></li>
+ <li><a href="/command-tools.html">Command Line Tools</a></li>
+ </ul>
+ </li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">Contribute<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/getting-sources.html">Getting Sources</a></li>
+ <li><a href="/how-to-contribute.html">How Can I Contribute?</a></li>
+ </ul>
+ </li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">API<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/rest-api.html">Deltacloud REST API</a></li>
+ <li><a href="/curl-examples.html">Deltacloud API cURL examples</a></li>
+ <li><a href="/drivers.html">Drivers API</a></li>
+ </ul>
+ </li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">CIMI<b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="/cimi-rest.html">CIMI REST API</a></li>
+ <li><a href="/cimi-curl.html">CIMI cURL Examples</a></li>
+ </ul>
+ </li>
+ <li><a href="/contact.html">Contact</a></li>
+</ul>
+
+ </div>
+ </div>
+
+ </div>
+
+ <div class="container content">
+
+ <p><br></p>
+
+<ul class="breadcrumb">
+<li>
+ <a href="white-box-tests.html">White Box Tests?</a> <span class="divider">/</span>
+ </li>
+ <li class="active">Why Update The VCR Fixtures</li>
+</ul><p>
+Deltacloud uses pre-recorded <a href="https://github.com/vcr/vcr">VCR</a> YAML
+files called <i>fixtures</i> to allow test execution without the need for a live
+cloud provider.
+</p>
+
+<p>
+The <i>fixtures</i> YAML files are located under:
+<u><b>REPO</b>/deltacloud/server/tests/drivers/<i>driver name</i>/fixtures</u>
+</p>
+
+<p>
+A live cloud provider, with valid credentials, needs to be used in order to
+<a href="https://www.relishapp.com/vcr/vcr/v/1-6-0/docs/record-modes">record</a>
+the fixtures YAML files but once recorded the tests can then be executed without
+a live cloud provider.
+</p>
+
+<p>
+Because valid credentials are used to record the VCR fixtures data care must be
+taken to either alter the credentials on the live cloud provider or remove them
+from the fixtures data after doing the recording.
+More on how to do this can be found in
+<a href="update-vcr-test-fixtures-data-example.html">Updating VCR Fixtures Example</a>
+</p>
+
+<h3>Why VCR data May Need Updating:</h3>
+
+<p>
+In some cases you will need to re-record the VCR fixtures for particular test.
+This happen when a request is made to the backend cloud provider that a
+test does not yet exercise. <b>For Example:</b>
+</p>
+
+<ul>
+<li>
+ <p>
+ A bug is fixed in the EC2 driver, where <i>images()</i> method had not work properly.
+ </p>
+ <ol>
+<li>
+ <p>Open <i>tests/drivers/ec2/images_tests.rb</i></p>
+ </li>
+ <li>
+ <p>Add a new test to capture this bug.</p>
+ <p>At the end of this file and add a the new code:</p>
+ <pre>
+ it 'should provide correct output' do
+ # assertions go here
+ end
+ </pre>
+ </li>
+ </ol>
+</li>
+
+ <li>
+ <p>
+ Scenario: You added new collection <i>oranges()</i> into RHEV-M driver.
+ </p>
+ <ol>
+<li>
+ <p>Write all driver methods tests here: <i>tests/drivers/rhevm/oranges_tests.rb</i></p>
+ </li>
+ <li>
+ <p>Create <i>tests/deltacloud/collections/oranges_collection_tests.rb</i></p>
+ </li>
+ <li>
+ <p>Write all collection operations tests here ^^</p>
+ </li>
+ </ol>
+</li>
+
+ <li>
+ <p>
+ A bug is fixed in the Deltacloud frontend where <i>/api/images/123/create</i>
+ operation does not provide correct status code. You corrected it.
+ </p>
+ <ol>
+<li>
+ <p>Open 'tests/deltacloud/collections/images_collection_test.rb'</p>
+ </li>
+ <li>
+ <p>Locate this line: </p>
+ <pre>
+ it 'allow to create and destroy the new image' do
+ </pre>
+ </li>
+ <li>
+ <p>Provide the correct value into 'status.must_equal' method</p>
+ </li>
+ </ol>
+</li>
+
+</ul>
+
+ <footer class="footer">
+ <p class="pull-right"><span class='icon-circle-arrow-up'> </span><a href="#">Back to top</a></p>
+ <div class='row'>
+ <div class='span3'>
+ <img src="/assets/img/asf.png" alt="Apache Software Foundation"/>
+ </div>
+ <div class='span9'>
+ <strong>Apache Deltacloud</strong> is a top-level project at the <a
+ href="http://www.apache.org">Apache Software Foundation</a>,
+ having graduated from the ASF Incubator in October
+ 2011. Through a collaborative and meritocratic development process, Apache
+ projects deliver enterprise-grade, freely available software products that
+ attract large communities of users.
+ </div>
+ </div>
+ </footer>
+
+ </div> <!-- /container -->
+
+<!-- Piwik -->
+<script type="text/javascript">
+var pkBaseURL = (("https:" == document.location.protocol) ? "https://stats.salasaga.org/aeolus/piwik/" : "http://stats.salasaga.org/aeolus/piwik/");
+document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
+</script><script type="text/javascript">
+try {
+var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 2);
+piwikTracker.trackPageView();
+piwikTracker.enableLinkTracking();
+} catch( err ) {}
+</script><noscript><p><img src="http://stats.salasaga.org/aeolus/piwik/piwik.php?idsite=2" style="border:0" alt="" /></p></noscript>
+<!-- End Piwik Tracking Code -->
+
+ </body>
+</html>
--
1.7.11.7
Re: [PATCH] SITE: Improvements Add white box unit test description.
Posted by David Lutterkort <lu...@redhat.com>.
Hi Joe,
looks fine to me, couple comments:
On Wed, 2013-03-06 at 17:49 -0500, jvlcek@redhat.com wrote:
> diff --git a/site/content/running-the-white-box-tests.md b/site/content/running-the-white-box-tests.md
> new file mode 100644
> index 0000000..542cd34
> --- /dev/null
> +++ b/site/content/running-the-white-box-tests.md
...
> + <li>
> + <p>Rake task to run the various <b><u><i>Frontend </i></u></b> tests: </p>
> + <pre>
> + % rake test:base # Run tests for base
> + % rake test:cimi:models # Run tests for models
> + % rake test:ec2 # Run tests for ec2
> + </pre>
> + </li>
Rather than tell people about each individual task, which will surely
change over time, just tell people to run 'rake -T test' to see what
subtasks for tests are available.
> diff --git a/site/content/update-vcr-test-fixtures-data-example.md b/site/content/update-vcr-test-fixtures-data-example.md
> new file mode 100644
> index 0000000..7942b60
> --- /dev/null
> +++ b/site/content/update-vcr-test-fixtures-data-example.md
...
> + <li>
> + <p>Modify the test source to have the realm, instance, image & provider
> + for a live cloud provider.</p>
> +
> + <pre>
> + % vim server/tests/drivers/rhevm/instance_test.rb
> + ...
> + TST_REALM = '12345678-123a-123b-123c-123456789abc'
> + TST_INSTANCE = '23456781-23a1-23b1-23c1-23456789abce'
> + TST_IMAGE = '34567812-3a12-3b12-3c12-3456789abcef'
> + ...
Ick; any way we can make that dynamic ? Like, just grab one of the
available realms etc.
> + <li>
> + <p>Set the VCR record mode to :record => :all</p>
> +
> + <pre>
> + % vim server/tests/drivers/rhevm/common.rb
> + ...
> + # Set :record to :all, when re-recording and between re-record attemps
> + # be sure to clear fixtures/*.yml files which can be done with "git checkout".
> + # e.g.:
> + c.default_cassette_options = { :record => :all }
> + # c.default_cassette_options = { :record => :none }
> + ...
> + </pre>
It would be nice if we could control that with an env variable; so that
rather than edit sources to rerecord, you could just say
VCR_RECORD=all ruby tests/drivers/rhevm/instance_test.rb
> + <li>
> + <p>Remove the user:password creds from the fixture.</p>
Have a look if the second patch I sent takes care of that.
> + <li>
> + <p>Remove ${HOME}/.deltacloud/config</p>
That shouldn't really matter; we should be smart enough in our
recording/playback that having the config file there doesn't trip us up.
David