Repository: nifi Updated Branches: refs/heads/master 082b99640 -> f31f2a5f2
NIFI-3836 Added check for root user in test that depends on unreadable file. This closes #1865. Signed-off-by: Andy LoPresto <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/f31f2a5f Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/f31f2a5f Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/f31f2a5f Branch: refs/heads/master Commit: f31f2a5f2663844874d017c69f941458bedeaf51 Parents: 082b996 Author: Andy LoPresto <[email protected]> Authored: Fri May 26 10:27:18 2017 -0700 Committer: Andy LoPresto <[email protected]> Committed: Mon Jun 5 18:58:07 2017 -0700 ---------------------------------------------------------------------- .../org/apache/nifi/provenance/CryptoUtilsTest.groovy | 9 +++++++++ 1 file changed, 9 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi/blob/f31f2a5f/nifi-commons/nifi-data-provenance-utils/src/test/groovy/org/apache/nifi/provenance/CryptoUtilsTest.groovy ---------------------------------------------------------------------- diff --git a/nifi-commons/nifi-data-provenance-utils/src/test/groovy/org/apache/nifi/provenance/CryptoUtilsTest.groovy b/nifi-commons/nifi-data-provenance-utils/src/test/groovy/org/apache/nifi/provenance/CryptoUtilsTest.groovy index f4992b6..9ba8e97 100644 --- a/nifi-commons/nifi-data-provenance-utils/src/test/groovy/org/apache/nifi/provenance/CryptoUtilsTest.groovy +++ b/nifi-commons/nifi-data-provenance-utils/src/test/groovy/org/apache/nifi/provenance/CryptoUtilsTest.groovy @@ -88,6 +88,14 @@ class CryptoUtilsTest { Cipher.getMaxAllowedKeyLength("AES") > 128 } + private static boolean isRootUser() { + ProcessBuilder pb = new ProcessBuilder(["id", "-u"]) + Process process = pb.start() + InputStream responseStream = process.getInputStream() + BufferedReader responseReader = new BufferedReader(new InputStreamReader(responseStream)) + responseReader.text.trim() == "0" + } + @Test void testShouldConcatenateByteArrays() { // Arrange @@ -197,6 +205,7 @@ class CryptoUtilsTest { void testShouldNotValidateUnreadableFileBasedKeyProvider() { // Arrange Assume.assumeFalse("This test does not run on Windows", SystemUtils.IS_OS_WINDOWS) + Assume.assumeFalse("This test does not run for root users", isRootUser()) String fileBasedProvider = FileBasedKeyProvider.class.name File fileBasedProviderFile = tempFolder.newFile("filebased.kp")
