Browse Source
Make SsrfProtectionValidator-dependent tests more stable
pull/15266/head
Viacheslav Klimov
6 months ago
Failed to extract signature
3 changed files with
4 additions and
2 deletions
-
common/util/src/test/java/org/thingsboard/common/util/SsrfProtectionValidatorTest.java
-
rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/rest/SsrfSafeAddressResolverGroupTest.java
-
rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/rest/TbHttpClientTest.java
|
|
|
@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
import static org.assertj.core.api.Assertions.assertThatNoException; |
|
|
|
import static org.assertj.core.api.Assertions.assertThatThrownBy; |
|
|
|
|
|
|
|
@ResourceLock("SsrfProtectionValidatorTest") // some tests mutate static additional-blocked-hosts
|
|
|
|
@ResourceLock("SsrfProtectionValidator") // to avoid race conditions when modifying SsrfProtectionValidator's static configuration
|
|
|
|
public class SsrfProtectionValidatorTest { |
|
|
|
|
|
|
|
@ParameterizedTest |
|
|
|
|
|
|
|
@ -37,7 +37,7 @@ import java.util.concurrent.TimeUnit; |
|
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
import static org.assertj.core.api.Assertions.assertThatThrownBy; |
|
|
|
|
|
|
|
@ResourceLock("SsrfSafeAddressResolverGroupTest") |
|
|
|
@ResourceLock("SsrfProtectionValidator") // to avoid race conditions when modifying SsrfProtectionValidator's static configuration
|
|
|
|
class SsrfSafeAddressResolverGroupTest { |
|
|
|
|
|
|
|
private static NioEventLoopGroup eventLoopGroup; |
|
|
|
|
|
|
|
@ -22,6 +22,7 @@ import org.junit.jupiter.api.AfterEach; |
|
|
|
import org.junit.jupiter.api.Assertions; |
|
|
|
import org.junit.jupiter.api.BeforeEach; |
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
import org.junit.jupiter.api.parallel.ResourceLock; |
|
|
|
import org.mockito.ArgumentCaptor; |
|
|
|
import org.mockito.Mockito; |
|
|
|
import org.mockserver.integration.ClientAndServer; |
|
|
|
@ -54,6 +55,7 @@ import static org.mockserver.integration.ClientAndServer.startClientAndServer; |
|
|
|
import static org.mockserver.model.HttpRequest.request; |
|
|
|
import static org.mockserver.model.HttpResponse.response; |
|
|
|
|
|
|
|
@ResourceLock("SsrfProtectionValidator") // to avoid race conditions when modifying SsrfProtectionValidator's static configuration
|
|
|
|
public class TbHttpClientTest { |
|
|
|
|
|
|
|
EventLoopGroup eventLoop; |
|
|
|
|