You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Jay Guo <gu...@cn.ibm.com> on 2016/12/02 08:51:57 UTC

Review Request 54300: Added a test for validateRoles method.

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54300/
-----------------------------------------------------------

Review request for mesos, Benjamin Mahler and Guangya Liu.


Bugs: MESOS-6629
    https://issues.apache.org/jira/browse/MESOS-6629


Repository: mesos


Description
-------

There are three attributes: 'role', 'roles' and MULTI_ROLE to be
validated by this method, therefore covered by 2^3 test cases.
Also the test ensures this method checks duplicate entries in 'roles'.


Diffs
-----

  src/tests/master_validation_tests.cpp 5c44967a077551944831383a6bcc6dcb1c626df9 

Diff: https://reviews.apache.org/r/54300/diff/


Testing
-------


Thanks,

Jay Guo


Re: Review Request 54300: Added a test for validateRoles method.

Posted by Guangya Liu <gy...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54300/#review157742
-----------------------------------------------------------



Can you please update the `Testing Done` section by adding some context for how to test your case?

Such as 

```
make
make check
```

```
./bin/mesos-tests.sh  --gtest_filter="FrameworkInfoValidationTest.ValidateRoles"
...output...
```

- Guangya Liu


On \u5341\u4e8c\u6708 2, 2016, 8:51 a.m., Jay Guo wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54300/
> -----------------------------------------------------------
> 
> (Updated \u5341\u4e8c\u6708 2, 2016, 8:51 a.m.)
> 
> 
> Review request for mesos, Benjamin Mahler and Guangya Liu.
> 
> 
> Bugs: MESOS-6629
>     https://issues.apache.org/jira/browse/MESOS-6629
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> There are three attributes: 'role', 'roles' and MULTI_ROLE to be
> validated by this method, therefore covered by 2^3 test cases.
> Also the test ensures this method checks duplicate entries in 'roles'.
> 
> 
> Diffs
> -----
> 
>   src/tests/master_validation_tests.cpp 5c44967a077551944831383a6bcc6dcb1c626df9 
> 
> Diff: https://reviews.apache.org/r/54300/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Jay Guo
> 
>


Re: Review Request 54300: Added a test for validateRoles method.

Posted by Benjamin Mahler <bm...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54300/#review157880
-----------------------------------------------------------


Ship it!




Ship It!

- Benjamin Mahler


On Dec. 3, 2016, 1:49 a.m., Jay Guo wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54300/
> -----------------------------------------------------------
> 
> (Updated Dec. 3, 2016, 1:49 a.m.)
> 
> 
> Review request for mesos, Benjamin Mahler and Guangya Liu.
> 
> 
> Bugs: MESOS-6629
>     https://issues.apache.org/jira/browse/MESOS-6629
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> There are three attributes: 'role', 'roles' and MULTI_ROLE to be
> validated by this method, therefore covered by 2^3 test cases.
> Also the test ensures this method checks duplicate entries in 'roles'.
> 
> 
> Diffs
> -----
> 
>   src/tests/master_validation_tests.cpp 5c44967a077551944831383a6bcc6dcb1c626df9 
> 
> Diff: https://reviews.apache.org/r/54300/diff/
> 
> 
> Testing
> -------
> 
> make
> make check
> 
> ./bin/mesos-tests.sh  --gtest_filter="FrameworkInfoValidationTest.*"
> [==========] Running 4 tests from 1 test case.
> [----------] Global test environment set-up.
> [----------] 4 tests from FrameworkInfoValidationTest
> [ RUN      ] FrameworkInfoValidationTest.ValidateRoles
> [       OK ] FrameworkInfoValidationTest.ValidateRoles (1 ms)
> [ RUN      ] FrameworkInfoValidationTest.RejectFrameworkWithRolesWithoutMultipleRoleCapability
> [       OK ] FrameworkInfoValidationTest.RejectFrameworkWithRolesWithoutMultipleRoleCapability (286 ms)
> [ RUN      ] FrameworkInfoValidationTest.AcceptMultiRoleFramework
> [       OK ] FrameworkInfoValidationTest.AcceptMultiRoleFramework (303 ms)
> [ RUN      ] FrameworkInfoValidationTest.RejectMultiRoleFrameworkWithNonWhitelistedRole
> [       OK ] FrameworkInfoValidationTest.RejectMultiRoleFrameworkWithNonWhitelistedRole (296 ms)
> [----------] 4 tests from FrameworkInfoValidationTest (887 ms total)
> 
> [----------] Global test environment tear-down
> [==========] 4 tests from 1 test case ran. (910 ms total)
> [  PASSED  ] 4 tests.
> 
> 
> Thanks,
> 
> Jay Guo
> 
>


Re: Review Request 54300: Added a test for validateRoles method.

Posted by Benjamin Mahler <bm...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54300/#review157881
-----------------------------------------------------------



Some minor suggestions, I'll make the edits prior to committing.


src/tests/master_validation_tests.cpp (line 2414)
<https://reviews.apache.org/r/54300/#comment228497>

    Maybe a newline before each EXPECT in each block.



src/tests/master_validation_tests.cpp (line 2423)
<https://reviews.apache.org/r/54300/#comment228495>

    Remove this?



src/tests/master_validation_tests.cpp (line 2435)
<https://reviews.apache.org/r/54300/#comment228496>

    Remove this?


- Benjamin Mahler


On Dec. 3, 2016, 1:49 a.m., Jay Guo wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54300/
> -----------------------------------------------------------
> 
> (Updated Dec. 3, 2016, 1:49 a.m.)
> 
> 
> Review request for mesos, Benjamin Mahler and Guangya Liu.
> 
> 
> Bugs: MESOS-6629
>     https://issues.apache.org/jira/browse/MESOS-6629
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> There are three attributes: 'role', 'roles' and MULTI_ROLE to be
> validated by this method, therefore covered by 2^3 test cases.
> Also the test ensures this method checks duplicate entries in 'roles'.
> 
> 
> Diffs
> -----
> 
>   src/tests/master_validation_tests.cpp 5c44967a077551944831383a6bcc6dcb1c626df9 
> 
> Diff: https://reviews.apache.org/r/54300/diff/
> 
> 
> Testing
> -------
> 
> make
> make check
> 
> ./bin/mesos-tests.sh  --gtest_filter="FrameworkInfoValidationTest.*"
> [==========] Running 4 tests from 1 test case.
> [----------] Global test environment set-up.
> [----------] 4 tests from FrameworkInfoValidationTest
> [ RUN      ] FrameworkInfoValidationTest.ValidateRoles
> [       OK ] FrameworkInfoValidationTest.ValidateRoles (1 ms)
> [ RUN      ] FrameworkInfoValidationTest.RejectFrameworkWithRolesWithoutMultipleRoleCapability
> [       OK ] FrameworkInfoValidationTest.RejectFrameworkWithRolesWithoutMultipleRoleCapability (286 ms)
> [ RUN      ] FrameworkInfoValidationTest.AcceptMultiRoleFramework
> [       OK ] FrameworkInfoValidationTest.AcceptMultiRoleFramework (303 ms)
> [ RUN      ] FrameworkInfoValidationTest.RejectMultiRoleFrameworkWithNonWhitelistedRole
> [       OK ] FrameworkInfoValidationTest.RejectMultiRoleFrameworkWithNonWhitelistedRole (296 ms)
> [----------] 4 tests from FrameworkInfoValidationTest (887 ms total)
> 
> [----------] Global test environment tear-down
> [==========] 4 tests from 1 test case ran. (910 ms total)
> [  PASSED  ] 4 tests.
> 
> 
> Thanks,
> 
> Jay Guo
> 
>


Re: Review Request 54300: Added a test for validateRoles method.

Posted by Jay Guo <gu...@cn.ibm.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54300/
-----------------------------------------------------------

(Updated Dec. 3, 2016, 1:49 a.m.)


Review request for mesos, Benjamin Mahler and Guangya Liu.


Changes
-------

addressed ben's comments.


Bugs: MESOS-6629
    https://issues.apache.org/jira/browse/MESOS-6629


Repository: mesos


Description
-------

There are three attributes: 'role', 'roles' and MULTI_ROLE to be
validated by this method, therefore covered by 2^3 test cases.
Also the test ensures this method checks duplicate entries in 'roles'.


Diffs (updated)
-----

  src/tests/master_validation_tests.cpp 5c44967a077551944831383a6bcc6dcb1c626df9 

Diff: https://reviews.apache.org/r/54300/diff/


Testing (updated)
-------

make
make check

./bin/mesos-tests.sh  --gtest_filter="FrameworkInfoValidationTest.*"
[==========] Running 4 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 4 tests from FrameworkInfoValidationTest
[ RUN      ] FrameworkInfoValidationTest.ValidateRoles
[       OK ] FrameworkInfoValidationTest.ValidateRoles (1 ms)
[ RUN      ] FrameworkInfoValidationTest.RejectFrameworkWithRolesWithoutMultipleRoleCapability
[       OK ] FrameworkInfoValidationTest.RejectFrameworkWithRolesWithoutMultipleRoleCapability (286 ms)
[ RUN      ] FrameworkInfoValidationTest.AcceptMultiRoleFramework
[       OK ] FrameworkInfoValidationTest.AcceptMultiRoleFramework (303 ms)
[ RUN      ] FrameworkInfoValidationTest.RejectMultiRoleFrameworkWithNonWhitelistedRole
[       OK ] FrameworkInfoValidationTest.RejectMultiRoleFrameworkWithNonWhitelistedRole (296 ms)
[----------] 4 tests from FrameworkInfoValidationTest (887 ms total)

[----------] Global test environment tear-down
[==========] 4 tests from 1 test case ran. (910 ms total)
[  PASSED  ] 4 tests.


Thanks,

Jay Guo


Re: Review Request 54300: Added a test for validateRoles method.

Posted by Guangya Liu <gy...@gmail.com>.

> On \u5341\u4e8c\u6708 2, 2016, 10:17 p.m., Benjamin Mahler wrote:
> > src/tests/master_validation_tests.cpp, lines 2371-2380
> > <https://reviews.apache.org/r/54300/diff/1/?file=1574589#file1574589line2371>
> >
> >     How about splitting each case with a block? As it stands its a bit hard to read what each case is doing without the comments. For example:
> >     
> >     ```
> >       // Not MULTI_ROLE, no 'role' (defuaults to "*"), no 'roles'.
> >       {
> >         FrameworkInfo frameworkInfo;
> >         EXPECT_NONE(framework::internal::validateRoles(frameworkInfo));
> >       }
> >     
> >       // Not MULTI_ROLE, 'role' set, no 'roles'.
> >       {
> >         FrameworkInfo frameworkInfo;
> >         frameworkInfo.set_role("foo");
> >         EXPECT_NONE(framework::internal::validateRoles(frameworkInfo));
> >       }
> >     
> >       // MULTI_ROLE, 'role' set (error!), no 'roles'.
> >       {
> >         ...
> >       }
> >       
> >       ...
> >     ```

This may cause some duplicate code, the current test is reusing some code as following:

```
  FrameworkInfo frameworkInfo1;
  EXPECT_NONE(::framework::internal::validateRoles(frameworkInfo1));

  frameworkInfo1.set_role("foo");
  EXPECT_NONE(::framework::internal::validateRoles(frameworkInfo1));

  frameworkInfo1.add_capabilities()->set_type(
      FrameworkInfo::Capability::MULTI_ROLE);
  // 'Role' is set, but MULTI_ROLE capability is also enabled.
  EXPECT_SOME(::framework::internal::validateRoles(frameworkInfo1));

  frameworkInfo1.add_roles("bar");
  frameworkInfo1.add_roles("qux");
  // All 'role', 'roles' and MULTI_ROLE are set.
  EXPECT_SOME(::framework::internal::validateRoles(frameworkInfo1));
```

`frameworkInfo1` is used by three test cases, how about put those three cases into a block and add comments for each test cases?

```
{
  // Not MULTI_ROLE, no 'role' (defuaults to "*"), no 'roles'.
  FrameworkInfo frameworkInfo1;
  EXPECT_NONE(::framework::internal::validateRoles(frameworkInfo1));

  // Not MULTI_ROLE, 'role' set, no 'roles'.
  frameworkInfo1.set_role("foo");
  EXPECT_NONE(::framework::internal::validateRoles(frameworkInfo1));

  // 'Role' is set, but MULTI_ROLE capability is also enabled.
  frameworkInfo1.add_capabilities()->set_type(
      FrameworkInfo::Capability::MULTI_ROLE);
  EXPECT_SOME(::framework::internal::validateRoles(frameworkInfo1));

  // All 'role', 'roles' and MULTI_ROLE are set.
  frameworkInfo1.add_roles("bar");
  frameworkInfo1.add_roles("qux");
  EXPECT_SOME(::framework::internal::validateRoles(frameworkInfo1));
}

{
  ...
}
```


- Guangya


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54300/#review157842
-----------------------------------------------------------


On \u5341\u4e8c\u6708 2, 2016, 8:51 a.m., Jay Guo wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54300/
> -----------------------------------------------------------
> 
> (Updated \u5341\u4e8c\u6708 2, 2016, 8:51 a.m.)
> 
> 
> Review request for mesos, Benjamin Mahler and Guangya Liu.
> 
> 
> Bugs: MESOS-6629
>     https://issues.apache.org/jira/browse/MESOS-6629
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> There are three attributes: 'role', 'roles' and MULTI_ROLE to be
> validated by this method, therefore covered by 2^3 test cases.
> Also the test ensures this method checks duplicate entries in 'roles'.
> 
> 
> Diffs
> -----
> 
>   src/tests/master_validation_tests.cpp 5c44967a077551944831383a6bcc6dcb1c626df9 
> 
> Diff: https://reviews.apache.org/r/54300/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Jay Guo
> 
>


Re: Review Request 54300: Added a test for validateRoles method.

Posted by Benjamin Mahler <bm...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54300/#review157842
-----------------------------------------------------------




src/tests/master_validation_tests.cpp (lines 2366 - 2368)
<https://reviews.apache.org/r/54300/#comment228450>

    Just the first sentence here seems sufficient to me.



src/tests/master_validation_tests.cpp (lines 2371 - 2380)
<https://reviews.apache.org/r/54300/#comment228449>

    How about splitting each case with a block? As it stands its a bit hard to read what each case is doing without the comments. For example:
    
    ```
      // Not MULTI_ROLE, no 'role' (defuaults to "*"), no 'roles'.
      {
        FrameworkInfo frameworkInfo;
        EXPECT_NONE(framework::internal::validateRoles(frameworkInfo));
      }
    
      // Not MULTI_ROLE, 'role' set, no 'roles'.
      {
        FrameworkInfo frameworkInfo;
        frameworkInfo.set_role("foo");
        EXPECT_NONE(framework::internal::validateRoles(frameworkInfo));
      }
    
      // MULTI_ROLE, 'role' set (error!), no 'roles'.
      {
        ...
      }
      
      ...
    ```


- Benjamin Mahler


On Dec. 2, 2016, 8:51 a.m., Jay Guo wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54300/
> -----------------------------------------------------------
> 
> (Updated Dec. 2, 2016, 8:51 a.m.)
> 
> 
> Review request for mesos, Benjamin Mahler and Guangya Liu.
> 
> 
> Bugs: MESOS-6629
>     https://issues.apache.org/jira/browse/MESOS-6629
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> There are three attributes: 'role', 'roles' and MULTI_ROLE to be
> validated by this method, therefore covered by 2^3 test cases.
> Also the test ensures this method checks duplicate entries in 'roles'.
> 
> 
> Diffs
> -----
> 
>   src/tests/master_validation_tests.cpp 5c44967a077551944831383a6bcc6dcb1c626df9 
> 
> Diff: https://reviews.apache.org/r/54300/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Jay Guo
> 
>