You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by Vyacheslav Daradur <da...@gmail.com> on 2018/03/06 18:11:06 UTC

MAC addresses emulation in Testing Framework

Hi, Igniters!

I need your help about the following question:

How to set-up (emulate) custom MAC address at node startup in Testing Framework?

I need to write unit-test that checks requests distribution which
depends on ClusterNodes MAC addresses. I tried to change it after
instance startup via reflection but looks like a bad idea and may lead
to unexpected behavior.


-- 
Best Regards, Vyacheslav D.

Re: MAC addresses emulation in Testing Framework

Posted by Dmitry Pavlov <dp...@gmail.com>.
Sure, agree here that static/final and reflection update is not best
practice.

вт, 13 мар. 2018 г. в 11:26, Vyacheslav Daradur <da...@gmail.com>:

> Dmitry, I've changed a logic of my tests and reflection isn't needed
> anymore.
>
> Using reflection in tests, especially on 'private static | final'
> fields may provide side-effects on other tests in a common test suite
> which will be started in same JVM because of a previous value that may
> be cached in other classes.
>
> You can easily find such candidates by searching 'of
> 'GridTestUtils.setFieldValue(null' in the project.
>
>
>
> On Tue, Mar 6, 2018 at 11:19 PM, Dmitry Pavlov <dp...@gmail.com>
> wrote:
> > Hi Vyacheslav,
> >
> > Why do you think reflection is bad in that case? Tests often use
> > reflection, moreover U.field() to access some private stuff and test it.
> >
> > Sincerely,
> > Dmitriy Pavlov
> >
> > вт, 6 мар. 2018 г. в 21:11, Vyacheslav Daradur <da...@gmail.com>:
> >
> >> Hi, Igniters!
> >>
> >> I need your help about the following question:
> >>
> >> How to set-up (emulate) custom MAC address at node startup in Testing
> >> Framework?
> >>
> >> I need to write unit-test that checks requests distribution which
> >> depends on ClusterNodes MAC addresses. I tried to change it after
> >> instance startup via reflection but looks like a bad idea and may lead
> >> to unexpected behavior.
> >>
> >>
> >> --
> >> Best Regards, Vyacheslav D.
> >>
>
>
>
> --
> Best Regards, Vyacheslav D.
>

Re: MAC addresses emulation in Testing Framework

Posted by Vyacheslav Daradur <da...@gmail.com>.
Dmitry, I've changed a logic of my tests and reflection isn't needed anymore.

Using reflection in tests, especially on 'private static | final'
fields may provide side-effects on other tests in a common test suite
which will be started in same JVM because of a previous value that may
be cached in other classes.

You can easily find such candidates by searching 'of
'GridTestUtils.setFieldValue(null' in the project.



On Tue, Mar 6, 2018 at 11:19 PM, Dmitry Pavlov <dp...@gmail.com> wrote:
> Hi Vyacheslav,
>
> Why do you think reflection is bad in that case? Tests often use
> reflection, moreover U.field() to access some private stuff and test it.
>
> Sincerely,
> Dmitriy Pavlov
>
> вт, 6 мар. 2018 г. в 21:11, Vyacheslav Daradur <da...@gmail.com>:
>
>> Hi, Igniters!
>>
>> I need your help about the following question:
>>
>> How to set-up (emulate) custom MAC address at node startup in Testing
>> Framework?
>>
>> I need to write unit-test that checks requests distribution which
>> depends on ClusterNodes MAC addresses. I tried to change it after
>> instance startup via reflection but looks like a bad idea and may lead
>> to unexpected behavior.
>>
>>
>> --
>> Best Regards, Vyacheslav D.
>>



-- 
Best Regards, Vyacheslav D.

Re: MAC addresses emulation in Testing Framework

Posted by Dmitry Pavlov <dp...@gmail.com>.
Hi Vyacheslav,

Why do you think reflection is bad in that case? Tests often use
reflection, moreover U.field() to access some private stuff and test it.

Sincerely,
Dmitriy Pavlov

вт, 6 мар. 2018 г. в 21:11, Vyacheslav Daradur <da...@gmail.com>:

> Hi, Igniters!
>
> I need your help about the following question:
>
> How to set-up (emulate) custom MAC address at node startup in Testing
> Framework?
>
> I need to write unit-test that checks requests distribution which
> depends on ClusterNodes MAC addresses. I tried to change it after
> instance startup via reflection but looks like a bad idea and may lead
> to unexpected behavior.
>
>
> --
> Best Regards, Vyacheslav D.
>