You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by ma...@apache.org on 2013/03/15 15:27:57 UTC

[1/2] git commit: SITE: Update test recording instructions

SITE: Update test recording instructions

This is required to better describe recent changes
for parameterizing recording and provider configuration
of credentials and resources to avoid having to edit
test source code in order to record test fixtures.
TrackedAt: http://tracker.deltacloud.org/patch/9723a4aa34c7b445973301facebb13399064aab4


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/79d9dd23
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/79d9dd23
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/79d9dd23

Branch: refs/heads/master
Commit: 79d9dd235bf4cc10a21a34855f9356985cd7b295
Parents: 2db5bd9
Author: Joe VLcek <jv...@redhat.com>
Authored: Wed Mar 13 15:46:34 2013 -0400
Committer: marios <ma...@redhat.com>
Committed: Fri Mar 15 16:21:44 2013 +0200

----------------------------------------------------------------------
 site/content/running-the-white-box-tests.md        |   25 ++-
 site/content/send-patch.md                         |    3 -
 .../update-vcr-test-fixtures-data-example.md       |  115 +++------------
 site/output/running-the-white-box-tests.html       |   25 ++-
 site/output/send-patch.html                        |    3 -
 .../update-vcr-test-fixtures-data-example.html     |  114 +++------------
 6 files changed, 78 insertions(+), 207 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/79d9dd23/site/content/running-the-white-box-tests.md
----------------------------------------------------------------------
diff --git a/site/content/running-the-white-box-tests.md b/site/content/running-the-white-box-tests.md
index 058ff4f..53eb6a1 100644
--- a/site/content/running-the-white-box-tests.md
+++ b/site/content/running-the-white-box-tests.md
@@ -14,8 +14,9 @@ title: Running the Whitebox Tests
 
 <h3>Running the white box tests</h3>
 
-<p>The tests can be executed in groups, using tasks in the Rakefile, or
-   individually.</p>
+<p>After getting the source and <a href="getting-sources.html"> setting
+up the development environment</a>, the tests can be executed in groups,
+using tasks in the Rakefile, or individually using ruby directly.</p>
 
 <ul>
   <li>
@@ -32,24 +33,30 @@ title: Running the Whitebox Tests
     </li>
 
     <li>
-      <p>Rake task to run the various <b><u><i>Frontend </i></u></b> tests: </p>
+      <p>Example of listing the available subtasks have available tests: </p>
+      <pre>
+      % cd <b>REPO</b>/deltacloud/server
+      % rake -T test
+      <i>output list or available tests</i>
+      </pre>
+    </li>
+
+    <li>
+      <p>Example rake task to run ec2 <b><u><i>frontend </i></u></b> tests: </p>
       <pre>
       % cd <b>REPO</b>/deltacloud/server
-      % 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>
+      <p>Example rake task to run the rhevm <b><u><i>driver </i></u></b>  tests: </p>
       <pre>
       % cd <b>REPO</b>/deltacloud/server
-      % 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>
+    </li>
+
   </ul>
 
   <li>

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/79d9dd23/site/content/send-patch.md
----------------------------------------------------------------------
diff --git a/site/content/send-patch.md b/site/content/send-patch.md
index fc07fd1..193b825 100644
--- a/site/content/send-patch.md
+++ b/site/content/send-patch.md
@@ -44,9 +44,6 @@ to = dev@deltacloud.apache.org
 
 [core]
 whitespace = trailing-space,space-before-tab
-
-[apply]
-whitespace = error-all
 </pre>
 
   </li>

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/79d9dd23/site/content/update-vcr-test-fixtures-data-example.md
----------------------------------------------------------------------
diff --git a/site/content/update-vcr-test-fixtures-data-example.md b/site/content/update-vcr-test-fixtures-data-example.md
index 2f8074a..76fe4f1 100644
--- a/site/content/update-vcr-test-fixtures-data-example.md
+++ b/site/content/update-vcr-test-fixtures-data-example.md
@@ -29,12 +29,19 @@ More information can be found on the past recording of the
 <ol>
   <li>
     <p> Create ${HOME}/.deltacloud/config</p>
+    <br>
+    <p> Create the deltacloud config file: ${HOME}/.deltacloud/config</p>
+    to contain the credentials and provider resource UUIDs</p>
 
     <pre>
     rhevm:
       user:     'admin@internal'
       password: 'localpassword'
-      provider: 'https://16.1.1.3/api;b9bb11c2-f397-4f41-a57b-7ac15a894779'
+      provider: 'https://rhevm.example.com/api'
+      preferred:
+        datacenter: UUID of a datacenter/realm
+        vm: UUID of an existing instance
+        template: UUID of an existing template/image
     mock:
       user: mockuser
       password: mockpassword
@@ -42,54 +49,33 @@ More information can be found on the past recording of the
   </li>
 
   <li>
-    <p>Modify the test source to have the realm, instance, image & provider
-       for a live cloud provider.</p>
+    <p>Set the VCR record mode to <i>all</i></p>
+    <br>
+    <p> Note: This does not cause <i>all</i> tests to be recorded.
+    It instructs VCR to record new fixtures data for the test to
+    be run in the next step.</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")
+    % export VCR_RECORD="all"
     </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
+    # Record only the single test:
     % ruby tests/drivers/rhevm/instance_test.rb
 
-    or
+    <b>or</b>
 
     # Record the drivers:rhevm tests:
     % rake test:drivers:rhevm
 
-    or
+    <b>or</b>
 
     # Record all the tests:
     % rake test
@@ -98,69 +84,16 @@ More information can be found on the past recording of the
   </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>
+    <p>Disable record mode.
+    <br>
+    <p>This will allow the test to be run in playback mode using the
+    recorded  fixtures data.</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 }
-    ...
+    % unset VCR_RECORD
     </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>
 
@@ -170,12 +103,12 @@ More information can be found on the past recording of the
     # Run only the single tests that had been re-recorded
     % ruby tests/drivers/rhevm/instance_test.rb
 
-      and
+      <b>and</b>
 
     # Run all tests in that section:
     % rake test:drivers:rhevm
 
-      and
+      <b>and</b>
 
     # Record all the tests:
     % rake test

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/79d9dd23/site/output/running-the-white-box-tests.html
----------------------------------------------------------------------
diff --git a/site/output/running-the-white-box-tests.html b/site/output/running-the-white-box-tests.html
index 7a8ef06..18c13a4 100644
--- a/site/output/running-the-white-box-tests.html
+++ b/site/output/running-the-white-box-tests.html
@@ -104,8 +104,9 @@
   <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>
+<p>After getting the source and <a href="getting-sources.html"> setting
+up the development environment</a>, the tests can be executed in groups,
+using tasks in the Rakefile, or individually using ruby directly.</p>
 
 <ul>
 <li>
@@ -122,24 +123,30 @@
     </li>
 
     <li>
-      <p>Rake task to run the various <b><u><i>Frontend </i></u></b> tests: </p>
+      <p>Example of listing the available subtasks have available tests: </p>
+      <pre>
+      % cd <b>REPO</b>/deltacloud/server
+      % rake -T test
+      <i>output list or available tests</i>
+      </pre>
+    </li>
+
+    <li>
+      <p>Example rake task to run ec2 <b><u><i>frontend </i></u></b> tests: </p>
       <pre>
       % cd <b>REPO</b>/deltacloud/server
-      % 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>
+      <p>Example rake task to run the rhevm <b><u><i>driver </i></u></b>  tests: </p>
       <pre>
       % cd <b>REPO</b>/deltacloud/server
-      % 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>
+    </li>
+
   </ul>
 <li>
     <p>Example manually running an <b><u><i>individual</i></u></b> test: </p>

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/79d9dd23/site/output/send-patch.html
----------------------------------------------------------------------
diff --git a/site/output/send-patch.html b/site/output/send-patch.html
index 63ca570..4d9fae5 100644
--- a/site/output/send-patch.html
+++ b/site/output/send-patch.html
@@ -134,9 +134,6 @@ to = dev@deltacloud.apache.org
 
 [core]
 whitespace = trailing-space,space-before-tab
-
-[apply]
-whitespace = error-all
 </pre>
 
   </li>

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/79d9dd23/site/output/update-vcr-test-fixtures-data-example.html
----------------------------------------------------------------------
diff --git a/site/output/update-vcr-test-fixtures-data-example.html b/site/output/update-vcr-test-fixtures-data-example.html
index 308ebb7..0c84515 100644
--- a/site/output/update-vcr-test-fixtures-data-example.html
+++ b/site/output/update-vcr-test-fixtures-data-example.html
@@ -118,12 +118,18 @@ More information can be found on the past recording of the
 <ol>
 <li>
     <p> Create ${HOME}/.deltacloud/config</p>
+    <br><p> Create the deltacloud config file: ${HOME}/.deltacloud/config</p>
+    to contain the credentials and provider resource UUIDs
 
     <pre>
     rhevm:
       user:     'admin@internal'
       password: 'localpassword'
-      provider: 'https://16.1.1.3/api;b9bb11c2-f397-4f41-a57b-7ac15a894779'
+      provider: 'https://rhevm.example.com/api'
+      preferred:
+        datacenter: UUID of a datacenter/realm
+        vm: UUID of an existing instance
+        template: UUID of an existing template/image
     mock:
       user: mockuser
       password: mockpassword
@@ -133,54 +139,32 @@ More information can be found on the past recording of the
   </pre>
 </li>
 <li>
-    <p>Modify the test source to have the realm, instance, image &amp; provider
-       for a live cloud provider.</p>
+    <p>Set the VCR record mode to <i>all</i></p>
+    <br><p> Note: This does not cause <i>all</i> tests to be recorded.
+    It instructs VCR to record new fixtures data for the test to
+    be run in the next step.</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")
+    % export VCR_RECORD="all"
     </pre>
 
   </li>
 
   <li>
-    <p>Set the VCR record mode to :record =&gt; :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 =&gt; :all }
-    # c.default_cassette_options = { :record =&gt; :none }
-    ...
-    </pre>
-
-  </li>
-
-
-  <li>
     <p>Run the test in record mode</p>
 
     <pre>
     % cd YOUR-REPO/deltacloud/server
 
-    # Record only the single test
+    # Record only the single test:
     % ruby tests/drivers/rhevm/instance_test.rb
 
-    or
+    <b>or</b>
 
     # Record the drivers:rhevm tests:
     % rake test:drivers:rhevm
 
-    or
+    <b>or</b>
 
     # Record all the tests:
     % rake test
@@ -189,72 +173,18 @@ More information can be found on the past recording of the
   </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/ &gt; $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>
+    <p>Disable record mode.
+    <br></p>
+<p>This will allow the test to be run in playback mode using the
+    recorded  fixtures data.</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 =&gt; :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 =&gt; :all }
-    c.default_cassette_options = { :record =&gt; :none }
-    ...
+    % unset VCR_RECORD
     </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>
@@ -263,12 +193,12 @@ More information can be found on the past recording of the
     # Run only the single tests that had been re-recorded
     % ruby tests/drivers/rhevm/instance_test.rb
 
-      and
+      <b>and</b>
 
     # Run all tests in that section:
     % rake test:drivers:rhevm
 
-      and
+      <b>and</b>
 
     # Record all the tests:
     % rake test