From: Martyn Taylor <[email protected]>

---
 src/features/hardware_profile.feature              |   51 ++++++++++++++++++++
 .../step_definitions/hardware_profile_steps.rb     |   22 ++++++++
 2 files changed, 73 insertions(+), 0 deletions(-)
 create mode 100644 src/features/hardware_profile.feature
 create mode 100644 src/features/step_definitions/hardware_profile_steps.rb

diff --git a/src/features/hardware_profile.feature 
b/src/features/hardware_profile.feature
new file mode 100644
index 0000000..6f1cc81
--- /dev/null
+++ b/src/features/hardware_profile.feature
@@ -0,0 +1,51 @@
+Feature: Manage Pools
+  In order to manage my cloud infrastructure
+  As an admin
+  I want to manage Hardware Profiles
+
+  Background:
+    Given I am an authorised user
+    And I am logged in
+    And I am using new UI
+
+  Scenario: View front end hardware profiles
+    Given there are the following aggregator hardware profiles:
+    | name      | memory | cpu |storage  | architecture |
+    | m1-small  | 1740   | 2   | 160     | i386         |
+    | m1-large  | 4096   | 4   | 850     | x86_64       |
+    | m1-xlarge | 8192   | 8   | 1690    | x86_64       |
+    And I am on the the hardware profiles page
+    Then I should see the following:
+    | Hardware Profile Name | Memory | Virtual CPU | Storage   | Architecture |
+    | m1-small              | 1740   | 2           | 160       | i386         |
+    | m1-large              | 4096   | 4           | 850       | x86_64       |
+    | m1-xlarge             | 8192   | 8           | 1690      | x86_64       |
+
+  Scenario: View a Hardware Profiles Properties
+    Given there are the following aggregator hardware profiles:
+    | name      | memory | cpu |storage  | architecture |
+    | m1-small  | 1740   | 2   | 160     | i386         |
+    | m1-large  | 4096   | 4   | 850     | x86_64       |
+    | m1-xlarge | 8192   | 8   | 1690    | x86_64       |
+    And I am on the the hardware profiles page
+    When I follow "m1-small"
+    Then I should see the following:
+    | Name         | Kind  | Range First | Range Last | Enum Entries | Default 
Value | Unit  |
+    | memory       | fixed | n/a         | n/a        | n/a          | 1740    
      | MB    |
+    | cpu          | fixed | n/a         | n/a        | n/a          | 2       
      | count |
+    | storage      | fixed | n/a         | n/a        | n/a          | 160     
      | GB    |
+    | architecture | fixed | n/a         | n/a        | n/a          | i386    
      | label |
+
+  Scenario: View a Front End Hardware Profiles Matching Provider Hardware 
Profiles
+    Given there are the following aggregator hardware profiles:
+    | name      | memory | cpu |storage  | architecture |
+    | m1-small  | 1740   | 2   | 160     | i386         |
+    And the Hardare Profile "m1-small" has the following Provider Hardware 
Profiles:
+    | name      | memory | cpu |storage  | architecture |
+    | m1-small  | 1740   | 2   | 160     | i386         |
+    And I am on the hardware profiles page
+    When I follow "m1-small"
+    And I follow "Matching Provider Hardware Profiles"
+    Then I should see the following:
+    | Name      | Memory | CPU | Storage  | Architecture |
+    | m1-small  | 1740   | 2   | 160      | i386         |
\ No newline at end of file
diff --git a/src/features/step_definitions/hardware_profile_steps.rb 
b/src/features/step_definitions/hardware_profile_steps.rb
new file mode 100644
index 0000000..d29d136
--- /dev/null
+++ b/src/features/step_definitions/hardware_profile_steps.rb
@@ -0,0 +1,22 @@
+Given /^there are the following aggregator hardware profiles:$/ do |table|
+  table.hashes.each do |hash|
+    create_hwp(hash)
+  end
+end
+
+Given /^the Hardare Profile "([^"]*)" has the following Provider Hardware 
Profiles:$/ do |name, table|
+  provider = Factory :mock_provider
+  front_end_hwp = HardwareProfile.find_by_name(name)
+  back_end_hwps = table.hashes.collect { |hash| create_hwp(hash, provider) }
+
+  front_end_hwp.provider_hardware_profiles = back_end_hwps
+  front_end_hwp.save!
+end
+
+def create_hwp(hash, provider=nil)
+  memory = Factory(:mock_hwp1_memory, :value => hash[:memory])
+  storage = Factory(:mock_hwp1_storage, :value => hash[:storage])
+  cpu = Factory(:mock_hwp1_cpu, :value => hash[:cpu])
+  arch = Factory(:mock_hwp1_arch, :value => hash[:architecture])
+  Factory(:mock_hwp1, :name => hash[:name], :memory => memory, :cpu => cpu, 
:storage => storage, :architecture => arch, :provider => provider)
+end
\ No newline at end of file
-- 
1.7.2.3

_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to