[GitHub] nifi pull request #2648: NIFI-4942 Fix unit test salt assertion regex

2018-04-19 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/nifi/pull/2648


---


[GitHub] nifi pull request #2648: NIFI-4942 Fix unit test salt assertion regex

2018-04-19 Thread kevdoran
Github user kevdoran commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2648#discussion_r182941468
  
--- Diff: nifi-toolkit/nifi-toolkit-encrypt-config/pom.xml ---
@@ -167,10 +167,12 @@
 org.apache.rat
 apache-rat-plugin
 
+true
 
 src/test/resources/scrypt.py
-
src/test/resources/secure_hash.key
-
src/test/resources/secure_hash_128.key
+
+**/secure_hash.key
+**/secure_hash_128.key
--- End diff --

Ok, here's what I've got so far for the secure_hash.key file issue. It does 
not look trivial to find and disable the tests that could be creating this 
file, as I think it can come from both the existing (pre-NIFI-4942) and the 
recently introduced test cases.

The path is hardcoded to ./secure_hash.key, but the test class does appear 
to try to account for that here: 
https://github.com/kevdoran/nifi/blob/master/nifi-toolkit/nifi-toolkit-encrypt-config/src/test/groov...

I'm not sure why that is not working on some Linux platforms. I'm wondering 
if it has to do with the fact that it is a static field and how the classes get 
loaded for these test cases, but in any case it means that any execution of the 
tool could create the file that we want to avoid.

So options I see are:

- leave the tests enabled, leave the wildcard directory for the RAT 
exclusions, and maybe add the file to a .gitignore listing so as to prevent it 
from getting accidentally committed
- try to find every test that is creating this file and temporarily disable 
it (non-trivial from what I can tell, but maybe I am missing something obvious)
- disable the entire ConfigEncryptionToolTest suite (for now)

I think all of these approaches only address the immediate issues and still 
require a longer-term solution.



---


[GitHub] nifi pull request #2648: NIFI-4942 Fix unit test salt assertion regex

2018-04-19 Thread ijokarumawak
Github user ijokarumawak commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2648#discussion_r182939687
  
--- Diff: nifi-toolkit/nifi-toolkit-encrypt-config/pom.xml ---
@@ -167,10 +167,12 @@
 org.apache.rat
 apache-rat-plugin
 
+true
 
 src/test/resources/scrypt.py
-
src/test/resources/secure_hash.key
-
src/test/resources/secure_hash_128.key
+
+**/secure_hash.key
+**/secure_hash_128.key
--- End diff --

@kevdoran Sounds good. I will update NIFI-5100 to summarize this 
conversation so that we can make the tool better. Thanks!


---


[GitHub] nifi pull request #2648: NIFI-4942 Fix unit test salt assertion regex

2018-04-19 Thread kevdoran
Github user kevdoran commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2648#discussion_r182934721
  
--- Diff: nifi-toolkit/nifi-toolkit-encrypt-config/pom.xml ---
@@ -167,10 +167,12 @@
 org.apache.rat
 apache-rat-plugin
 
+true
 
 src/test/resources/scrypt.py
-
src/test/resources/secure_hash.key
-
src/test/resources/secure_hash_128.key
+
+**/secure_hash.key
+**/secure_hash_128.key
--- End diff --

Thanks for taking a look! I don't know enough about the tool to make a 
change to this behavior as it might have good reason it needs to work that way. 
For now I will update the PR to disable the tests, and we can take our time to 
discuss the best approach that looks at the tests and tool holistically.


---


[GitHub] nifi pull request #2648: NIFI-4942 Fix unit test salt assertion regex

2018-04-19 Thread ijokarumawak
Github user ijokarumawak commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2648#discussion_r182934080
  
--- Diff: nifi-toolkit/nifi-toolkit-encrypt-config/pom.xml ---
@@ -167,10 +167,12 @@
 org.apache.rat
 apache-rat-plugin
 
+true
 
 src/test/resources/scrypt.py
-
src/test/resources/secure_hash.key
-
src/test/resources/secure_hash_128.key
+
+**/secure_hash.key
+**/secure_hash_128.key
--- End diff --

@kevdoran Yeah, I looked at the source code and it doesn't seem to be a way 
to change output dir currently. I think it is not only a problem for test, but 
also it might be problematic in real usage. When I executed the tool, it 
generates `secure_hash.key` in current directory:
```
$ ./bin/encrypt-config.sh -n /tmp/enc-test/nifi.properties -o 
/tmp/enc-test/nifi-enc.properties -b /tmp/enc-test/bootstrap.conf --verbose
$ ll
total 60
drwxrwxr-x 6 nifi nifi  4096 Apr 20 02:42 ./
drwxrwxr-x 3 nifi nifi  4096 Apr 19 03:57 ../
drwxr-xr-x 2 nifi nifi  4096 Apr 19 01:45 bin/
drwxr-xr-x 3 nifi nifi  4096 Apr 19 01:45 classpath/
drwxr-xr-x 2 nifi nifi  4096 Apr 19 01:45 conf/
drwxrwxr-x 2 nifi nifi 12288 Apr 19 03:57 lib/
-rw-r--r-- 1 nifi nifi 15986 Apr 19 01:45 LICENSE
-rw-r--r-- 1 nifi nifi  5473 Apr 19 01:45 NOTICE
-rw--- 1 nifi nifi91 Apr 20 02:42 secure_hash.key
```

Since the key is baked into the bootstrap.conf, the secure_hash.key is not 
needed to be written as a file I guess. I'm new to this tool, so I can be wrong.


---


[GitHub] nifi pull request #2648: NIFI-4942 Fix unit test salt assertion regex

2018-04-19 Thread kevdoran
Github user kevdoran commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2648#discussion_r182931924
  
--- Diff: nifi-toolkit/nifi-toolkit-encrypt-config/pom.xml ---
@@ -167,10 +167,12 @@
 org.apache.rat
 apache-rat-plugin
 
+true
 
 src/test/resources/scrypt.py
-
src/test/resources/secure_hash.key
-
src/test/resources/secure_hash_128.key
+
+**/secure_hash.key
+**/secure_hash_128.key
--- End diff --

Thanks @ijokarumawak. That confirms what I and others have been able to 
gather. It looks like that file is created by the command line tool that is 
under test. I don't think there is a way to change its location, other than 
perhaps changing the working directory of the test prior to executing the tool. 
Reliably removing the file would be a good approach as well. 

We may also want to disable these tests to get master building reliably on 
all platforms and then re-enable them once we have sorted this out.

Thanks for jumping in to assist!


---


[GitHub] nifi pull request #2648: NIFI-4942 Fix unit test salt assertion regex

2018-04-19 Thread ijokarumawak
Github user ijokarumawak commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2648#discussion_r182931405
  
--- Diff: nifi-toolkit/nifi-toolkit-encrypt-config/pom.xml ---
@@ -167,10 +167,12 @@
 org.apache.rat
 apache-rat-plugin
 
+true
 
 src/test/resources/scrypt.py
-
src/test/resources/secure_hash.key
-
src/test/resources/secure_hash_128.key
+
+**/secure_hash.key
+**/secure_hash_128.key
--- End diff --

`nifi-toolkit/nifi-toolkit-encrypt-config/secure_hash.key` is created when 
I run mvn test on a Linux machine as follows:

```
mvn --projects nifi-toolkit/nifi-toolkit-encrypt-config -Pcontrib-check 
-Dtest=org.apache.nifi.toolkit.encryptconfig.EncryptConfigMainTest#testShouldPerformFullOperationForNiFiPropertiesAndLoginIdentityProvidersAndAuthorizers
 test
```

Excluding these files with wild card would address the RAT check failure, 
but the created file is under directory which is version controlled with Git. 
It's possible that someone may add the created file mistakenly into Git.

```
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
  (use "git add ..." to include in what will be committed)

nifi-toolkit/nifi-toolkit-encrypt-config/secure_hash.key

nothing added to commit but untracked files present (use "git add" to track)
```

I filed [NIFI-5100](https://issues.apache.org/jira/browse/NIFI-5100) and am 
looking for a way to avoid creating such file, or remove it after test.



---


[GitHub] nifi pull request #2648: NIFI-4942 Fix unit test salt assertion regex

2018-04-19 Thread joewitt
Github user joewitt commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2648#discussion_r182926716
  
--- Diff: pom.xml ---
@@ -602,11 +602,13 @@
 org.apache.rat
 apache-rat-plugin
 
+true
--- End diff --

perhaps we should move this to the root nifi/pom.xml


---


[GitHub] nifi pull request #2648: NIFI-4942 Fix unit test salt assertion regex

2018-04-19 Thread kevdoran
GitHub user kevdoran opened a pull request:

https://github.com/apache/nifi/pull/2648

NIFI-4942 Fix unit test salt assertion regex

Thank you for submitting a contribution to Apache NiFi.

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- where  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 master)?

- [ ] Is your initial contribution a single, squashed commit?

### 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?
- [ ] 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 travis-ci for build 
issues and submit an update to your PR as soon as possible.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/kevdoran/nifi NIFI-4942-fix-test

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/nifi/pull/2648.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2648


commit a906c7e7d10b3b478aee165077f87507adeb94c0
Author: Kevin Doran 
Date:   2018-04-19T17:54:23Z

NIFI-4942 Fix unit test salt assertion regex




---