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
|
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
|
@Test
|
||||||
void testShouldConcatenateByteArrays() {
|
void testShouldConcatenateByteArrays() {
|
||||||
// Arrange
|
// Arrange
|
||||||
|
@ -197,6 +205,7 @@ class CryptoUtilsTest {
|
||||||
void testShouldNotValidateUnreadableFileBasedKeyProvider() {
|
void testShouldNotValidateUnreadableFileBasedKeyProvider() {
|
||||||
// Arrange
|
// Arrange
|
||||||
Assume.assumeFalse("This test does not run on Windows", SystemUtils.IS_OS_WINDOWS)
|
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
|
String fileBasedProvider = FileBasedKeyProvider.class.name
|
||||||
File fileBasedProviderFile = tempFolder.newFile("filebased.kp")
|
File fileBasedProviderFile = tempFolder.newFile("filebased.kp")
|
||||||
|
|
Loading…
Reference in New Issue