deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvl...@redhat.com
Subject [PATCH] SITE: Update test recording instructions
Date Tue, 12 Mar 2013 21:39:36 GMT
From: Joe VLcek <jvlcek@redhat.com>

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.
---
 site/content/running-the-white-box-tests.md        | 25 ++++--
 .../update-vcr-test-fixtures-data-example.md       | 95 ++++++----------------
 site/output/running-the-white-box-tests.html       | 25 ++++--
 .../update-vcr-test-fixtures-data-example.html     | 94 ++++++---------------
 4 files changed, 84 insertions(+), 155 deletions(-)

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>
diff --git a/site/content/update-vcr-test-fixtures-data-example.md b/site/content/update-vcr-test-fixtures-data-example.md
index 2f8074a..ef64573 100644
--- a/site/content/update-vcr-test-fixtures-data-example.md
+++ b/site/content/update-vcr-test-fixtures-data-example.md
@@ -29,62 +29,44 @@ 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'
-    mock:
-      user: mockuser
-      password: mockpassword
-      provider: compute
+      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
   </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
@@ -98,27 +80,6 @@ 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>
@@ -133,25 +94,18 @@ More information can be found on the past recording of the
   </li>
 
   <li>
-    <p>Turn off record mode.
-
-    <p>To turn off record mode set the record mode to { :record => :none }</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>
-    % 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>Deal sith trailing white space from the fixtures YAML files.</p>
 
     <p>
     Recording can place trailing white space in the fixtures YAML files
@@ -159,6 +113,11 @@ More information can be found on the past recording of the
     </p>
 
     <p>There are many ways to accomplish this.</p>
+
+    <p> The trailing white space can be edited out of the fixtures YAML files
+    or configure <a href="http://git-scm.com/docs/git-config">git</a> to ignore
+    whitespace</p>
+
   </li>
 
   <li>
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>
diff --git a/site/output/update-vcr-test-fixtures-data-example.html b/site/output/update-vcr-test-fixtures-data-example.html
index 308ebb7..8543ce2 100644
--- a/site/output/update-vcr-test-fixtures-data-example.html
+++ b/site/output/update-vcr-test-fixtures-data-example.html
@@ -118,64 +118,44 @@ 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'
-    mock:
-      user: mockuser
-      password: mockpassword
-      provider: compute
+      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
   
 
   </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
@@ -189,27 +169,6 @@ 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>
@@ -224,27 +183,19 @@ More information can be found on the past recording of the
   </li>
 
   <li>
-    <p>Turn off record mode.
-
-    </p>
-<p>To turn off record mode set the record mode to { :record =&gt; :none }</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>
-    % 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>Deal sith trailing white space from the fixtures YAML files.</p>
 
     <p>
     Recording can place trailing white space in the fixtures YAML files
@@ -252,6 +203,11 @@ More information can be found on the past recording of the
     </p>
 
     <p>There are many ways to accomplish this.</p>
+
+    <p> The trailing white space can be edited out of the fixtures YAML files
+    or configure <a href="http://git-scm.com/docs/git-config">git</a> to ignore
+    whitespace</p>
+
   </li>
 
   <li>
-- 
1.7.11.7


Mime
View raw message