You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2021/11/16 13:32:51 UTC

[GitHub] [nifi] SpiceOwlf opened a new pull request #5524: [NIFI-9381] Test Does not pass due to NonDex

SpiceOwlf opened a new pull request #5524:
URL: https://github.com/apache/nifi/pull/5524


   <!--
     Licensed to the Apache Software Foundation (ASF) under one or more
     contributor license agreements.  See the NOTICE file distributed with
     this work for additional information regarding copyright ownership.
     The ASF licenses this file to You under the Apache License, Version 2.0
     (the "License"); you may not use this file except in compliance with
     the License.  You may obtain a copy of the License at
         http://www.apache.org/licenses/LICENSE-2.0
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
   -->
   Thank you for submitting a contribution to Apache NiFi.
   
   Please provide a short description of the PR here:
   
   #### Description of PR
   
   _fixes bug NIFI-9381._ 
   Tests related to _initCompositeUserGroupProvider_ under _CompositeUserGroupProviderTestBase_ may express non-deterministic behavior due to the nature of HashMap. The fix is changing HashMap with LinkedHashMap to ensure deterministic behavior.
   
   In order to streamline the review of the contribution we ask you
   to ensure the following steps have been taken:
   
   ### For all changes:
   - [x] Is there a JIRA ticket associated with this PR? Is it referenced 
        in the commit message?
   
   - [x] Does your PR title start with **NIFI-XXXX** where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
   
   - [x] Has your PR been rebased against the latest commit within the target branch (typically `main`)?
   
   - [x] Is your initial contribution a single, squashed commit? _Additional commits in response to PR reviewer feedback should be made on this branch and pushed to allow change tracking. Do not `squash` or use `--force` when pushing to allow for clean monitoring of changes._
   
   ### For code changes:
   - [ ] Have you ensured that the full suite of tests is executed via `mvn -Pcontrib-check clean install` at the root `nifi` folder?
   - [ ] Have you written or updated unit tests to verify your changes?
   - [x] Have you verified that the full build is successful on JDK 8?
   - [ ] Have you verified that the full build is successful on JDK 11?
   - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
   - [ ] If applicable, have you updated the `LICENSE` file, including the main `LICENSE` file under `nifi-assembly`?
   - [ ] If applicable, have you updated the `NOTICE` file, including the main `NOTICE` file found under `nifi-assembly`?
   - [ ] If adding new Properties, have you added `.displayName` in addition to .name (programmatic access) for each of the new properties?
   
   ### For documentation related changes:
   - [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
   
   ### Note:
   Please ensure that once the PR is submitted, you check GitHub Actions CI for build issues and submit an update to your PR as soon as possible.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] SpiceOwlf commented on pull request #5524: [NIFI-9381] Test Does not pass due to NonDex

Posted by GitBox <gi...@apache.org>.
SpiceOwlf commented on pull request #5524:
URL: https://github.com/apache/nifi/pull/5524#issuecomment-975590694


   Here are what I observed:
   While using HashMap, NonDex will complain that `java.lang.AssertionError: expected:<1> but was:<2>`, and the error was cast from `CompositeUserGroupProviderTest.testMultipleProvidersWithConflictingUsers:135->CompositeUserGroupProviderTestBase.testUserGroupProviderTwo:122`
   
   With a little bit more digging, `userGroupProvider.getGroup(GROUP_2_IDENTIFIER).getUsers().size()` is the cause of this error, and  `userGroupProvider.getGroup(GROUP_2_IDENTIFIER).getUsers()` will return `<[user-identifier-4, user-identifier-1]>` or `<[user-identifier-3]>` depending on the random seed NonDex received. Changing HashMap to LinkedHashMap eliminate such random behavior. It ensures that `initCompositeUserGroupProvider` has deterministic order while using `mockProperties`.  Please let me know if my explaination makes sense or not. I will also attach the steps to reproduce this error later. 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] SpiceOwlf commented on a change in pull request #5524: [NIFI-9381] Test Does not pass due to NonDex

Posted by GitBox <gi...@apache.org>.
SpiceOwlf commented on a change in pull request #5524:
URL: https://github.com/apache/nifi/pull/5524#discussion_r751358620



##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers/src/test/java/org/apache/nifi/authorization/CompositeUserGroupProviderTestBase.java
##########
@@ -22,6 +22,7 @@
 import org.junit.Assert;
 
 import java.util.HashMap;

Review comment:
       Absolutely, I just removed HashMap. Hope the workflow will pass this time!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] exceptionfactory commented on a change in pull request #5524: [NIFI-9381] Test Does not pass due to NonDex

Posted by GitBox <gi...@apache.org>.
exceptionfactory commented on a change in pull request #5524:
URL: https://github.com/apache/nifi/pull/5524#discussion_r751350122



##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers/src/test/java/org/apache/nifi/authorization/CompositeUserGroupProviderTestBase.java
##########
@@ -22,6 +22,7 @@
 import org.junit.Assert;
 
 import java.util.HashMap;

Review comment:
       According to the automated build, this import is no longer used and should be removed.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] exceptionfactory commented on pull request #5524: [NIFI-9381] Test Does not pass due to NonDex

Posted by GitBox <gi...@apache.org>.
exceptionfactory commented on pull request #5524:
URL: https://github.com/apache/nifi/pull/5524#issuecomment-972177643


   Thanks for updating the import @SpiceOwlf. After closer inspection, it is not clear how changing to use the LinkedHashMap resolves the test failure in the Jira issue.  The failing assertion compares the number of users associated with the group, and that does not appear directly related to the mocked properties provided through the Map.  Each property set in the Map should have a unique number, and order should not matter.  Can you describe how using LinkedHashMap resolves the potential non-deterministic test behavior?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] SpiceOwlf commented on pull request #5524: [NIFI-9381] Test Does not pass due to NonDex

Posted by GitBox <gi...@apache.org>.
SpiceOwlf commented on pull request #5524:
URL: https://github.com/apache/nifi/pull/5524#issuecomment-975595612


   Environment: 
   openjdk version "1.8.0_292"
   OpenJDK Runtime Environment (build 1.8.0_292-8u292-b10-0ubuntu1~18.04-b10)
   OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)
   
   Apache Maven 3.6.0
   
   Install NonDex based on the instructions from https://github.com/TestingResearchIllinois/NonDex
   
   Run the following commands under /nifi:
   
   1. mvn install -pl nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers -am -DskipTests 
   
   2. mvn -pl nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers test -Dtest=org.apache.nifi.authorization.CompositeUserGroupProviderTest#testMultipleProvidersWithConflictingUsers
   
   3. mvn -pl  nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers edu.illinois:nondex-maven-plugin:1.1.2:nondex -Dtest=org.apache.nifi.authorization.CompositeUserGroupProviderTest#testMultipleProvidersWithConflictingUsers -DnondexRuns=10
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] exceptionfactory closed pull request #5524: [NIFI-9381] Test Does not pass due to NonDex

Posted by GitBox <gi...@apache.org>.
exceptionfactory closed pull request #5524:
URL: https://github.com/apache/nifi/pull/5524


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org