You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by sl...@apache.org on 2025/03/24 00:54:43 UTC
(hadoop) branch trunk updated: YARN-11795. Skip BaseFederationPoliciesTest.testReinitilializeBad3() on JVMs where Mockito cannot mock ByteBuffers (#7510) Contributed by Istvan Toth.
This is an automated email from the ASF dual-hosted git repository.
slfan1989 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push:
new 05167ea06af YARN-11795. Skip BaseFederationPoliciesTest.testReinitilializeBad3() on JVMs where Mockito cannot mock ByteBuffers (#7510) Contributed by Istvan Toth.
05167ea06af is described below
commit 05167ea06af73e02e80b2bdcbd59465423cd116f
Author: Istvan Toth <st...@apache.org>
AuthorDate: Mon Mar 24 01:54:37 2025 +0100
YARN-11795. Skip BaseFederationPoliciesTest.testReinitilializeBad3() on JVMs where Mockito cannot mock ByteBuffers (#7510) Contributed by Istvan Toth.
Signed-off-by: Shilun Fan <sl...@apache.org>
---
.../federation/policies/BaseFederationPoliciesTest.java | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/federation/policies/BaseFederationPoliciesTest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/federation/policies/BaseFederationPoliciesTest.java
index c4d1cf15f1f..8d6fc50c6c9 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/federation/policies/BaseFederationPoliciesTest.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/federation/policies/BaseFederationPoliciesTest.java
@@ -19,6 +19,7 @@
package org.apache.hadoop.yarn.server.federation.policies;
import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
import static org.mockito.Mockito.mock;
import java.nio.ByteBuffer;
@@ -50,6 +51,7 @@
import org.apache.hadoop.yarn.server.federation.utils.FederationPoliciesTestUtil;
import org.apache.hadoop.yarn.server.federation.utils.FederationStateStoreFacade;
import org.junit.jupiter.api.Test;
+import org.mockito.exceptions.base.MockitoException;
/**
* Base class for policies tests, tests for common reinitialization cases.
@@ -100,10 +102,17 @@ public void testReinitilializeBad2() throws YarnException {
@Test
public void testReinitilializeBad3() throws YarnException {
+ ByteBuffer bufTmp = null;
+ try {
+ bufTmp = mock(ByteBuffer.class);
+ } catch (MockitoException e) {
+ assumeTrue(false, "Cannot mock ByteBuffer on Java 19+");
+ }
+ final ByteBuffer buf = bufTmp;
+
assertThrows(FederationPolicyInitializationException.class, () -> {
FederationPolicyInitializationContext fpc =
new FederationPolicyInitializationContext();
- ByteBuffer buf = mock(ByteBuffer.class);
fpc.setSubClusterPolicyConfiguration(SubClusterPolicyConfiguration
.newInstance("queue1", "WrongPolicyName", buf));
fpc.setFederationSubclusterResolver(
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org