mirror of https://github.com/apache/nifi.git
NIFI-3836 Added check for root user in test that depends on unreadable file.
This closes #1865. Signed-off-by: Andy LoPresto <alopresto@apache.org>
This commit is contained in:
parent
082b99640e
commit
f31f2a5f26
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue