From 3f675353331f572fada00308a29934611a47177f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Fri, 15 Jun 2012 01:04:16 -0700 Subject: [PATCH 1/4] Remove Gemfile.lock The Gemfile.lock file should exist only for applications and not for libraries. --- Gemfile.lock | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 Gemfile.lock diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index c0496b6..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,23 +0,0 @@ -GIT - remote: git@github.com:rightscale/right_http_connection.git - revision: 0bc3343232133bdb38c237d8285525d74495d3f5 - specs: - right_http_connection (1.2.5) - -GEM - remote: http://rubygems.org/ - specs: - libxml-ruby (0.5.2.0) - rake (0.8.7) - rcov (0.8.1.2.0) - uuidtools (1.0.7) - -PLATFORMS - ruby - -DEPENDENCIES - libxml-ruby (~> 0.5.2) - rake - rcov - right_http_connection (= 1.2.5)! - uuidtools (~> 1.0.7) From 831902a958d32018fd942cf834454656c2bfc6ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Fri, 15 Jun 2012 01:06:30 -0700 Subject: [PATCH 2/4] Don't use git for right_http_connection. The Gemfile was also pointing at a specific version that is no longer there (current git is at 1.3.1) so there is little gain on keeping it that way. --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 7c09e6d..cfaf77e 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source "http://rubygems.org" -gem 'right_http_connection', '1.2.5', :git => 'git@github.com:rightscale/right_http_connection.git' +gem 'right_http_connection', '>= 1.2.5' gem 'libxml-ruby', '~> 0.5.2' group :development do From e69e1390ce832247d4561897b7d91816bd4ecc8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Fri, 15 Jun 2012 01:43:50 -0700 Subject: [PATCH 3/4] Use wider dependencies. The current code seems to work fine with modern uuidtools and modern libxml-ruby so there is no reason to artificially limit the version to very old ones. --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index cfaf77e..6e45952 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source "http://rubygems.org" gem 'right_http_connection', '>= 1.2.5' -gem 'libxml-ruby', '~> 0.5.2' +gem 'libxml-ruby', '>= 0.5.2' group :development do gem 'rake' @@ -9,5 +9,5 @@ group :development do end group :activesdb do - gem 'uuidtools', "~> 1.0.7" + gem 'uuidtools', ">= 1.0.7" end From fbb665e6df909bcdaa6c85d724b4977a8a80a899 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Fri, 15 Jun 2012 01:44:20 -0700 Subject: [PATCH 4/4] test: use environment variables to set up credentials. This actually allows tests to be run from systems such as Gentoo, by setting up enough variables during execution. --- test/README.mdown | 19 +++++++------------ test/test_credentials.rb | 31 +++---------------------------- 2 files changed, 10 insertions(+), 40 deletions(-) diff --git a/test/README.mdown b/test/README.mdown index 36c6265..e9d8a17 100644 --- a/test/README.mdown +++ b/test/README.mdown @@ -4,22 +4,17 @@ Before you can run any tests, you need to set up credentials (API key and secret) that will be used when talking to AWS. The credentials are loaded in `test/test_credentials.rb` -and are expected to be found in `~/.rightscale/testcredentials.rb` and look like this: +and are expected to be found through three environment variables: - TestCredentials.aws_access_key_id= 'AAAAAAAAAAAAAAAAAAAA' - TestCredentials.aws_secret_access_key= 'asdfasdfsadf' - TestCredentials.account_number= '???' + RIGHT_AWS_TEST_ACCESS_KEY_ID = 'AAAAAAAAAAAAAAAAAAAA' + RIGHT_AWS_TEST_ACCESS_SECRET_KEY = 'asdfasdfsadf' + RIGHT_AWS_TEST_ACCOUNT_NUMBER = '???' If you prefer to store your secret key in the OS X keychain, you can do this: - def secret_access_key_from_keychain (key_id) - dump = `security -q find-generic-password -a "#{key_id}" -g 2>&1` - dump[/password: "(.*)"/, 1] - end - - TestCredentials.aws_access_key_id= 'AAAAAAAAAAAAAAAAAAAA' - TestCredentials.aws_secret_access_key= secret_access_key_from_keychain(TestCredentials.aws_access_key_id) - TestCredentials.account_number= '???' + RIGHT_AWS_TEST_ACCESS_KEY_ID = 'AAAAAAAAAAAAAAAAAAAA' + RIGHT_AWS_TEST_ACCESS_SECRET_KEY = `security -q find-generic-password -a "#{key_id}" -g 2>&1 | cut -d: -f2` + RIGHT_AWS_TEST_ACCOUNT_NUMBER = '???' ## Running tests diff --git a/test/test_credentials.rb b/test/test_credentials.rb index 1c68469..8c443cb 100644 --- a/test/test_credentials.rb +++ b/test/test_credentials.rb @@ -1,37 +1,12 @@ class TestCredentials - @@aws_access_key_id = nil - @@aws_secret_access_key = nil - @@account_number = nil - def self.aws_access_key_id - @@aws_access_key_id - end - def self.aws_access_key_id=(newval) - @@aws_access_key_id = newval + ENV['RIGHT_AWS_TEST_ACCESS_KEY_ID'] end def self.account_number - @@account_number - end - def self.account_number=(newval) - @@account_number = newval + ENV['RIGHT_AWS_TEST_ACCOUNT_NUMBER'] end def self.aws_secret_access_key - @@aws_secret_access_key - end - def self.aws_secret_access_key=(newval) - @@aws_secret_access_key = newval - end - - def self.get_credentials - Dir.chdir do - begin - Dir.chdir('./.rightscale') do - require 'testcredentials' - end - rescue Exception => e - puts "Couldn't chdir to ~/.rightscale: #{e.message}" - end - end + ENV['RIGHT_AWS_TEST_SECRET_ACCESS_KEY'] end end