You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by rl...@redhat.com on 2012/12/12 00:09:50 UTC
CIMI - tests - incorporate other provider testing
Config.yaml and test_helper.rb changes to use the provider information added for the Deltacloud API tests.
Re: [PATCH] CIMI - tests - incorporate other provider testing
Posted by David Lutterkort <lu...@redhat.com>.
On Tue, 2012-12-11 at 18:09 -0500, rlandy@redhat.com wrote:
> From: Ronelle Landy <rl...@redhat.com>
>
> ---
> tests/cimi/test_helper.rb | 23 +++++++++++++----------
> tests/config.yaml | 18 +++++++-----------
> 2 files changed, 20 insertions(+), 21 deletions(-)
>
> diff --git a/tests/cimi/test_helper.rb b/tests/cimi/test_helper.rb
> index 025a705..ad74cd2 100644
> --- a/tests/cimi/test_helper.rb
> +++ b/tests/cimi/test_helper.rb
> @@ -32,12 +32,19 @@ module CIMI
> include Singleton
>
> def initialize
> - @hash = Deltacloud::Test::yaml_config
> - @cimi = @hash["cimi"]
> + @hash = Deltacloud::Test::yaml_config
> + end
> +
> + def driver
> + xml.xpath("/c:CloudEntryPoint/c:name", ns).text
> + end
The problem with this is that talking about a driver only makes sense in
the context of Deltacloud, but nor for CIMI providers in general. For
the CIMI tests, we should not have any mention of drivers anywhere.
Instead of introducing that notion, how about supporting a 'copy_from'
setting in the CIMI block, so that you can reuse settings for a
Deltacloud driver without needing to talk about drivers explicitly:
mock:
user: ...
...
cimi:
cep: http://...
copy_from: mock
In terms of code, when we load the config, just do something like
if from = @hash["cimi"]["copy_from"]
@hash["cimi"].update(@hash[from])
end
David
[PATCH] CIMI - tests - incorporate other provider testing
Posted by rl...@redhat.com.
From: Ronelle Landy <rl...@redhat.com>
---
tests/cimi/test_helper.rb | 23 +++++++++++++----------
tests/config.yaml | 18 +++++++-----------
2 files changed, 20 insertions(+), 21 deletions(-)
diff --git a/tests/cimi/test_helper.rb b/tests/cimi/test_helper.rb
index 025a705..ad74cd2 100644
--- a/tests/cimi/test_helper.rb
+++ b/tests/cimi/test_helper.rb
@@ -32,12 +32,19 @@ module CIMI
include Singleton
def initialize
- @hash = Deltacloud::Test::yaml_config
- @cimi = @hash["cimi"]
+ @hash = Deltacloud::Test::yaml_config
+ end
+
+ def driver
+ xml.xpath("/c:CloudEntryPoint/c:name", ns).text
+ end
+
+ def preferred
+ @hash[driver]["preferred"] || {}
end
def cep_url
- @cimi["cep"]
+ @hash["cep"]
end
def base_uri
@@ -45,23 +52,19 @@ module CIMI
end
def basic_auth(u = nil, p = nil)
- u ||= @cimi["user"]
- p ||= @cimi["password"]
+ u ||= @hash[driver]["user"]
+ p ||= @hash[driver]["password"]
"Basic #{Base64.encode64("#{u}:#{p}")}"
end
def auth_header
- if @cimi["user"]
+ if @hash[driver]["user"]
{ "Authorization" => basic_auth }
else
{}
end
end
- def preferred
- @cimi["preferred"] || {}
- end
-
def collections
xml.xpath("/c:CloudEntryPoint/c:*[@href]", ns).map { |c| c.name.to_sym }
end
diff --git a/tests/config.yaml b/tests/config.yaml
index b567923..e7b1b88 100644
--- a/tests/config.yaml
+++ b/tests/config.yaml
@@ -1,9 +1,16 @@
---
+# DELTACLOUD API TESTING
api_url: "http://localhost:3001/api"
+# CIMI TESTING
+cep: "http://localhost:3001/cimi/cloudEntryPoint"
#MOCK DRIVER CONFIG:
mock:
user: "mockuser"
password: "mockpassword"
+ preferred:
+ machineImage: "img2"
+ machineConfig: "m1-small"
+ volumeConfig: "2"
#OPENSTACK DRIVER CONFIG
openstack:
user:
@@ -39,14 +46,3 @@ fgcp:
image: "IMG_3c9820_D30U8UNY6I9S"
hardware_profile: "economy"
realm: "UZXC0GRT-ZG8ZJCJ07"
-
-
-# CIMI testing
-cimi:
- cep: "http://localhost:3001/cimi/cloudEntryPoint"
- user: "mockuser"
- password: "mockpassword"
- preferred:
- machineImage: "img2"
- machineConfig: "m1-small"
- volumeConfig: "2"
--
1.7.7.6