From 3d2e1de2372fc54ab1c20a134c1c03e284235b34 Mon Sep 17 00:00:00 2001 From: Janne Valkealahti Date: Sat, 31 Oct 2020 14:51:50 +0000 Subject: [PATCH] Allow some blockhound block methods - Looks like some tests fails with redis as new lettuse driver, during connect phase, will block as there's a timeout which cause a block within netty internals(which a bit weird). - Time of this commit block error came from https://github.com/netty/netty/blame/4.1/common/src/main/java/io/netty/util/HashedWheelTimer.java#L349 --- .../StateMachineBlockHoundIntegration.java | 29 +++++++++++++++++++ ...ockhound.integration.BlockHoundIntegration | 1 + .../StateMachineBlockHoundIntegration.java | 29 +++++++++++++++++++ ...ockhound.integration.BlockHoundIntegration | 1 + 4 files changed, 60 insertions(+) create mode 100644 spring-statemachine-build-tests/src/test/java/org/springframework/statemachine/buildtests/StateMachineBlockHoundIntegration.java create mode 100644 spring-statemachine-build-tests/src/test/resources/META-INF/services/reactor.blockhound.integration.BlockHoundIntegration create mode 100644 spring-statemachine-data/redis/src/test/java/org/springframework/statemachine/data/redis/StateMachineBlockHoundIntegration.java create mode 100644 spring-statemachine-data/redis/src/test/resources/META-INF/services/reactor.blockhound.integration.BlockHoundIntegration diff --git a/spring-statemachine-build-tests/src/test/java/org/springframework/statemachine/buildtests/StateMachineBlockHoundIntegration.java b/spring-statemachine-build-tests/src/test/java/org/springframework/statemachine/buildtests/StateMachineBlockHoundIntegration.java new file mode 100644 index 00000000..05078f76 --- /dev/null +++ b/spring-statemachine-build-tests/src/test/java/org/springframework/statemachine/buildtests/StateMachineBlockHoundIntegration.java @@ -0,0 +1,29 @@ +/* + * Copyright 2020 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.statemachine.buildtests; + +import reactor.blockhound.BlockHound.Builder; +import reactor.blockhound.integration.BlockHoundIntegration; + +public class StateMachineBlockHoundIntegration implements BlockHoundIntegration { + + @Override + public void applyTo(Builder builder) { + // whitelisting some blocking calls in tests + builder + .allowBlockingCallsInside("java.util.concurrent.locks.AbstractQueuedSynchronizer", "parkAndCheckInterrupt"); + } +} diff --git a/spring-statemachine-build-tests/src/test/resources/META-INF/services/reactor.blockhound.integration.BlockHoundIntegration b/spring-statemachine-build-tests/src/test/resources/META-INF/services/reactor.blockhound.integration.BlockHoundIntegration new file mode 100644 index 00000000..00eee102 --- /dev/null +++ b/spring-statemachine-build-tests/src/test/resources/META-INF/services/reactor.blockhound.integration.BlockHoundIntegration @@ -0,0 +1 @@ +org.springframework.statemachine.buildtests.StateMachineBlockHoundIntegration \ No newline at end of file diff --git a/spring-statemachine-data/redis/src/test/java/org/springframework/statemachine/data/redis/StateMachineBlockHoundIntegration.java b/spring-statemachine-data/redis/src/test/java/org/springframework/statemachine/data/redis/StateMachineBlockHoundIntegration.java new file mode 100644 index 00000000..e2e5fd38 --- /dev/null +++ b/spring-statemachine-data/redis/src/test/java/org/springframework/statemachine/data/redis/StateMachineBlockHoundIntegration.java @@ -0,0 +1,29 @@ +/* + * Copyright 2020 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.statemachine.data.redis; + +import reactor.blockhound.BlockHound.Builder; +import reactor.blockhound.integration.BlockHoundIntegration; + +public class StateMachineBlockHoundIntegration implements BlockHoundIntegration { + + @Override + public void applyTo(Builder builder) { + // whitelisting some blocking calls in tests + builder + .allowBlockingCallsInside("java.util.concurrent.locks.AbstractQueuedSynchronizer", "parkAndCheckInterrupt"); + } +} diff --git a/spring-statemachine-data/redis/src/test/resources/META-INF/services/reactor.blockhound.integration.BlockHoundIntegration b/spring-statemachine-data/redis/src/test/resources/META-INF/services/reactor.blockhound.integration.BlockHoundIntegration new file mode 100644 index 00000000..f4cfb128 --- /dev/null +++ b/spring-statemachine-data/redis/src/test/resources/META-INF/services/reactor.blockhound.integration.BlockHoundIntegration @@ -0,0 +1 @@ +org.springframework.statemachine.data.redis.StateMachineBlockHoundIntegration \ No newline at end of file