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 2022/03/06 22:44:50 UTC

[GitHub] [nifi] MarcyGO opened a new pull request #5845: Fix test schema to attribute

MarcyGO opened a new pull request #5845:
URL: https://github.com/apache/nifi/pull/5845


   <!--
     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
   
   _Enables X functionality; fixes bug NIFI-YYYY._
   
   The test `org.apache.nifi.processors.standard.TestAttributesToCSV#testSchemaToAttribute` can fail based on the order of iteration in `HashMap`. I found the issue using [NonDex](https://github.com/TestingResearchIllinois/NonDex):
   ```
   mvn install -DskipTests -pl nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors -am
   mvn -pl nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors edu.illinois:nondex-maven-plugin:1.1.2:nondex -Dtest=org.apache.nifi.processors.standard.TestAttributesToCSV#testSchemaToContent
   ```
   
   The proposed fix changes several `HashMap` to `LinkedHashMap`. Please let me know if you want another fix that would change just the assertions (but it'd be a bigger code change).
   
   The project has several more tests that fail for the same reason. Please let me know if you want me to open PRs for more of them.
   
   In order to streamline the review of the contribution we ask you
   to ensure the following steps have been taken:
   
   ### For all changes:
   - [ ] Is there a JIRA ticket associated with this PR? Is it referenced 
        in the commit message?
   
   - [ ] 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.
   
   - [ ] Has your PR been rebased against the latest commit within the target branch (typically `main`)?
   
   - [ ] 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?
   - [ ] 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] exceptionfactory commented on pull request #5845: NIFI-9768: Fix indeterminate map ordering in testSchemaToAttribute

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


   Thanks for removing those lines @MarcyGO, I have enabled the automated build to run in order to verify the changes.


-- 
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 #5845: NIFI-9768: Fix indeterminate map ordering in testSchemaToAttribute

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



##########
File path: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/AttributesToCSV.java
##########
@@ -288,7 +290,9 @@ public void onTrigger(ProcessContext context, ProcessSession session) throws Pro
         }
 
         final Set<String> attributeList = attributeListStringToSet(context.getProperty(ATTRIBUTES_LIST).evaluateAttributeExpressions(original).getValue());
+        System.out.println("****************** attributeList " + attributeList.getClass());
         final Map<String, String> atrList = buildAttributesMapForFlowFile(original, attributeList, pattern);
+        System.out.println("****************** atrList " + atrList.getClass());

Review comment:
       ```suggestion
   ```

##########
File path: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/AttributesToCSV.java
##########
@@ -288,7 +290,9 @@ public void onTrigger(ProcessContext context, ProcessSession session) throws Pro
         }
 
         final Set<String> attributeList = attributeListStringToSet(context.getProperty(ATTRIBUTES_LIST).evaluateAttributeExpressions(original).getValue());
+        System.out.println("****************** attributeList " + attributeList.getClass());

Review comment:
       `System.out.println()` should not be used.
   ```suggestion
   ```

##########
File path: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/AttributesToCSV.java
##########
@@ -230,6 +230,8 @@ protected void init(final ProcessorInitializationContext context) {
         //now glue on the core attributes if the user wants them.
         if(includeCoreAttributes) {
             for (String coreAttribute : coreAttributes) {
+                System.out.println("****************** " + coreAttributes.getClass());
+                System.out.println(coreAttribute);

Review comment:
       `System.out.println()` should not be used.
   ```suggestion
   ```




-- 
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] MarcyGO commented on pull request #5845: NIFI-9768: Fix indeterminate map ordering in testSchemaToAttribute

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


   Sorry, I accidentally push other commits to this branch.


-- 
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] MarcyGO edited a comment on pull request #5845: NIFI-9768: Fix indeterminate map ordering in testSchemaToAttribute

Posted by GitBox <gi...@apache.org>.
MarcyGO edited a comment on pull request #5845:
URL: https://github.com/apache/nifi/pull/5845#issuecomment-1073065717


   Thank you for the feedback. I am working to fix the issue. Do you think, instead of the present adjustment, I should update the assertions in the test to withstand HashMap's unpredictable behavior? I implement the other solution in another branch, and all automated checks passes for that one.


-- 
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] MarcyGO commented on pull request #5845: NIFI-9768: Fix indeterminate map ordering in testSchemaToAttribute

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


   I commit the changes which change assertions in four test functions ```testSchemaToAttribute```, ```testSchemaToContent```, ```testSchemaWithCoreAttribuesToAttribute```, and ```testSchemaWithCoreAttribuesToContent``` to endure the indeterminate behaviors of  ```HashMap```.


-- 
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] pvillard31 commented on pull request #5845: Fix test schema to attribute

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


   Please file a JIRA and update your Pull Request title with the JIRA number. Thanks!


-- 
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 #5845: NIFI-9768: Fix indeterminate map ordering in testSchemaToAttribute

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


   Thanks for the update @MarcyGO. It looks like the most recent commits removed the original changes from HashMap to LinkedHashMap. If you can update the PR to include both your original changes, as well as the test changes that seem necessary to make everything work as expected, that would be helpful. Having everything together would also help clarify how individual tests may or may not need to be changed.


-- 
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] MarcyGO commented on pull request #5845: NIFI-9768: Fix indeterminate map ordering in testSchemaToAttribute

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


   I've edited the PR description.


-- 
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] MarcyGO commented on pull request #5845: NIFI-9768: Fix indeterminate map ordering in testSchemaToAttribute

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


   Because you told me to change the test code, I've prepared this tentative PR (for `testSchemaWithCoreAttribuesToContent`): https://github.com/MarcyGO/nifi/pull/4  Please let me know if you like that change, and I can then open a real PR here on apache/nifi repo.


-- 
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 #5845: NIFI-9768: Fix indeterminate map ordering in testSchemaToAttribute

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


   > Thank you for the feedback. I am working to fix the issue. Do you think, instead of the present adjustment, I should update the assertions in the test to withstand HashMap's unpredictable behavior? I implement the other solution in another branch, and all automated checks passes for that one.
   
   Thanks for the reply @MarcyGO. If the failing test relies on incorrect assumptions about the behavior of HashMap, then it sounds like that particular test should be changed.  If you have a solution, please commit the change and we can evaluate it together with the current set of changes.


-- 
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] MarcyGO commented on pull request #5845: NIFI-9768: Fix indeterminate map ordering in testSchemaToAttribute

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


   Thank you for the feedback. I am working to fix the issue.


-- 
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