Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-2644

Windows file permissions and line endings cause tests to fail

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 1.0.0
    • None
    • None

    Description

      The ConfigEncryptionToolTest has three tests which fail on Windows – two due to Windows not being able to modify the file permissions in order to cause the expected IOException to be thrown, and one because the serialized nifi.properties has different line endings than expected. These are not blockers for 1.0.0 because they assert only failure scenarios and will not impede the actual behavior of the tool.

      We can re-investigate for 1.1.0.

      [INFO] Scanning for projects...
      [INFO] Inspecting build with total of 1 modules...
      [INFO] Installing Nexus Staging features:
      [INFO]   ... total of 1 executions of maven-deploy-plugin replaced with nexus-staging-maven-plugin
      [INFO]                                                                         
      [INFO] ------------------------------------------------------------------------
      [INFO] Building nifi-toolkit-encrypt-config 1.0.0-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO] 
      [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ nifi-toolkit-encrypt-config ---
      [INFO] Deleting C:\Users\Joe\AppData\Local\Programs\Git\nifi\nifi-toolkit\nifi-toolkit-encrypt-config\target
      [INFO] 
      [INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce-maven) @ nifi-toolkit-encrypt-config ---
      [INFO] 
      [INFO] --- build-helper-maven-plugin:1.5:add-source (add-source) @ nifi-toolkit-encrypt-config ---
      [INFO] Source directory: C:\Users\Joe\AppData\Local\Programs\Git\nifi\nifi-toolkit\nifi-toolkit-encrypt-config\src\main\groovy added.
      [INFO] 
      [INFO] --- maven-remote-resources-plugin:1.5:process (default) @ nifi-toolkit-encrypt-config ---
      [INFO] 
      [INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ nifi-toolkit-encrypt-config ---
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] Copying 2 resources
      [INFO] Copying 3 resources
      [INFO] 
      [INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ nifi-toolkit-encrypt-config ---
      [INFO] Changes detected - recompiling the module!
      [INFO] Compiling 6 source files to C:\Users\Joe\AppData\Local\Programs\Git\nifi\nifi-toolkit\nifi-toolkit-encrypt-config\target\classes
      [INFO] 
      [INFO] --- maven-compiler-plugin:3.2:compile (default) @ nifi-toolkit-encrypt-config ---
      [INFO] Changes detected - recompiling the module!
      [INFO] Using Groovy-Eclipse compiler to compile both Java and Groovy files
      [INFO] Found location <C:\Users\Joe\.m2\repository\org\codehaus\groovy\groovy-eclipse-batch\2.4.3-01\groovy-eclipse-batch-2.4.3-01.jar> for className <org.eclipse.jdt.internal.compiler.batch.Main>
      [INFO] no javaAgentClass seems to be set
      [INFO] Compiling in a forked process using C:\Users\Joe\.m2\repository\org\codehaus\groovy\groovy-eclipse-batch\2.4.3-01\groovy-eclipse-batch-2.4.3-01.jar
      [INFO] 
      [INFO] --- build-helper-maven-plugin:1.5:add-test-source (add-test-source) @ nifi-toolkit-encrypt-config ---
      [INFO] Test Source directory: C:\Users\Joe\AppData\Local\Programs\Git\nifi\nifi-toolkit\nifi-toolkit-encrypt-config\src\test\groovy added.
      [INFO] 
      [INFO] --- maven-resources-plugin:2.7:testResources (default-testResources) @ nifi-toolkit-encrypt-config ---
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] Copying 10 resources
      [INFO] Copying 3 resources
      [INFO] 
      [INFO] --- maven-compiler-plugin:3.2:testCompile (default-testCompile) @ nifi-toolkit-encrypt-config ---
      [INFO] Nothing to compile - all classes are up to date
      [INFO] 
      [INFO] --- maven-compiler-plugin:3.2:testCompile (groovy-tests) @ nifi-toolkit-encrypt-config ---
      [INFO] Changes detected - recompiling the module!
      [INFO] Using Groovy-Eclipse compiler to compile both Java and Groovy files
      [INFO] Found location <C:\Users\Joe\.m2\repository\org\codehaus\groovy\groovy-eclipse-batch\2.4.3-01\groovy-eclipse-batch-2.4.3-01.jar> for className <org.eclipse.jdt.internal.compiler.batch.Main>
      [INFO] no javaAgentClass seems to be set
      [INFO] Compiling in a forked process using C:\Users\Joe\.m2\repository\org\codehaus\groovy\groovy-eclipse-batch\2.4.3-01\groovy-eclipse-batch-2.4.3-01.jar
      [INFO] 
      [INFO] --- maven-compiler-plugin:3.2:testCompile (default) @ nifi-toolkit-encrypt-config ---
      [INFO] Changes detected - recompiling the module!
      [INFO] Nothing to compile - all classes are up to date
      [INFO] 
      [INFO] --- maven-surefire-plugin:2.18:test (default-test) @ nifi-toolkit-encrypt-config ---
      [INFO] Surefire report directory: C:\Users\Joe\AppData\Local\Programs\Git\nifi\nifi-toolkit\nifi-toolkit-encrypt-config\target\surefire-reports
      [INFO] Using configured provider org.apache.maven.surefire.junit4.JUnit4Provider
      
      -------------------------------------------------------
       T E S T S
      -------------------------------------------------------
      Running org.apache.nifi.properties.ConfigEncryptionToolTest
      Tests run: 47, Failures: 3, Errors: 0, Skipped: 2, Time elapsed: 3.128 sec <<< FAILURE! - in org.apache.nifi.properties.ConfigEncryptionToolTest
      testLoadNiFiPropertiesShouldHandleReadFailureOnWindows(org.apache.nifi.properties.ConfigEncryptionToolTest)  Time elapsed: 0.015 sec  <<< FAILURE!
      java.lang.AssertionError: Closure org.apache.nifi.properties.ConfigEncryptionToolTest$_testLoadNiFiPropertiesShouldHandleReadFailureOnWindows_closure25@7ec13984 should have failed with an exception of type java.io.IOException
      	at org.junit.Assert.fail(Assert.java:88)
      	at groovy.test.GroovyAssert.shouldFail(GroovyAssert.java:127)
      	at groovy.util.GroovyTestCase.shouldFail(GroovyTestCase.java:222)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:174)
      	at org.apache.nifi.properties.ConfigEncryptionToolTest.testLoadNiFiPropertiesShouldHandleReadFailureOnWindows(ConfigEncryptionToolTest.groovy:686)
      
      testWriteNiFiPropertiesShouldHandleWriteFailureWhenFileDoesNotExistOnWindows(org.apache.nifi.properties.ConfigEncryptionToolTest)  Time elapsed: 0.015 sec  <<< FAILURE!
      java.lang.AssertionError: Closure org.apache.nifi.properties.ConfigEncryptionToolTest$_testWriteNiFiPropertiesShouldHandleWriteFailureWhenFileDoesNotExistOnWindows_closure45@1a84a8b2 should have failed with an exception of type java.io.IOException
      	at org.junit.Assert.fail(Assert.java:88)
      	at groovy.test.GroovyAssert.shouldFail(GroovyAssert.java:127)
      	at groovy.util.GroovyTestCase.shouldFail(GroovyTestCase.java:222)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:174)
      	at org.apache.nifi.properties.ConfigEncryptionToolTest.testWriteNiFiPropertiesShouldHandleWriteFailureWhenFileDoesNotExistOnWindows(ConfigEncryptionToolTest.groovy:1280)
      
      testShouldSerializeNiFiProperties(org.apache.nifi.properties.ConfigEncryptionToolTest)  Time elapsed: 0.033 sec  <<< FAILURE!
      org.codehaus.groovy.runtime.powerassert.PowerAssertionError: assert lines.contains("${key}=${properties.getProperty(key)}".toString())
             |     |           |      |          |           |      |
             |     false       key    |          value       key    key=value
             |                        StandardNiFiProperties instance with 2 properties
             [#Wed Aug 24 13:18:15 GMT-05:00 2016
             , key=value
             , key2=value2
             ]
      	at org.codehaus.groovy.runtime.InvokerHelper.assertFailed(InvokerHelper.java:402)
      	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.assertFailed(ScriptBytecodeAdapter.java:650)
      	at org.apache.nifi.properties.ConfigEncryptionToolTest$_testShouldSerializeNiFiProperties_closure33.doCall(ConfigEncryptionToolTest.groovy:977)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
      	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
      	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
      	at org.codehaus.groovy.runtime.callsite.BooleanReturningMethodInvoker.invoke(BooleanReturningMethodInvoker.java:51)
      	at org.codehaus.groovy.runtime.callsite.BooleanClosureWrapper.call(BooleanClosureWrapper.java:53)
      	at org.codehaus.groovy.runtime.DefaultGroovyMethods.every(DefaultGroovyMethods.java:2228)
      	at org.codehaus.groovy.runtime.DefaultGroovyMethods.every(DefaultGroovyMethods.java:2249)
      	at org.codehaus.groovy.runtime.dgm$185.invoke(Unknown Source)
      	at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
      	at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
      	at org.apache.nifi.properties.ConfigEncryptionToolTest.testShouldSerializeNiFiProperties(ConfigEncryptionToolTest.groovy:976)
      
      
      Results :
      
      Failed tests: 
        ConfigEncryptionToolTest.testLoadNiFiPropertiesShouldHandleReadFailureOnWindows:686->GroovyTestCase.shouldFail:222 Closure org.apache.nifi.properties.ConfigEncryptionToolTest$_testLoadNiFiPropertiesShouldHandleReadFailureOnWindows_closure25@7ec13984 should have failed with an exception of type java.io.IOException
        ConfigEncryptionToolTest.testShouldSerializeNiFiProperties:976 assert lines.contains("${key}=${properties.getProperty(key)}".toString())
             |     |           |      |          |           |      |
             |     false       key    |          value       key    key=value
             |                        StandardNiFiProperties instance with 2 properties
             [#Wed Aug 24 13:18:15 GMT-05:00 2016
             , key=value
             , key2=value2
             ]
        ConfigEncryptionToolTest.testWriteNiFiPropertiesShouldHandleWriteFailureWhenFileDoesNotExistOnWindows:1280->GroovyTestCase.shouldFail:222 Closure org.apache.nifi.properties.ConfigEncryptionToolTest$_testWriteNiFiPropertiesShouldHandleWriteFailureWhenFileDoesNotExistOnWindows_closure45@1a84a8b2 should have failed with an exception of type java.io.IOException
      
      
      
      Tests run: 47, Failures: 3, Errors: 0, Skipped: 2
      
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 11.771 s
      [INFO] Finished at: 2016-08-24T13:18:16-05:00
      [INFO] Final Memory: 24M/416M
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18:test (default-test) on project nifi-toolkit-encrypt-config: There are test failures.
      [ERROR] 
      [ERROR] Please refer to C:\Users\Joe\AppData\Local\Programs\Git\nifi\nifi-toolkit\nifi-toolkit-encrypt-config\target\surefire-reports for the individual test results.
      [ERROR] -> [Help 1]
      [ERROR] 
      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR] 
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
      

      Attachments

        Issue Links

          Activity

            People

              alopresto Andy LoPresto
              alopresto Andy LoPresto
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: