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. |
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 <[hidden email]>: > 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. > |
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 <[hidden email]> 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 <[hidden email]>: > >> 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. |
Sure, agree here that static/final and reflection update is not best
practice. вт, 13 мар. 2018 г. в 11:26, Vyacheslav Daradur <[hidden email]>: > 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 <[hidden email]> > 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 <[hidden email]>: > > > >> 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. > |
Free forum by Nabble | Edit this page |