On Wed, Aug 13, 2008 at 06:15:04PM -0400, Mohammed Morsi
wrote:> Attached is a patch fixing a few things with the build system. Namely
> changes in autobuild.sh so that it works with the new changes made for
> the selenium integration, and changes to the vm controller, vm
> controller test, and permission fixture due to problems caused by recent
> changes.
>
> -Mo
> >From 73b27d4e104b0b23eccefbe50c710c7e0975407c Mon Sep 17 00:00:00 2001
> From: Mohammed Morsi <mmorsi at redhat.com>
> Date: Wed, 13 Aug 2008 18:08:01 -0400
> Subject: [PATCH] fixes to autobuild and tests due to recent changes
>
> ---
> autobuild.sh | 5 +-
> wui/src/app/controllers/vm_controller.rb | 3 +-
> wui/src/test/fixtures/permissions.yml | 100
++++++++++++++++++++++++-
> wui/src/test/functional/vm_controller_test.rb | 4 +-
> 4 files changed, 105 insertions(+), 7 deletions(-)
>
> diff --git a/autobuild.sh b/autobuild.sh
> index b565404..cb27221 100755
> --- a/autobuild.sh
> +++ b/autobuild.sh
> @@ -77,10 +77,11 @@ fi
> $ssh_cmd \
> "sed -i -e \"s/KrbMethodNegotiate on/KrbMethodNegotiate
off/g\" \
> -e \"s/KrbMethodK5Passwd off/KrbMethodK5Passwd on/g\"
\
> - /etc/httpd/conf.d/ovirt-wui.conf"
> + /etc/httpd/conf.d/ovirt-wui.conf && \
> + service httpd restart"
>
> echo "Running the wui tests"
> $ssh_cmd \
> - "curl -i --negotiate -u : management.priv.ovirt.org/ovirt/ | \
> + "curl -i http://admin:ovirt at management.priv.ovirt.org/ovirt/ |
\
This doesn't work. You'll just get a 302 redirect to
http://management.priv.ovirt.org/ovirt/login/login.
There may be a way to make curl negotiate this, but I tried
curl -c /tmp/cookies-file --include --location --location-trusted --user
admin:ovirt 'http://management.priv.ovirt.org/ovirt/'
without success.
This does work:
lynx -dump -accept-all-cookies -auth=admin:ovirt
'http://management.priv.ovirt.org/ovirt/'
but lynx exit status is zero, even for things like 404 errors...
> grep 'HTTP/1.1 200 OK' && \
...I see, however, that you're parsing the output and not depending on the
exit status. Not sure how to make lynx output the response headers, or even if
lynx is something you'd want to use.
> cd /usr/share/ovirt-wui && rake test"
> diff --git a/wui/src/app/controllers/vm_controller.rb
b/wui/src/app/controllers/vm_controller.rb
> index 4f9962d..a2415fa 100644
> --- a/wui/src/app/controllers/vm_controller.rb
> +++ b/wui/src/app/controllers/vm_controller.rb
> @@ -228,9 +228,10 @@ class VmController < ApplicationController
> params[:vm][:state] = Vm::STATE_PENDING
> vm_resource_pool_name = params[:vm_resource_pool_name]
> hardware_pool_id = params[:hardware_pool_id]
> + hardware_pool = HardwarePool.find(hardware_pool_id)
> if vm_resource_pool_name and hardware_pool_id
> vm_resource_pool = VmResourcePool.new({:name =>
vm_resource_pool_name})
> - vm_resource_pool.create_with_parent(hardware_pool_id)
> + vm_resource_pool.create_with_parent(hardware_pool)
> params[:vm][:vm_resource_pool_id] = vm_resource_pool.id
> end
> #set boot device to network for first boot (install)
> diff --git a/wui/src/test/fixtures/permissions.yml
b/wui/src/test/fixtures/permissions.yml
> index ded5865..e86a42e 100644
> --- a/wui/src/test/fixtures/permissions.yml
> +++ b/wui/src/test/fixtures/permissions.yml
> @@ -12,12 +12,12 @@ three:
> id: 3
> user_role: 'User'
> uid: 'buser'
> - pool_id: 3
> + pool_id: 10
> four:
> id: 4
> user_role: 'Monitor'
> uid: 'auser'
> - pool_id: 3
> + pool_id: 10
> five:
> id: 5
> user_role: 'Administrator'
> @@ -63,3 +63,99 @@ thirteen:
> user_role: 'User'
> uid: 'yuser'
> pool_id: 9
> +fourteen:
> + id: 14
> + user_role: 'Super Admin'
> + uid: 'ovirtadmin'
> + pool_id: 2
> + inherited_from_id: 1
> +fifteen:
> + id: 15
> + user_role: 'Super Admin'
> + uid: 'ovirtadmin'
> + pool_id: 3
> + inherited_from_id: 1
> +sixteen:
> + id: 16
> + user_role: 'Super Admin'
> + uid: 'ovirtadmin'
> + pool_id: 4
> + inherited_from_id: 1
> +seventeen:
> + id: 17
> + user_role: 'Super Admin'
> + uid: 'ovirtadmin'
> + pool_id: 5
> + inherited_from_id: 1
> +eighteen:
> + id: 18
> + user_role: 'Super Admin'
> + uid: 'ovirtadmin'
> + pool_id: 6
> + inherited_from_id: 1
> +nineteen:
> + id: 19
> + user_role: 'Super Admin'
> + uid: 'ovirtadmin'
> + pool_id: 7
> + inherited_from_id: 1
> +twenty:
> + id: 20
> + user_role: 'Super Admin'
> + uid: 'ovirtadmin'
> + pool_id: 8
> + inherited_from_id: 1
> +twentyone:
> + id: 21
> + user_role: 'Super Admin'
> + uid: 'ovirtadmin'
> + pool_id: 9
> + inherited_from_id: 1
> +twentytwo:
> + id: 22
> + user_role: 'Super Admin'
> + uid: 'ovirtadmin'
> + pool_id: 10
> + inherited_from_id: 1
> +twentythree:
> + id: 23
> + user_role: 'Administrator'
> + uid: 'jadmin'
> + pool_id: 4
> + inherited_from_id: 2
> +twentyfour:
> + id: 24
> + user_role: 'Administrator'
> + uid: 'jadmin'
> + pool_id: 5
> + inherited_from_id: 2
> +twentyfive:
> + id: 25
> + user_role: 'Administrator'
> + uid: 'jadmin'
> + pool_id: 6
> + inherited_from_id: 2
> +twentysix:
> + id: 26
> + user_role: 'Administrator'
> + uid: 'jadmin'
> + pool_id: 7
> + inherited_from_id: 2
> +twentyseven:
> + id: 27
> + user_role: 'Administrator'
> + uid: 'jadmin'
> + pool_id: 8
> + inherited_from_id: 2
> +twentyeight:
> + id: 28
> + user_role: 'Administrator'
> + uid: 'jadmin'
> + pool_id: 9
> + inherited_from_id: 2
> +twentynine:
> + id: 29
> + user_role: 'Administrator'
> + uid: 'jadmin'
> + pool_id: 10
> + inherited_from_id: 2
> diff --git a/wui/src/test/functional/vm_controller_test.rb
b/wui/src/test/functional/vm_controller_test.rb
> index 815321f..0817754 100644
> --- a/wui/src/test/functional/vm_controller_test.rb
> +++ b/wui/src/test/functional/vm_controller_test.rb
> @@ -47,8 +47,8 @@ class VmControllerTest < Test::Unit::TestCase
> def test_new
> get :new, :hardware_pool_id => 1
>
> - assert_response :success
> - assert_template 'new'
> + assert_response :redirect
> + assert_redirected_to :controller => 'resources', :action
=> 'show'
I should think that if the test suite is properly kinit-ed, this and other
similar assertions should still work.
>
> assert_not_nil assigns(:vm)
> end
> --
> 1.5.4.1
>
> _______________________________________________
> Ovirt-devel mailing list
> Ovirt-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/ovirt-devel