<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>A Tempest of Thoughts &#187; AmazonS3</title>
	<atom:link href="http://tempe.st/category/amazons3/feed/" rel="self" type="application/rss+xml" />
	<link>http://tempe.st</link>
	<description>aka blog.to_int(:inig)</description>
	<lastBuildDate>Thu, 07 Apr 2011 08:24:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>Amazon S3, Ruby, and the failing tests</title>
		<link>http://tempe.st/2007/06/amazon-s3-ruby-and-the-failing-tests/</link>
		<comments>http://tempe.st/2007/06/amazon-s3-ruby-and-the-failing-tests/#comments</comments>
		<pubDate>Thu, 21 Jun 2007 10:18:50 +0000</pubDate>
		<dc:creator>Giovanni Intini</dc:creator>
				<category><![CDATA[AmazonS3]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://tempe.st/2007/06/amazon-s3-ruby-and-the-failing-tests/</guid>
		<description><![CDATA[A friend of mine, Jeko, introduced me to Amazon S3, praising the Ruby support, and the ease of use. So when Gabriele Renzi suggested me a potential wonderful use for S3 (still secret, sorry) I decided to give it a try and downloaded the Ruby sample libraries. Unfortunately all the tests were failing, and that [...]]]></description>
			<content:encoded><![CDATA[	<p>A friend of mine, Jeko, introduced me to <a href="http://aws.amazon.com/s3">Amazon S3</a>, praising the Ruby support, and the ease of use. So when <a href="http://riffraff.info">Gabriele Renzi</a> suggested me a potential wonderful use for S3 (still secret, sorry) I decided to give it a try and downloaded the Ruby sample libraries. </p>
	<p>Unfortunately all the tests were failing, and that made me unhappy. What made it strange was that the first time I ran the tests I two errors, and the second time I ran them the first error was replaced by another one.</p>
	<p>I dag into the code and found a simple but effective fix for all the problems.</p>
	<p>The first-error-replacement was caused by a non emptying of the test Bucket after the tests failed. I edited the setup method in the test suite to look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">def</span> setup
    <span style="color:#0066ff; font-weight:bold;">@conn</span> = <span style="color:#6666ff; font-weight:bold;">S3::AWSAuthConnection</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY<span style="color:#006600; font-weight:bold;">&#41;</span>
     <span style="color:#0066ff; font-weight:bold;">@conn</span>.<span style="color:#9900CC;">list_bucket</span><span style="color:#006600; font-weight:bold;">&#40;</span>BUCKET_NAME<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">entries</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>object<span style="color:#006600; font-weight:bold;">|</span>
       <span style="color:#0066ff; font-weight:bold;">@conn</span>.<span style="color:#9900CC;">delete</span><span style="color:#006600; font-weight:bold;">&#40;</span>BUCKET_NAME, object.<span style="color:#9900CC;">key</span><span style="color:#006600; font-weight:bold;">&#41;</span>
     <span style="color:#9966CC; font-weight:bold;">end</span>
     <span style="color:#0066ff; font-weight:bold;">@conn</span>.<span style="color:#9900CC;">delete_bucket</span><span style="color:#006600; font-weight:bold;">&#40;</span>BUCKET_NAME<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

  
	<p>Now I kept getting the same error but it was an easy fix: edit line 534 of S3.rb to look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  <span style="color:#0066ff; font-weight:bold;">@properties</span>.<span style="color:#9900CC;">name</span> = <span style="color:#0066ff; font-weight:bold;">@curr_text</span>.<span style="color:#9900CC;">strip</span></pre></div></div>

	<p>With this two fixes the test suite runs correctly (I can&#8217;t certify its validity though <img src='http://tempe.st/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ). After a succesful test run you can remove the fixes to the setup method, because it keeps working fine, but I would leave them untouched, you never know if there&#8217;s a problem in a test <img src='http://tempe.st/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>

 ]]></content:encoded>
			<wfw:commentRss>http://tempe.st/2007/06/amazon-s3-ruby-and-the-failing-tests/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

