From 4568c3d0cdc8ac1ec012c32a5598a35a946cded1 Mon Sep 17 00:00:00 2001 From: Paulo Henrique Lopes Ribeiro Date: Mon, 2 Feb 2015 23:25:11 -0200 Subject: [PATCH 1/5] Remove RiakCS --- lib/fog/riakcs.rb | 2 - lib/fog/riakcs/core.rb | 121 ------------------ lib/fog/riakcs/provisioning.rb | 98 -------------- .../requests/provisioning/create_user.rb | 77 ----------- .../requests/provisioning/disable_user.rb | 23 ---- .../requests/provisioning/enable_user.rb | 23 ---- .../riakcs/requests/provisioning/get_user.rb | 41 ------ .../requests/provisioning/list_users.rb | 43 ------- .../requests/provisioning/regrant_secret.rb | 23 ---- .../requests/provisioning/update_user.rb | 23 ---- lib/fog/riakcs/requests/usage/get_usage.rb | 68 ---------- lib/fog/riakcs/usage.rb | 62 --------- 12 files changed, 604 deletions(-) delete mode 100644 lib/fog/riakcs.rb delete mode 100644 lib/fog/riakcs/core.rb delete mode 100644 lib/fog/riakcs/provisioning.rb delete mode 100644 lib/fog/riakcs/requests/provisioning/create_user.rb delete mode 100644 lib/fog/riakcs/requests/provisioning/disable_user.rb delete mode 100644 lib/fog/riakcs/requests/provisioning/enable_user.rb delete mode 100644 lib/fog/riakcs/requests/provisioning/get_user.rb delete mode 100644 lib/fog/riakcs/requests/provisioning/list_users.rb delete mode 100644 lib/fog/riakcs/requests/provisioning/regrant_secret.rb delete mode 100644 lib/fog/riakcs/requests/provisioning/update_user.rb delete mode 100644 lib/fog/riakcs/requests/usage/get_usage.rb delete mode 100644 lib/fog/riakcs/usage.rb diff --git a/lib/fog/riakcs.rb b/lib/fog/riakcs.rb deleted file mode 100644 index d904eb172..000000000 --- a/lib/fog/riakcs.rb +++ /dev/null @@ -1,2 +0,0 @@ -require 'fog/riakcs/provisioning' -require 'fog/riakcs/usage' diff --git a/lib/fog/riakcs/core.rb b/lib/fog/riakcs/core.rb deleted file mode 100644 index de79d0d73..000000000 --- a/lib/fog/riakcs/core.rb +++ /dev/null @@ -1,121 +0,0 @@ -require 'fog/core' -require 'fog/json' - -module Fog - module RiakCS - module MultipartUtils - require 'net/http' - - class Headers - include Net::HTTPHeader - - def initialize - initialize_http_header({}) - end - - # Parse a single header line into its key and value - # @param [String] chunk a single header line - def self.parse(chunk) - line = chunk.strip - # thanks Net::HTTPResponse - return [nil,nil] if chunk =~ /\AHTTP(?:\/(\d+\.\d+))?\s+(\d\d\d)\s*(.*)\z/in - m = /\A([^:]+):\s*/.match(line) - [m[1], m.post_match] rescue [nil, nil] - end - - # Parses a header line and adds it to the header collection - # @param [String] chunk a single header line - def parse(chunk) - key, value = self.class.parse(chunk) - add_field(key, value) if key && value - end - end - - def parse(data, boundary) - contents = data.match(end_boundary_regex(boundary)).pre_match rescue "" - contents.split(inner_boundary_regex(boundary)).reject(&:empty?).map do |part| - parse_multipart_section(part) - end.compact - end - - def extract_boundary(header_string) - $1 if header_string =~ /boundary=([A-Za-z0-9\'()+_,-.\/:=?]+)/ - end - - private - def end_boundary_regex(boundary) - /\r?\n--#{Regexp.escape(boundary)}--\r?\n?/ - end - - def inner_boundary_regex(boundary) - /\r?\n--#{Regexp.escape(boundary)}\r?\n/ - end - - def parse_multipart_section(part) - headers = Headers.new - if md = part.match(/\r?\n\r?\n/) - body = md.post_match - md.pre_match.split(/\r?\n/).each do |line| - headers.parse(line) - end - - if headers["content-type"] =~ /multipart\/mixed/ - boundary = extract_boundary(headers.to_hash["content-type"].first) - parse(body, boundary) - else - {:headers => headers.to_hash, :body => body} - end - end - end - end - - module UserUtils - def update_riakcs_user(key_id, user) - response = @s3_connection.put_object('riak-cs', "user/#{key_id}", Fog::JSON.encode(user), { 'Content-Type' => 'application/json' }) - if !response.body.empty? - response.body = Fog::JSON.decode(response.body) - end - response - end - - def update_mock_user(key_id, user) - if data[key_id] - if status = user[:status] - data[key_id][:status] = status - end - - if user[:new_key_secret] - data[key_id][:key_secret] = rand(100).to_s - end - - Excon::Response.new.tap do |response| - response.status = 200 - response.body = data[key_id] - end - else - Excon::Response.new.tap do |response| - response.status = 403 - end - end - end - end - - module Utils - def configure_uri_options(options = {}) - @host = options[:host] || 'localhost' - @persistent = options[:persistent] || true - @port = options[:port] || 8080 - @scheme = options[:scheme] || 'http' - end - - def riakcs_uri - "#{@scheme}://#{@host}:#{@port}" - end - end - - extend Fog::Provider - - service(:provisioning, 'Provisioning') - service(:usage, 'Usage') - end -end diff --git a/lib/fog/riakcs/provisioning.rb b/lib/fog/riakcs/provisioning.rb deleted file mode 100644 index 84681dcda..000000000 --- a/lib/fog/riakcs/provisioning.rb +++ /dev/null @@ -1,98 +0,0 @@ -require 'fog/riakcs/core' - -module Fog - module RiakCS - class Provisioning < Fog::Service - class UserAlreadyExists < Fog::RiakCS::Provisioning::Error; end - class ServiceUnavailable < Fog::RiakCS::Provisioning::Error; end - - requires :riakcs_access_key_id, :riakcs_secret_access_key - recognizes :host, :path, :port, :scheme, :persistent, :path_style - - request_path 'fog/riakcs/requests/provisioning' - request :create_user - request :update_user - request :disable_user - request :enable_user - request :list_users - request :get_user - request :regrant_secret - - class Mock - include Utils - - def self.data - @data ||= Hash.new({}) - end - - def self.reset - @data = nil - end - - def initialize(options = {}) - configure_uri_options(options) - end - - def data - self.class.data[riakcs_uri] - end - - def reset_data - self.class.data.delete(riakcs_uri) - end - end - - class Real - include Utils - - def initialize(options = {}) - configure_uri_options(options) - @riakcs_access_key_id = options[:riakcs_access_key_id] - @riakcs_secret_access_key = options[:riakcs_secret_access_key] - @connection_options = options[:connection_options] || {} - @persistent = options[:persistent] || false - @path_style = options[:path_style] || false - - @raw_connection = Fog::XML::Connection.new(riakcs_uri, @persistent, @connection_options) - - @s3_connection = Fog::Storage.new( - :provider => 'AWS', - :aws_access_key_id => @riakcs_access_key_id, - :aws_secret_access_key => @riakcs_secret_access_key, - :host => @host, - :port => @port, - :scheme => @scheme, - :path_style => @path_style, - :connection_options => @connection_options - ) - end - - def request(params, parse_response = true, &block) - begin - response = @raw_connection.request(params.merge({ - :host => @host, - :path => "#{@path}/#{params[:path]}", - }), &block) - rescue Excon::Errors::HTTPStatusError => error - if match = error.message.match(/(.*?)<\/Code>(?:.*(.*?)<\/Message>)?/m) - case match[1] - when 'UserAlreadyExists' - raise Fog::RiakCS::Provisioning.const_get(match[1]).new - when 'ServiceUnavailable' - raise Fog::RiakCS::Provisioning.const_get(match[1]).new - else - raise error - end - else - raise error - end - end - if !response.body.empty? && parse_response - response.body = Fog::JSON.decode(response.body) - end - response - end - end - end - end -end diff --git a/lib/fog/riakcs/requests/provisioning/create_user.rb b/lib/fog/riakcs/requests/provisioning/create_user.rb deleted file mode 100644 index ebea19995..000000000 --- a/lib/fog/riakcs/requests/provisioning/create_user.rb +++ /dev/null @@ -1,77 +0,0 @@ -module Fog - module RiakCS - class Provisioning - class Real - def create_user(email, name, options = {}) - payload = Fog::JSON.encode({ :email => email, :name => name }) - headers = { 'Content-Type' => 'application/json' } - - if(options[:anonymous]) - request( - :expects => [201], - :method => 'POST', - :path => 'user', - :body => payload, - :headers => headers - ) - else - begin - response = @s3_connection.put_object('riak-cs', 'user', payload, headers) - if !response.body.empty? - case response.headers['Content-Type'] - when 'application/json' - response.body = Fog::JSON.decode(response.body) - end - end - response - rescue Excon::Errors::Conflict => e - raise Fog::RiakCS::Provisioning::UserAlreadyExists.new - rescue Excon::Errors::BadRequest => e - raise Fog::RiakCS::Provisioning::ServiceUnavailable.new - end - end - end - end - - class Mock - def invalid_email?(email) - !email.include?('@') - end - - def user_exists?(email) - data.find do |key, value| - value[:email] == email - end - end - - def create_user(email, name, options = {}) - if invalid_email?(email) - raise Fog::RiakCS::Provisioning::ServiceUnavailable, "The email address you provided is not a valid." - end - - if user_exists?(email) - raise Fog::RiakCS::Provisioning::UserAlreadyExists, "User with email #{email} already exists." - end - - key_id = rand(1000).to_s - key_secret = rand(1000).to_s - data[key_id] = { :email => email, :name => name, :status => 'enabled', :key_secret => key_secret } - - Excon::Response.new.tap do |response| - response.status = 200 - response.headers['Content-Type'] = 'application/json' - response.body = { - "email" => data[:email], - "display_name" => data[:name], - "name" => "user123", - "key_id" => key_id, - "key_secret" => key_secret, - "id" => "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "status" => "enabled" - } - end - end - end - end - end -end diff --git a/lib/fog/riakcs/requests/provisioning/disable_user.rb b/lib/fog/riakcs/requests/provisioning/disable_user.rb deleted file mode 100644 index 1ed7705a4..000000000 --- a/lib/fog/riakcs/requests/provisioning/disable_user.rb +++ /dev/null @@ -1,23 +0,0 @@ -module Fog - module RiakCS - class Provisioning - class Real - include Utils - include UserUtils - include MultipartUtils - - def disable_user(key_id) - update_riakcs_user(key_id, { :status => 'disabled' }) - end - end - - class Mock - include UserUtils - - def disable_user(key_id) - update_mock_user(key_id, { :status => 'disabled' }) - end - end - end - end -end diff --git a/lib/fog/riakcs/requests/provisioning/enable_user.rb b/lib/fog/riakcs/requests/provisioning/enable_user.rb deleted file mode 100644 index d2556e3bc..000000000 --- a/lib/fog/riakcs/requests/provisioning/enable_user.rb +++ /dev/null @@ -1,23 +0,0 @@ -module Fog - module RiakCS - class Provisioning - class Real - include Utils - include UserUtils - include MultipartUtils - - def enable_user(key_id) - update_riakcs_user(key_id, { :status => 'enabled' }) - end - end - - class Mock - include UserUtils - - def enable_user(key_id) - update_mock_user(key_id, { :status => 'enabled' }) - end - end - end - end -end diff --git a/lib/fog/riakcs/requests/provisioning/get_user.rb b/lib/fog/riakcs/requests/provisioning/get_user.rb deleted file mode 100644 index 914861d7b..000000000 --- a/lib/fog/riakcs/requests/provisioning/get_user.rb +++ /dev/null @@ -1,41 +0,0 @@ -module Fog - module RiakCS - class Provisioning - class Real - include Utils - include MultipartUtils - - def get_user(key_id) - response = @s3_connection.get_object('riak-cs', "user/#{key_id}", { 'Accept' => 'application/json' }) - response.body = Fog::JSON.decode(response.body) - response - end - end - - class Mock - def get_user(key_id) - if user = data[key_id] - Excon::Response.new.tap do |response| - response.status = 200 - response.headers['Content-Type'] = 'application/json' - response.body = { - "email" => user[:email], - "display_name" => user[:name], - "name" => "user123", - "key_id" => "XXXXXXXXXXXXXXXXXXXX", - "key_secret" => user[:key_secret], - "id" => "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "status" => user[:status] - } - end - else - Excon::Response.new.tap do |response| - response.status = 404 - response.headers['Content-Type'] = 'application/json' - end - end - end - end - end - end -end diff --git a/lib/fog/riakcs/requests/provisioning/list_users.rb b/lib/fog/riakcs/requests/provisioning/list_users.rb deleted file mode 100644 index cd3a2dba6..000000000 --- a/lib/fog/riakcs/requests/provisioning/list_users.rb +++ /dev/null @@ -1,43 +0,0 @@ -module Fog - module RiakCS - class Provisioning - class Real - include Utils - include MultipartUtils - - def list_users(options = {}) - response = @s3_connection.get_object('riak-cs', 'users', { 'Accept' => 'application/json', 'query' => options }) - - boundary = extract_boundary(response.headers['Content-Type']) - parts = parse(response.body, boundary) - decoded = parts.map { |part| Fog::JSON.decode(part[:body]) } - - response.body = decoded.flatten - - response - end - end - - class Mock - def list_users(options = {}) - filtered_data = options[:status] ? data.select { |key, value| value[:status] == options[:status] } : data - - Excon::Response.new.tap do |response| - response.status = 200 - response.body = filtered_data.map do |key, value| - { - "email" => value[:email], - "display_name" => value[:name], - "name" => "user123", - "key_id" => key, - "key_secret" => value[:key_secret], - "id" => "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "status" => value[:status] - } - end.compact - end - end - end - end - end -end diff --git a/lib/fog/riakcs/requests/provisioning/regrant_secret.rb b/lib/fog/riakcs/requests/provisioning/regrant_secret.rb deleted file mode 100644 index a04fff8cf..000000000 --- a/lib/fog/riakcs/requests/provisioning/regrant_secret.rb +++ /dev/null @@ -1,23 +0,0 @@ -module Fog - module RiakCS - class Provisioning - class Real - include Utils - include UserUtils - include MultipartUtils - - def regrant_secret(key_id) - update_riakcs_user(key_id, { :new_key_secret => true }) - end - end - - class Mock - include UserUtils - - def regrant_secret(key_id) - update_mock_user(key_id, { :new_key_secret => true }) - end - end - end - end -end diff --git a/lib/fog/riakcs/requests/provisioning/update_user.rb b/lib/fog/riakcs/requests/provisioning/update_user.rb deleted file mode 100644 index 40abb0fdf..000000000 --- a/lib/fog/riakcs/requests/provisioning/update_user.rb +++ /dev/null @@ -1,23 +0,0 @@ -module Fog - module RiakCS - class Provisioning - class Real - include Utils - include UserUtils - include MultipartUtils - - def update_user(key_id, user) - update_riakcs_user(key_id, user) - end - end - - class Mock - include UserUtils - - def update_user(key_id, user) - update_mock_user(key_id, user) - end - end - end - end -end diff --git a/lib/fog/riakcs/requests/usage/get_usage.rb b/lib/fog/riakcs/requests/usage/get_usage.rb deleted file mode 100644 index c8831167e..000000000 --- a/lib/fog/riakcs/requests/usage/get_usage.rb +++ /dev/null @@ -1,68 +0,0 @@ -module Fog - module RiakCS - class Usage - module Utils - TYPES_TO_STRING = { :access => 'a', :storage => 'b' } - DEFAULT_TYPES = TYPES_TO_STRING.keys - DEFAULT_FORMAT = :json - - def sanitize_and_convert_time(time) - time.utc.iso8601.gsub(/[:-]/, '') - end - - def format_and_types_to_path(format, types) - format_character = format.to_s.split('').first - type_characters = types.map { |t| TYPES_TO_STRING[t] }.compact - - [type_characters, format_character].flatten.compact.join - end - - def request_uri(access_key_id, options) - format = DEFAULT_FORMAT - types = options[:types] || DEFAULT_TYPES - start_time = options[:start_time] || Time.now.utc - 86400 - end_time = options[:end_time] || Time.now.utc - - [access_key_id, - format_and_types_to_path(format, types), - sanitize_and_convert_time(start_time), - sanitize_and_convert_time(end_time)].join('.') - end - end - - class Real - include Utils - - def get_usage(access_key_id, options = {}) - response = @connection.get_object('riak-cs', ["usage", request_uri(access_key_id, options)].join("/")) - - if !response.body.empty? - response.body = Fog::JSON.decode(response.body) - end - response - end - end - - class Mock - include Utils - - def get_usage(access_key, options = {}) - Excon::Response.new.tap do |response| - response.status = 200 - response.headers['Content-Type'] = 'application/json' - response.body = { - 'Access' => { - 'Nodes' => [], - 'Errors' => [] - }, - 'Storage' => { - 'Samples' => [], - 'Errors' => [] - } - } - end - end - end - end - end -end diff --git a/lib/fog/riakcs/usage.rb b/lib/fog/riakcs/usage.rb deleted file mode 100644 index 241a1471c..000000000 --- a/lib/fog/riakcs/usage.rb +++ /dev/null @@ -1,62 +0,0 @@ -require 'fog/riakcs/core' -require 'time' - -module Fog - module RiakCS - class Usage < Fog::Service - requires :riakcs_access_key_id, :riakcs_secret_access_key - recognizes :host, :path, :port, :scheme, :persistent - - request_path 'fog/riakcs/requests/usage' - request :get_usage - - class Mock - include Utils - - def self.data - @data ||= Hash.new do |hash, key| - hash[key] = {} - end - end - - def self.reset - @data = nil - end - - def initialize(options = {}) - configure_uri_options(options) - end - - def data - self.class.data[riakcs_uri] - end - - def reset_data - self.class.data.delete(riakcs_uri) - end - end - - class Real - include Utils - - def initialize(options = {}) - configure_uri_options(options) - @riakcs_access_key_id = options[:riakcs_access_key_id] - @riakcs_secret_access_key = options[:riakcs_secret_access_key] - @connection_options = options[:connection_options] || {} - @persistent = options[:persistent] || false - - @connection = Fog::Storage.new( - :provider => 'AWS', - :aws_access_key_id => @riakcs_access_key_id, - :aws_secret_access_key => @riakcs_secret_access_key, - :host => @host, - :port => @port, - :scheme => @scheme, - :connection_options => @connection_options - ) - end - end - end - end -end From b39056559ee5b18dc443253d8d9af92aec96fcbb Mon Sep 17 00:00:00 2001 From: Paulo Henrique Lopes Ribeiro Date: Mon, 2 Feb 2015 23:25:44 -0200 Subject: [PATCH 2/5] Remove tests --- .../provisioning/provisioning_tests.rb | 174 ------------------ tests/riakcs/requests/usage/usage_tests.rb | 29 --- 2 files changed, 203 deletions(-) delete mode 100644 tests/riakcs/requests/provisioning/provisioning_tests.rb delete mode 100644 tests/riakcs/requests/usage/usage_tests.rb diff --git a/tests/riakcs/requests/provisioning/provisioning_tests.rb b/tests/riakcs/requests/provisioning/provisioning_tests.rb deleted file mode 100644 index 43d6dfabc..000000000 --- a/tests/riakcs/requests/provisioning/provisioning_tests.rb +++ /dev/null @@ -1,174 +0,0 @@ -Shindo.tests('RiakCS::Provisioning | provisioning requests', ['riakcs']) do - - current_timestamp = Time.now.to_i - - user_format = { - 'email' => String, - 'display_name' => String, - 'name' => String, - 'key_id' => String, - 'key_secret' => String, - 'id' => String, - 'status' => String, - } - - tests('User creation') do - - tests('is successful').returns(String) do - - # Create a user. - # - email, name = "successful_user_creation_test_#{current_timestamp}@example.com", "Fog User" - key_id = Fog::RiakCS[:provisioning].create_user(email, name).body['key_id'] - key_id.class - - end - - tests('is successful anonymously').returns(String) do - - # Create a user. - # - email, name = "successful_anonymous_user_creation_test_#{current_timestamp}@example.com", "Fog User" - key_id = Fog::RiakCS[:provisioning].create_user(email, name, :anonymous => true).body['key_id'] - key_id.class - - end - - tests('fails if duplicate').raises(Fog::RiakCS::Provisioning::UserAlreadyExists) do - 2.times do - email, name = "failed_duplicate_user_creation_test_#{current_timestamp}@example.com", "Fog User" - key_id = Fog::RiakCS[:provisioning].create_user(email, name).body['key_id'] - end - end - - tests('fails if invalid email').raises(Fog::RiakCS::Provisioning::ServiceUnavailable) do - email, name = "failed_duplicate_user_creation_test_#{current_timestamp}", "Fog User" - key_id = Fog::RiakCS[:provisioning].create_user(email, name).body['key_id'] - end - - end - - tests('User disable') do - - tests('is successful').returns(200) do - - # Create a user. - # - email, name = "successful_user_disable_test_#{current_timestamp}@example.com", "Fog User" - key_id = Fog::RiakCS[:provisioning].create_user(email, name).body['key_id'] - - Fog::RiakCS[:provisioning].disable_user(key_id).status - - end - - end - - tests('User enable') do - - tests('is successful').returns(200) do - - # Create a user. - # - email, name = "successful_user_disable_enable_test_#{current_timestamp}@example.com", "Fog User" - key_id = Fog::RiakCS[:provisioning].create_user(email, name).body['key_id'] - - Fog::RiakCS[:provisioning].disable_user(key_id).status - Fog::RiakCS[:provisioning].enable_user(key_id).status - - end - - end - - tests('User granted new key secret') do - - tests('is successful').returns(true) do - - # Create a user. - # - email, name = "successful_user_regrant_test_#{current_timestamp}@example.com", "Fog User" - user = Fog::RiakCS[:provisioning].create_user(email, name).body - key_id, key_secret = user['key_id'], user['key_secret'] - - Fog::RiakCS[:provisioning].regrant_secret(key_id).status - - # Verify new secret. - # - new_key_secret = Fog::RiakCS[:provisioning].get_user(key_id).body['key_secret'] - new_key_secret != key_secret - - end - - end - - tests('User retrieval') do - - tests('is successful').formats(user_format) do - - # Create a user. - # - email, name = "user_retrieval_test_#{current_timestamp}@example.com", "Fog User" - key_id = Fog::RiakCS[:provisioning].create_user(email, name).body['key_id'] - - # Get user details. - # - Fog::RiakCS[:provisioning].get_user(key_id).body - - end - - end - - tests('User listing') do - - tests('sucessfully lists users').formats(user_format) do - - # Create a user. - # - email, name = "user_listing_test_#{current_timestamp}@example.com", "Fog User" - key_id = Fog::RiakCS[:provisioning].create_user(email, name).body['key_id'] - - # Ensure the list users response contains the user that we just - # created. - # - Fog::RiakCS[:provisioning].list_users.body.select { |x| x['email'] == email }.first - - end - - tests('successfully lists users containing no disabled users').returns(nil) do - - # Create a user. - # - email, name = "user_listing_without_disabled_users_test_#{current_timestamp}@example.com", "Fog User" - key_id = Fog::RiakCS[:provisioning].create_user(email, name).body['key_id'] - - # Disable that user. - # - Fog::RiakCS[:provisioning].disable_user(key_id) - - # Ensure the list users response does not contain the user that we - # just created and disabled. - # - Fog::RiakCS[:provisioning].list_users(:status => :enabled).body.select { |x| x['Email'] == email }.first - - end - - tests('successfully lists users containing disabled users').formats(user_format) do - - # Create a user. - # - email, name = "user_listing_with_disabled_users_test_#{current_timestamp}@example.com", "Fog User" - key_id = Fog::RiakCS[:provisioning].create_user(email, name).body['key_id'] - - # Disable that user. - # - Fog::RiakCS[:provisioning].disable_user(key_id) - - # Ensure the list users response contains the user that we just - # created and disabled. - # - Fog::RiakCS[:provisioning].list_users.body.select { |x| x['email'] == email }.first - - end - - end - -end diff --git a/tests/riakcs/requests/usage/usage_tests.rb b/tests/riakcs/requests/usage/usage_tests.rb deleted file mode 100644 index b25df9901..000000000 --- a/tests/riakcs/requests/usage/usage_tests.rb +++ /dev/null @@ -1,29 +0,0 @@ -Shindo.tests('RiakCS::Usage | usage requests', ['riakcs']) do - - @blank_usage_format = { - 'Access' => { - 'Nodes' => [], - 'Errors' => [] - }, - 'Storage' => { - 'Samples' => [], - 'Errors' => [] - } - } - - tests('Statistics retrieval with no data returned') do - - start_time = Time.now.utc + 86400 - end_time = start_time + 86400 - - tests('via JSON').returns(@blank_usage_format) do - - Fog::RiakCS[:usage].get_usage(Fog.credentials[:riakcs_access_key_id], - :types => [:access, :storage], - :start_time => start_time, - :end_time => end_time).body - - end - end - -end From 4f5197410efecdd2280cd6f5df0111962c5b5f85 Mon Sep 17 00:00:00 2001 From: Paulo Henrique Lopes Ribeiro Date: Mon, 2 Feb 2015 23:27:07 -0200 Subject: [PATCH 3/5] Remove unused credentials --- tests/helpers/mock_helper.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/helpers/mock_helper.rb b/tests/helpers/mock_helper.rb index c3de9f28f..6b304c3fd 100644 --- a/tests/helpers/mock_helper.rb +++ b/tests/helpers/mock_helper.rb @@ -76,12 +76,8 @@ if Fog.mock? :rackspace_api_key => 'rackspace_api_key', :rackspace_region => 'dfw', :rackspace_username => 'rackspace_username', - :riakcs_access_key_id => 'riakcs_access_key_id', - :riakcs_secret_access_key => 'riakcs_secret_access_key', :sakuracloud_api_token => 'sakuracloud_api_token', :sakuracloud_api_token_secret => 'sakuracloud_api_token_secret', - :storm_on_demand_username => 'storm_on_demand_username', - :storm_on_demand_password => 'storm_on_demand_password', :vcloud_host => 'vcloud_host', :vcloud_password => 'vcloud_password', :vcloud_username => 'vcloud_username', From 920ac17b2886ce6d50a83c3022f231d2187e3708 Mon Sep 17 00:00:00 2001 From: Paulo Henrique Lopes Ribeiro Date: Mon, 2 Feb 2015 23:27:45 -0200 Subject: [PATCH 4/5] Remove Bin --- lib/fog/bin/riakcs.rb | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 lib/fog/bin/riakcs.rb diff --git a/lib/fog/bin/riakcs.rb b/lib/fog/bin/riakcs.rb deleted file mode 100644 index a7abade7f..000000000 --- a/lib/fog/bin/riakcs.rb +++ /dev/null @@ -1,25 +0,0 @@ -class RiakCS < Fog::Bin - class << self - def class_for(key) - case key - when :provisioning - Fog::RiakCS::Provisioning - when :usage - Fog::RiakCS::Usage - else - raise ArgumentError, "Unrecognized service: #{key}" - end - end - - def [](service) - @@connections ||= Hash.new do |hash, key| - hash[key] = class_for(key) - end - @@connections[service] - end - - def services - Fog::RiakCS.services - end - end -end From 642429934986efc8691d9796c037de3c107fdb6c Mon Sep 17 00:00:00 2001 From: Paulo Henrique Lopes Ribeiro Date: Mon, 2 Feb 2015 23:31:08 -0200 Subject: [PATCH 5/5] Add Fog::RiakCS as dependency --- fog.gemspec | 1 + 1 file changed, 1 insertion(+) diff --git a/fog.gemspec b/fog.gemspec index f13943e0a..41c34804d 100644 --- a/fog.gemspec +++ b/fog.gemspec @@ -67,6 +67,7 @@ Gem::Specification.new do |s| s.add_dependency("fog-storm_on_demand") s.add_dependency("fog-atmos") s.add_dependency("fog-serverlove") + s.add_dependency("fog-riakcs") # Disabled until Rackspace isn't broken, see fog-rackspace#10 #s.add_dependency("fog-rackspace")