This is an automated email from the ASF dual-hosted git repository.
exceptionfactory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new ccf3866261 NIFI-9812 Disabled Native Lib loading tests on ARM64
ccf3866261 is described below
commit ccf386626142e8e8447e0983d75b893d289cc5b8
Author: Kevin Doran <[email protected]>
AuthorDate: Sat Jul 16 13:10:39 2022 -0400
NIFI-9812 Disabled Native Lib loading tests on ARM64
- Migrate tests in nifi-framework-mark-loading-utils to JUnit5
- Annotate tests that use x86_64 native binaries to be conditional on
x86_64 os.arch
This closes #6215
Signed-off-by: David Handermann <[email protected]>
---
.../org/apache/nifi/nar/AbstractTestNarLoader.java | 16 ++++-----------
.../apache/nifi/nar/TestLoadNativeLibFromNar.java | 18 ++++++++---------
.../nar/TestLoadNativeLibViaSystemProperty.java | 23 ++++++++++++----------
.../java/org/apache/nifi/nar/TestNarLoader.java | 20 +++++++++----------
4 files changed, 34 insertions(+), 43 deletions(-)
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-nar-loading-utils/src/test/java/org/apache/nifi/nar/AbstractTestNarLoader.java
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-nar-loading-utils/src/test/java/org/apache/nifi/nar/AbstractTestNarLoader.java
index a34ef92c7c..5548031aa2 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-nar-loading-utils/src/test/java/org/apache/nifi/nar/AbstractTestNarLoader.java
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-nar-loading-utils/src/test/java/org/apache/nifi/nar/AbstractTestNarLoader.java
@@ -16,15 +16,12 @@
*/
package org.apache.nifi.nar;
-import org.apache.commons.lang3.SystemUtils;
import org.apache.nifi.bundle.Bundle;
import org.apache.nifi.controller.ControllerService;
import org.apache.nifi.processor.Processor;
import org.apache.nifi.reporting.ReportingTask;
import org.apache.nifi.util.NiFiProperties;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.BeforeClass;
+import org.junit.jupiter.api.BeforeEach;
import java.io.File;
import java.io.IOException;
@@ -36,8 +33,8 @@ import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.Collections;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public abstract class AbstractTestNarLoader {
abstract String getWorkDir();
@@ -52,12 +49,7 @@ public abstract class AbstractTestNarLoader {
NarClassLoaders narClassLoaders;
ExtensionDiscoveringManager extensionManager;
- @BeforeClass
- public static void setupClass() {
- Assume.assumeTrue("Test only runs on *nix",
!SystemUtils.IS_OS_WINDOWS);
- }
-
- @Before
+ @BeforeEach
public void setup() throws IOException, ClassNotFoundException {
deleteDir(getWorkDir());
deleteDir(getNarAutoloadDir());
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-nar-loading-utils/src/test/java/org/apache/nifi/nar/TestLoadNativeLibFromNar.java
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-nar-loading-utils/src/test/java/org/apache/nifi/nar/TestLoadNativeLibFromNar.java
index a54eda5dbd..49033f50fe 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-nar-loading-utils/src/test/java/org/apache/nifi/nar/TestLoadNativeLibFromNar.java
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-nar-loading-utils/src/test/java/org/apache/nifi/nar/TestLoadNativeLibFromNar.java
@@ -17,8 +17,10 @@
package org.apache.nifi.nar;
import org.apache.nifi.bundle.Bundle;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
+import org.junit.jupiter.api.condition.EnabledOnOs;
+import org.junit.jupiter.api.condition.OS;
import java.io.File;
import java.nio.file.Files;
@@ -34,21 +36,17 @@ import java.util.stream.Collectors;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.hasItem;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assume.assumeTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+@EnabledOnOs({ OS.MAC })
+@DisabledIfSystemProperty(named = "os.arch", matches = "aarch64|arm64")
public class TestLoadNativeLibFromNar extends AbstractTestNarLoader {
static final String WORK_DIR = "./target/work";
static final String NAR_AUTOLOAD_DIR = "./target/nars_with_native_lib";
static final String PROPERTIES_FILE =
"./src/test/resources/conf/nifi.nar_with_native_lib.properties";
static final String EXTENSIONS_DIR =
"./src/test/resources/nars_with_native_lib";
- @BeforeClass
- public static void setUpSuite() {
- assumeTrue("Test only runs on Mac OS", new OSUtil(){}.isOsMac());
- }
-
@Test
public void testLoadSameLibraryFromBy2NarClassLoadersFromNar() throws
Exception {
final File extensionsDir = new File(EXTENSIONS_DIR);
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-nar-loading-utils/src/test/java/org/apache/nifi/nar/TestLoadNativeLibViaSystemProperty.java
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-nar-loading-utils/src/test/java/org/apache/nifi/nar/TestLoadNativeLibViaSystemProperty.java
index 992d4a031d..ae13005094 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-nar-loading-utils/src/test/java/org/apache/nifi/nar/TestLoadNativeLibViaSystemProperty.java
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-nar-loading-utils/src/test/java/org/apache/nifi/nar/TestLoadNativeLibViaSystemProperty.java
@@ -17,9 +17,12 @@
package org.apache.nifi.nar;
import org.apache.nifi.bundle.Bundle;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
+import org.junit.jupiter.api.condition.EnabledOnOs;
+import org.junit.jupiter.api.condition.OS;
import java.io.File;
import java.nio.file.Files;
@@ -35,10 +38,12 @@ import java.util.stream.Collectors;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.hasItem;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assume.assumeTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+@EnabledOnOs({ OS.MAC })
+@DisabledIfSystemProperty(named = "os.arch", matches = "aarch64|arm64")
public class TestLoadNativeLibViaSystemProperty extends AbstractTestNarLoader {
static final String WORK_DIR = "./target/work";
static final String NAR_AUTOLOAD_DIR = "./target/nars_without_native_lib";
@@ -47,15 +52,13 @@ public class TestLoadNativeLibViaSystemProperty extends
AbstractTestNarLoader {
private static String oldJavaLibraryPath;
- @BeforeClass
+ @BeforeAll
public static void setUpClass() {
- assumeTrue("Test only runs on Mac OS", new OSUtil(){}.isOsMac());
-
oldJavaLibraryPath = System.getProperty("java.library.path");
System.setProperty("java.library.path", "./src/test/resources/native");
}
- @AfterClass
+ @AfterAll
public static void tearDownSuite() {
if (oldJavaLibraryPath != null) {
System.setProperty("java.library.path", oldJavaLibraryPath);
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-nar-loading-utils/src/test/java/org/apache/nifi/nar/TestNarLoader.java
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-nar-loading-utils/src/test/java/org/apache/nifi/nar/TestNarLoader.java
index 4f09402ab1..581e1fa229 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-nar-loading-utils/src/test/java/org/apache/nifi/nar/TestNarLoader.java
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-nar-loading-utils/src/test/java/org/apache/nifi/nar/TestNarLoader.java
@@ -16,13 +16,13 @@
*/
package org.apache.nifi.nar;
-import org.apache.commons.lang3.SystemUtils;
import org.apache.nifi.controller.ControllerService;
import org.apache.nifi.processor.Processor;
import org.apache.nifi.reporting.ReportingTask;
-import org.junit.Assume;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
+import org.junit.jupiter.api.condition.DisabledOnOs;
+import org.junit.jupiter.api.condition.OS;
import java.io.File;
import java.io.IOException;
@@ -33,20 +33,18 @@ import java.nio.file.StandardCopyOption;
import java.util.Arrays;
import java.util.List;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+@DisabledOnOs({ OS.WINDOWS })
+@DisabledIfSystemProperty(named = "os.arch", matches = "aarch64|arm64")
public class TestNarLoader extends AbstractTestNarLoader {
static final String WORK_DIR = "./target/work";
static final String NAR_AUTOLOAD_DIR = "./target/extensions";
static final String PROPERTIES_FILE =
"./src/test/resources/conf/nifi.properties";
static final String EXTENSIONS_DIR = "./src/test/resources/extensions";
- @BeforeClass
- public static void setUpSuite() {
- Assume.assumeTrue("Test only runs on *nix",
!SystemUtils.IS_OS_WINDOWS);
- }
-
@Test
public void testNarLoaderWhenAllAvailable() throws IOException {
// Copy all NARs from src/test/resources/extensions to
target/extensions