2012-08-29 05:43:31 +04:00
|
|
|
#-------------------------------------------------------------------------
|
2012-10-12 01:12:55 +04:00
|
|
|
# Copyright (c) Microsoft. All rights reserved.
|
2012-08-29 05:43:31 +04:00
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
#--------------------------------------------------------------------------
|
2012-06-15 01:45:06 +04:00
|
|
|
require "rake/testtask"
|
|
|
|
require "rubygems/package_task"
|
|
|
|
|
|
|
|
gem_spec = eval(File.read("./azure.gemspec"))
|
|
|
|
Gem::PackageTask.new(gem_spec) do |pkg|
|
|
|
|
pkg.need_zip = false
|
|
|
|
pkg.need_tar = false
|
|
|
|
end
|
|
|
|
|
|
|
|
namespace :test do
|
2012-07-07 02:59:00 +04:00
|
|
|
task :require_environment do
|
|
|
|
unset_environment = [
|
2012-07-12 18:58:28 +04:00
|
|
|
ENV.fetch("AZURE_STORAGE_ACCOUNT", nil),
|
|
|
|
ENV.fetch("AZURE_STORAGE_ACCESS_KEY", nil),
|
2012-10-26 16:54:36 +04:00
|
|
|
# ENV.fetch("AZURE_TABLE_HOST", nil),
|
|
|
|
# ENV.fetch("AZURE_BLOB_HOST", nil),
|
|
|
|
# ENV.fetch("AZURE_QUEUE_HOST", nil),
|
2012-07-12 18:58:28 +04:00
|
|
|
ENV.fetch("AZURE_SERVICEBUS_NAMESPACE", nil),
|
|
|
|
ENV.fetch("AZURE_SERVICEBUS_ACCESS_KEY", nil),
|
2012-10-26 16:54:36 +04:00
|
|
|
# ENV.fetch("AZURE_SERVICEBUS_ISSUER", nil)
|
2013-08-09 15:27:36 +04:00
|
|
|
ENV.fetch('AZURE_MANAGEMENT_CERTIFICATE', nil),
|
|
|
|
ENV.fetch('AZURE_SUBSCRIPTION_ID', nil),
|
|
|
|
ENV.fetch('AZURE_MANAGEMENT_ENDPOINT', nil)
|
2012-07-07 02:59:00 +04:00
|
|
|
].include?(nil)
|
|
|
|
|
|
|
|
abort "[ABORTING] Configure your environment to run the integration tests" if unset_environment
|
|
|
|
end
|
|
|
|
|
2012-06-15 01:45:06 +04:00
|
|
|
Rake::TestTask.new :unit do |t|
|
|
|
|
t.pattern = "test/unit/**/*_test.rb"
|
|
|
|
t.verbose = true
|
|
|
|
t.libs = ["lib", "test"]
|
|
|
|
end
|
2012-10-04 13:01:22 +04:00
|
|
|
|
|
|
|
namespace :unit do
|
|
|
|
def component_task(component)
|
|
|
|
Rake::TestTask.new component do |t|
|
|
|
|
t.pattern = "test/unit/#{component}/**/*_test.rb"
|
|
|
|
t.verbose = true
|
|
|
|
t.libs = ["lib", "test"]
|
|
|
|
end
|
|
|
|
|
|
|
|
task component => "test:require_environment"
|
|
|
|
end
|
|
|
|
|
|
|
|
component_task :core
|
2013-01-25 21:29:23 +04:00
|
|
|
component_task :blob
|
|
|
|
component_task :queue
|
|
|
|
component_task :service
|
|
|
|
component_task :table
|
2012-10-04 13:01:22 +04:00
|
|
|
component_task :service_bus
|
|
|
|
end
|
2012-06-15 01:45:06 +04:00
|
|
|
|
|
|
|
Rake::TestTask.new :integration do |t|
|
|
|
|
t.pattern = "test/integration/**/*_test.rb"
|
|
|
|
t.verbose = true
|
|
|
|
t.libs = ["lib", "test"]
|
|
|
|
end
|
|
|
|
|
2012-07-07 02:59:00 +04:00
|
|
|
task :integration => :require_environment
|
|
|
|
|
2012-06-15 01:45:06 +04:00
|
|
|
namespace :integration do
|
|
|
|
def component_task(component)
|
|
|
|
Rake::TestTask.new component do |t|
|
|
|
|
t.pattern = "test/integration/#{component}/**/*_test.rb"
|
|
|
|
t.verbose = true
|
|
|
|
t.libs = ["lib", "test"]
|
|
|
|
end
|
2012-07-07 02:59:00 +04:00
|
|
|
|
|
|
|
task component => "test:require_environment"
|
2012-06-15 01:45:06 +04:00
|
|
|
end
|
|
|
|
|
2012-10-26 16:54:36 +04:00
|
|
|
component_task :service_bus
|
2013-01-25 21:29:23 +04:00
|
|
|
component_task :blob
|
|
|
|
component_task :queue
|
|
|
|
component_task :table
|
2012-06-15 01:45:06 +04:00
|
|
|
end
|
|
|
|
|
2012-07-07 02:59:00 +04:00
|
|
|
task :cleanup => :require_environment do
|
2012-06-15 01:45:06 +04:00
|
|
|
$:.unshift "lib"
|
|
|
|
require 'azure'
|
|
|
|
|
|
|
|
Azure.configure do |config|
|
2012-07-12 18:58:28 +04:00
|
|
|
config.access_key = ENV.fetch("AZURE_STORAGE_ACCESS_KEY")
|
|
|
|
config.account_name = ENV.fetch("AZURE_STORAGE_ACCOUNT")
|
2012-10-26 16:54:36 +04:00
|
|
|
# config.table_host = ENV.fetch("AZURE_TABLE_HOST")
|
|
|
|
# config.blob_host = ENV.fetch("AZURE_BLOB_HOST")
|
|
|
|
# config.queue_host = ENV.fetch("AZURE_QUEUE_HOST")
|
2012-06-15 01:45:06 +04:00
|
|
|
|
2012-07-12 18:58:28 +04:00
|
|
|
config.acs_namespace = ENV.fetch("AZURE_SERVICEBUS_NAMESPACE")
|
|
|
|
config.sb_access_key = ENV.fetch("AZURE_SERVICEBUS_ACCESS_KEY")
|
2012-10-26 16:54:36 +04:00
|
|
|
# config.sb_issuer = ENV.fetch("AZURE_SERVICEBUS_ISSUER")
|
2013-08-09 15:27:36 +04:00
|
|
|
config.management_certificate = ENV.fetch('AZURE_MANAGEMENT_CERTIFICATE')
|
|
|
|
config.management_endpoint = ENV.fetch("AZURE_MANAGEMENT_ENDPOINT")
|
|
|
|
config.subscription_id = ENV.fetch("AZURE_SUBSCRIPTION_ID")
|
2012-06-15 01:45:06 +04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-07-07 02:59:00 +04:00
|
|
|
task :test => ["test:unit", "test:integration"]
|
2012-06-15 01:45:06 +04:00
|
|
|
|
2012-09-27 23:59:18 +04:00
|
|
|
task :default => :test
|