You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by Dave Johnson <da...@redhat.com> on 2012/06/07 18:24:52 UTC

[PATCH] allow multiple mock provider accounts

Ultimately needed for some unrelated conductor QE testing
---
 server/lib/deltacloud/drivers/mock/mock_driver.rb |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/server/lib/deltacloud/drivers/mock/mock_driver.rb b/server/lib/deltacloud/drivers/mock/mock_driver.rb
index ba817c6..cce4f48 100644
--- a/server/lib/deltacloud/drivers/mock/mock_driver.rb
+++ b/server/lib/deltacloud/drivers/mock/mock_driver.rb
@@ -460,7 +460,7 @@ module Deltacloud::Drivers::Mock
 
     def check_credentials(credentials)
       safely do
-        if ( credentials.user != 'mockuser' ) or ( credentials.password != 'mockpassword' )
+        if ( ! credentials.user.include? 'mockuser' ) or ( ! credentials.password.include? 'mockpassword' )
           raise 'AuthFailure'
         end
       end
-- 
1.7.7.6


Re: [PATCH] allow multiple mock provider accounts

Posted by David Lutterkort <lu...@redhat.com>.
On Fri, 2012-06-08 at 09:36 +0300, marios@redhat.com wrote:
> On 08/06/12 02:30, Francesco Vollero wrote:
> > Hi Dave,
> > 
> > On Thu, Jun 7, 2012 at 6:24 PM, Dave Johnson <da...@redhat.com> wrote:
> >> Ultimately needed for some unrelated conductor QE testing
> > 
> > Nack.
> 
> +1 - needs a bit more explanation about what/why this is needed.

I like the idea of multiple mock users, but I'd structure it slightly
differently. Shouldn't the storage for the mock driver be scoped by
user ? IOW, shouldn't mockuser01 and mockuser02 see completely different
sets of resources ?

Also: should we set up different mock users explicitly, or is it enough
for your use case that they are created implicitly just by using them ?
And if so, shouldn't we initialize the mock user's resources with stock
resources ?

David



Re: [PATCH] allow multiple mock provider accounts

Posted by "marios@redhat.com" <ma...@redhat.com>.
On 08/06/12 02:30, Francesco Vollero wrote:
> Hi Dave,
> 
> On Thu, Jun 7, 2012 at 6:24 PM, Dave Johnson <da...@redhat.com> wrote:
>> Ultimately needed for some unrelated conductor QE testing
> 
> Nack.

+1 - needs a bit more explanation about what/why this is needed.
Depending on what this is needed for, a more palatable solution may be
to keep the existing functionality and do what you are seeking as an
addition. This could be a separate method in mock driver (def
check_credentials_regex) or within the existing check_credentials but
without overriding expected/default behaviour (as Francesco alludes to -
this is used in our tests): like


def check_credentials(credentials, strict=true)
	if strict
		raise 'AuthFailure' if (( credentials.user != 'mockuser' ) or (
credentials.password != 'mockpassword' ))
	else
		raise 'AuthFailure' if ( ! credentials.user.include? 'mockuser' ) or (
! credentials.password.include? 'mockpassword' )
	end
end

> I would expect a more deeper description in order to accept it.
> Why you would like to have an user like mockuser01 or such things ?
> You can please also cite the Bugzilla or Redmine for conductor so we
> can figure out the real purpose of this patch ?
> Moreover, if you modify this line you should also write/fix the tests.
> 
> Cheers,
> Francesco
> 
>> ---
>>  server/lib/deltacloud/drivers/mock/mock_driver.rb |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/server/lib/deltacloud/drivers/mock/mock_driver.rb b/server/lib/deltacloud/drivers/mock/mock_driver.rb
>> index ba817c6..cce4f48 100644
>> --- a/server/lib/deltacloud/drivers/mock/mock_driver.rb
>> +++ b/server/lib/deltacloud/drivers/mock/mock_driver.rb
>> @@ -460,7 +460,7 @@ module Deltacloud::Drivers::Mock
>>
>>     def check_credentials(credentials)
>>       safely do
>> -        if ( credentials.user != 'mockuser' ) or ( credentials.password != 'mockpassword' )
>> +        if ( ! credentials.user.include? 'mockuser' ) or ( ! credentials.password.include? 'mockpassword' )
>>           raise 'AuthFailure'
>>         end
>>       end
>> --
>> 1.7.7.6
>>


Re: [PATCH] allow multiple mock provider accounts

Posted by Francesco Vollero <ra...@gmail.com>.
Hi Dave,

On Thu, Jun 7, 2012 at 6:24 PM, Dave Johnson <da...@redhat.com> wrote:
> Ultimately needed for some unrelated conductor QE testing

Nack.
I would expect a more deeper description in order to accept it.
Why you would like to have an user like mockuser01 or such things ?
You can please also cite the Bugzilla or Redmine for conductor so we
can figure out the real purpose of this patch ?
Moreover, if you modify this line you should also write/fix the tests.

Cheers,
Francesco

> ---
>  server/lib/deltacloud/drivers/mock/mock_driver.rb |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/server/lib/deltacloud/drivers/mock/mock_driver.rb b/server/lib/deltacloud/drivers/mock/mock_driver.rb
> index ba817c6..cce4f48 100644
> --- a/server/lib/deltacloud/drivers/mock/mock_driver.rb
> +++ b/server/lib/deltacloud/drivers/mock/mock_driver.rb
> @@ -460,7 +460,7 @@ module Deltacloud::Drivers::Mock
>
>     def check_credentials(credentials)
>       safely do
> -        if ( credentials.user != 'mockuser' ) or ( credentials.password != 'mockpassword' )
> +        if ( ! credentials.user.include? 'mockuser' ) or ( ! credentials.password.include? 'mockpassword' )
>           raise 'AuthFailure'
>         end
>       end
> --
> 1.7.7.6
>