Skip to content

Commit a3eef1e

Browse files
authored
Skipping not applicable tests (#880)
1 parent 6ac0163 commit a3eef1e

File tree

2 files changed

+76
-1
lines changed

2 files changed

+76
-1
lines changed

testkit-backend/src/main/java/neo4j/org/testkit/backend/messages/requests/StartTest.java

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,49 @@
2323
import lombok.Setter;
2424
import neo4j.org.testkit.backend.TestkitState;
2525
import neo4j.org.testkit.backend.messages.responses.RunTest;
26+
import neo4j.org.testkit.backend.messages.responses.SkipTest;
2627
import neo4j.org.testkit.backend.messages.responses.TestkitResponse;
2728

29+
import java.util.LinkedHashMap;
30+
import java.util.Map;
31+
2832
@Setter
2933
@Getter
3034
@NoArgsConstructor
3135
public class StartTest implements TestkitRequest
3236
{
37+
private static final Map<String,String> SKIP_PATTERN_TO_REASON = new LinkedHashMap<>();
38+
39+
static
40+
{
41+
SKIP_PATTERN_TO_REASON.put( "^.*retry.TestRetryClustering.test_retry_database_unavailable$", "The test is not applicable to 4.2 driver" );
42+
SKIP_PATTERN_TO_REASON.put( "^.*retry.TestRetryClustering.test_retry_made_up_transient$", "The test is not applicable to 4.2 driver" );
43+
SKIP_PATTERN_TO_REASON.put( "^.*retry.TestRetryClustering.test_retry_ForbiddenOnReadOnlyDatabase$", "The test is not applicable to 4.2 driver" );
44+
SKIP_PATTERN_TO_REASON.put( "^.*retry.TestRetryClustering.test_retry_NotALeader$", "The test is not applicable to 4.2 driver" );
45+
SKIP_PATTERN_TO_REASON
46+
.put( "^.*retry.TestRetryClustering.test_retry_ForbiddenOnReadOnlyDatabase_ChangingWriter$", "The test is not applicable to 4.2 driver" );
47+
SKIP_PATTERN_TO_REASON.put( "^.*routing.Routing\\..+$", "The tests are not applicable to 4.2 driver" );
48+
SKIP_PATTERN_TO_REASON
49+
.put( "^.+routing.Routing.*\\.test_should_successfully_get_server_protocol_version$", "The test is not applicable to 4.2 driver" );
50+
SKIP_PATTERN_TO_REASON.put( "^.+routing.Routing.*\\.test_should_successfully_get_server_agent$", "The test is not applicable to 4.2 driver" );
51+
}
52+
3353
private StartTestBody data;
3454

3555
@Override
3656
public TestkitResponse process( TestkitState testkitState )
3757
{
38-
return RunTest.builder().build();
58+
return SKIP_PATTERN_TO_REASON
59+
.entrySet()
60+
.stream()
61+
.filter( entry -> data.getTestName().matches( entry.getKey() ) )
62+
.findFirst()
63+
.map( entry -> (TestkitResponse) SkipTest.builder()
64+
.data( SkipTest.SkipTestBody.builder()
65+
.reason( entry.getValue() )
66+
.build() )
67+
.build() )
68+
.orElseGet( () -> RunTest.builder().build() );
3969
}
4070

4171
@Setter
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright (c) "Neo4j"
3+
* Neo4j Sweden AB [http://neo4j.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
package neo4j.org.testkit.backend.messages.responses;
20+
21+
import lombok.Builder;
22+
import lombok.Getter;
23+
import lombok.Setter;
24+
25+
@Setter
26+
@Getter
27+
@Builder
28+
public class SkipTest implements TestkitResponse
29+
{
30+
private SkipTestBody data;
31+
32+
@Override
33+
public String testkitName()
34+
{
35+
return "SkipTest";
36+
}
37+
38+
@Setter
39+
@Getter
40+
@Builder
41+
public static class SkipTestBody
42+
{
43+
private final String reason;
44+
}
45+
}

0 commit comments

Comments
 (0)