Tests with patches
by Jason Guiditta
I would like to draw a line in the sand on our project wrt testing.
>From this point forward (this does not include any patches already on
list), I will reply with a NACK and not review any patch that does not
include a cucumber test (if it is user-facing) or a spec (everything
else).
Preferably, this will take the form of an extra patch in the series
containing just the test. This patch should clearly show the
functionality being added/fixed, and fail when applied in isolation.
The reviewer should apply this patch first, run tests, and then apply
the 2nd patch containing the functionality. At this point all tests
should pass, and reviewer can proceed to give any feedback on structure
or design of the actual code that is being proposed. Exceptions to this
are items that are strictly css-related, or minor view markup that does
not cause existing tests to fail.
Note that this is not directed at anyone in particular (we have all been
guilty of this), but we have been talking about this for a very long
time now, and I think everyone is now fluent enough in our testing
frameworks that there is no excuse not to write tests for all new
functionality and/or bugfixes.
If anyone has any issues with this please let me know, otherwise, I
would encourage everyone to adopt this approach effective immediately.
-j
13 years, 10 months
[PATCH aggregator] Fixed error handling
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
* html_error_page chose layout by @layout, but @layout is nil when error
occurs (for example in controller) and then popup-error.rhtml template
is used (this template should be used for ajax-requests, shouldn't be?)
-> request.xhr? is used instead of @layout
* when @layout was set, html_error_page set only layout and not template, so
error wasn't displayed
-> added simple layout/error.rhtml
* passing of title and errmsg is now done with :locals, passing
with @title and @errmsg doesn't work, if TemplateError occurs (for example
use of undefined variable in template)
---
src/app/controllers/application_controller.rb | 10 +++++-----
src/app/views/layouts/error.rhtml | 4 ++++
src/app/views/layouts/popup-error.rhtml | 4 ++--
3 files changed, 11 insertions(+), 7 deletions(-)
create mode 100644 src/app/views/layouts/error.rhtml
diff --git a/src/app/controllers/application_controller.rb b/src/app/controllers/application_controller.rb
index a563d57..0bc3ca7 100644
--- a/src/app/controllers/application_controller.rb
+++ b/src/app/controllers/application_controller.rb
@@ -111,12 +111,12 @@ class ApplicationController < ActionController::Base
end
def html_error_page(title, msg)
- @title = title
- @errmsg = msg
- if @layout
- render :layout => 'aggregator'
+ if request.xhr?
+ render :template => 'layouts/popup-error', :layout => 'popup',
+ :locals => {:title => title, :errmsg => msg}
else
- render :template => 'layouts/popup-error', :layout => 'popup'
+ render :template => 'layouts/error', :layout => 'aggregator',
+ :locals => {:title => title, :errmsg => msg}
end
end
diff --git a/src/app/views/layouts/error.rhtml b/src/app/views/layouts/error.rhtml
new file mode 100644
index 0000000..094c13a
--- /dev/null
+++ b/src/app/views/layouts/error.rhtml
@@ -0,0 +1,4 @@
+<%- content_for :title do -%>
+ <%= title %>
+<%- end -%>
+<%= errmsg %>
diff --git a/src/app/views/layouts/popup-error.rhtml b/src/app/views/layouts/popup-error.rhtml
index 8e58a31..094c13a 100644
--- a/src/app/views/layouts/popup-error.rhtml
+++ b/src/app/views/layouts/popup-error.rhtml
@@ -1,4 +1,4 @@
<%- content_for :title do -%>
- <%= @title %>
+ <%= title %>
<%- end -%>
-<%= @errmsg %>
+<%= errmsg %>
--
1.7.0.1
13 years, 10 months
Instance instrumentation one more time
by Marek Goldmann
Hi guys,
Last time I checked, it wasn't decided how Deltacloud will support instance instrumentation (UserData on EC2 or file injection on some other Cloud providers). Can you please tell me what's the current status of this feature?
Thanks!
--Marek
13 years, 10 months
rubygem-cucumber testing
by Jason Guiditta
Michal has been nice enough to package up cucumber for us, but we need a
couple more reviews to get it pushed to stable sooner. If anyone has a
couple minutes, it is as simple as:
yum install rubygem-cucumber --enablerepo updates-testing
You should get version 0.8.5. Then, simply run:
rake cucumber
from the aggregator src/ dir. If it runs tests w/o blowing up, please
submit comment here:
https://admin.fedoraproject.org/updates/rubygem-cucumber-0.8.5-4.fc13
Thanks,
-j
13 years, 10 months
[PATCH aggregator] Add the 'builder' gem dependency.
by Jan Provazník
From: Tomas Sedovic <tsedovic(a)redhat.com>
It doesn't get installed automatically by anything else we use. This
makes sure that `rake gems:install` installs it with the rest.
---
src/config/environment.rb | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/config/environment.rb b/src/config/environment.rb
index 7863031..8d3e665 100644
--- a/src/config/environment.rb
+++ b/src/config/environment.rb
@@ -51,6 +51,7 @@ Rails::Initializer.run do |config|
config.gem "gnuplot"
config.gem "scruffy"
config.gem "compass", :version => ">= 0.10.2"
+ config.gem "builder", :version => ">= 2.0.0"
config.active_record.observers = :instance_observer, :task_observer
# Only load the plugins named here, in the order given. By default, all plugins
--
1.7.2.1
13 years, 10 months
Deltacloud API spec for DMTF
by marios@redhat.com
Hi,
attached pdf is the current version of Deltacloud API spec to be
submitted to the DMTF Cloud Management Working Group . I have to submit
this by tomorrow (Friday 13th) afternoon to meet the deadline so if
anyone has any comments/wants to add something please let me know before
then,
marios
13 years, 10 months
[PATCH aggregator] Sync instances state when listing all instances
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
For now condor supports only 'on-demand' state syncing, so
we have to sync state at least when listing instances.
condormatic_instances_sync_states method is already called when
listing instances in a pool, but we should sync state also when
listing all instances, shouldn't we?
---
src/app/controllers/instance_controller.rb | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/app/controllers/instance_controller.rb b/src/app/controllers/instance_controller.rb
index fcb237e..e94eea9 100644
--- a/src/app/controllers/instance_controller.rb
+++ b/src/app/controllers/instance_controller.rb
@@ -32,6 +32,9 @@ class InstanceController < ApplicationController
def index
require_privilege(Privilege::INSTANCE_VIEW)
+ # go to condor and sync the database to the real instance states
+ condormatic_instances_sync_states
+
@order_dir = params[:order_dir] == 'desc' ? 'desc' : 'asc'
@order = params[:order] || 'name'
@instances = Instance.search_filter(params[:search], Instance::SEARCHABLE_COLUMNS).paginate(
--
1.7.0.1
13 years, 10 months
DC Graphs
by Martyn Taylor
Hey guys,
I've attached examples of the 3 SVG graphs used for the Aggregator, please give any comments you may have.
I've changed the colour scheme slightly from the graphs on the design pages to make the graphs a little clearer (if required I can change this back). The area graph still needs a little work to smooth out the curves, but other than that and any suggestions you guys may have, I think we're pretty much there with these.
Cheers
Martyn
13 years, 10 months
[PATCH aggregator] Cucumber test for provider
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
---
src/features/provider.feature | 54 +++++++++++++++++++++++
src/features/step_definitions/pool_steps.rb | 2 +-
src/features/step_definitions/provider_steps.rb | 28 ++++++++++++
src/features/support/custom.rb | 15 ++++++-
src/features/support/paths.rb | 17 +++++--
5 files changed, 110 insertions(+), 6 deletions(-)
create mode 100644 src/features/provider.feature
create mode 100644 src/features/step_definitions/provider_steps.rb
diff --git a/src/features/provider.feature b/src/features/provider.feature
new file mode 100644
index 0000000..9c4aa52
--- /dev/null
+++ b/src/features/provider.feature
@@ -0,0 +1,54 @@
+Feature: Manage Providers
+ In order to manage my cloud infrastructure
+ As a user
+ I want to manage cloud providers
+
+ Background:
+ Given I am an authorised user
+ And I am logged in
+
+ Scenario: List providers
+ Given I am on the homepage
+ And there are these providers:
+ | name |
+ | provider1 |
+ | provider2 |
+ | provider3 |
+ When I follow "Settings"
+ Then I should see the following:
+ | provider1 |
+ | provider2 |
+ | provider3 |
+
+ Scenario: Show provider details
+ Given there is a provider named "testprovider"
+ And I am on the settings page
+ When I follow "testprovider"
+ Then I should see "Accounts"
+ And I should see "Realms"
+ And I should see "User access"
+ And I should see "Settings"
+
+ Scenario: Create a new Provider
+ Given I am on the settings page
+ And there is not a provider named "testprovider"
+ When I follow "Add a provider"
+ Then I should be on the new provider page
+ And I should see "Add a cloud provider"
+ When I fill in "provider[name]" with "testprovider"
+ And I fill in "provider[url]" with "http://localhost:3001/api"
+ And I press "Save"
+ Then I should be on the show provider page
+ And I should see "Provider added"
+ And I should have a provider named "testprovider"
+
+ Scenario: Delete a provider
+ Given there is a provider named "testprovider"
+ And I am on the settings page
+ Then I should see "testprovider"
+ When I follow "testprovider"
+ Then I should be on the show provider page
+ When I follow provider settings link
+ Then I should be on the provider settings page
+ When I delete provider
+ Then I should be on the providers page
diff --git a/src/features/step_definitions/pool_steps.rb b/src/features/step_definitions/pool_steps.rb
index af0cba1..75de2e2 100644
--- a/src/features/step_definitions/pool_steps.rb
+++ b/src/features/step_definitions/pool_steps.rb
@@ -67,4 +67,4 @@ Given /^the Pool has a quota with following capacities:$/ do |table|
@quota = Factory(:quota, quota_hash)
@pool.quota_id = @quota.id
@pool.save
-end
\ No newline at end of file
+end
diff --git a/src/features/step_definitions/provider_steps.rb b/src/features/step_definitions/provider_steps.rb
new file mode 100644
index 0000000..e593d43
--- /dev/null
+++ b/src/features/step_definitions/provider_steps.rb
@@ -0,0 +1,28 @@
+Given /^there is not a provider named "([^\"]*)"$/ do |name|
+ Provider.find_by_name(name).should be_nil
+end
+
+Given /^there is a provider named "([^\"]*)"$/ do |name|
+ @provider = Factory(:mock_provider, :name => name)
+end
+
+Then /^I should have a provider named "([^\"]*)"$/ do |name|
+ Provider.find_by_name(name).should_not be_nil
+end
+
+When /^I follow provider settings link$/ do
+ within '#provider-tabs' do |scope|
+ scope.click_link "Settings"
+ end
+end
+
+When /^I delete provider$/ do
+ click_button "Delete provider"
+end
+
+
+Given /^there are these providers:$/ do |table|
+ table.hashes.each do |hash|
+ Factory(:mock_provider, :name => hash['name'])
+ end
+end
diff --git a/src/features/support/custom.rb b/src/features/support/custom.rb
index e8801ba..446aa89 100644
--- a/src/features/support/custom.rb
+++ b/src/features/support/custom.rb
@@ -11,10 +11,23 @@ Provider.class_eval do
def valid_framework?
true
end
+
+ def set_cloud_type
+ self.cloud_type = Factory(:mock_provider).cloud_type
+ end
+
+ def populate_hardware_profiles
+ [[:mock_hwp1, :agg_hwp1], [:mock_hwp2, :agg_hwp2]].each do |mp_name, ap_name|
+ mock = Factory(mp_name, :provider_id => self.id)
+ agg_mock = Factory(ap_name, :external_key => self.name + Realm::AGGREGATOR_REALM_ACCOUNT_DELIMITER + mock.name)
+ agg_mock.provider_hardware_profiles << mock
+ end
+ return true
+ end
end
CloudAccount.class_eval do
def valid_credentials?
true
end
-end
\ No newline at end of file
+end
diff --git a/src/features/support/paths.rb b/src/features/support/paths.rb
index db20948..b7adf16 100644
--- a/src/features/support/paths.rb
+++ b/src/features/support/paths.rb
@@ -14,9 +14,6 @@ module NavigationHelpers
when /the new account page/
register_path
- when /the provider list page/
- '/'
-
when /the login page/
login_path
@@ -29,8 +26,17 @@ module NavigationHelpers
when /the login error page/
user_session_path
+ when /the providers page/
+ url_for :controller => 'provider', :action => 'index', :only_path => true
+
when /the new provider page/
- new_provider_path
+ url_for :controller => 'provider', :action => 'new', :only_path => true
+
+ when /the show provider page/
+ url_for :controller => 'provider', :action => 'show', :only_path => true
+
+ when /the provider settings page/
+ url_for :controller => 'provider', :action => 'settings', :only_path => true
when /the new pool page/
new_pool_path
@@ -50,6 +56,9 @@ module NavigationHelpers
when /the pool hardware profiles page/
hardware_profiles_pool_path
+ when /the settings page/
+ settings_path
+
# Add more mappings here.
# Here is an example that pulls values out of the Regexp:
#
--
1.7.0.1
13 years, 10 months