Skip to content

TestKit tx lifetime #1154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* 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
*
* http://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 neo4j.org.testkit.backend;

public class FrontendError extends RuntimeException
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import neo4j.org.testkit.backend.CustomDriverError;
import neo4j.org.testkit.backend.FrontendError;
import neo4j.org.testkit.backend.TestkitState;
import neo4j.org.testkit.backend.messages.requests.TestkitRequest;
import neo4j.org.testkit.backend.messages.responses.BackendError;
Expand Down Expand Up @@ -160,6 +161,10 @@ else if ( throwable instanceof CustomDriverError )
)
.build();
}
else if ( throwable instanceof FrontendError )
{
return neo4j.org.testkit.backend.messages.responses.FrontendError.builder().build();
}
else
{
return BackendError.builder().data( BackendError.BackendErrorBody.builder().msg( throwable.toString() ).build() ).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import lombok.Getter;
import lombok.Setter;
import neo4j.org.testkit.backend.FrontendError;
import neo4j.org.testkit.backend.TestkitState;
import neo4j.org.testkit.backend.holder.SessionHolder;
import neo4j.org.testkit.backend.messages.responses.TestkitResponse;
Expand All @@ -44,7 +45,7 @@ public TestkitResponse process( TestkitState testkitState )
}
else
{
throwable = new RuntimeException( "Error from client in retryable tx" );
throwable = new FrontendError();
}
sessionHolder.getTxWorkFuture().completeExceptionally( throwable );
return null;
Expand All @@ -64,7 +65,7 @@ public CompletionStage<TestkitResponse> processAsync( TestkitState testkitState
}
else
{
throwable = new RuntimeException( "Error from client in retryable tx" );
throwable = new FrontendError();
}
sessionHolder.getTxWorkFuture().completeExceptionally( throwable );
return null;
Expand All @@ -85,7 +86,7 @@ public Mono<TestkitResponse> processRx( TestkitState testkitState )
}
else
{
throwable = new RuntimeException( "Error from client in retryable tx" );
throwable = new FrontendError();
}
sessionHolder.getTxWorkFuture().completeExceptionally( throwable );
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ public class StartTest implements TestkitRequest
COMMON_SKIP_PATTERN_TO_REASON.put( "^.*\\.test_partial_summary_contains_system_updates$", "Does not contain updates because value is zero" );
COMMON_SKIP_PATTERN_TO_REASON.put( "^.*\\.test_partial_summary_contains_updates$", "Does not contain updates because value is zero" );
COMMON_SKIP_PATTERN_TO_REASON.put( "^.*\\.test_supports_multi_db$", "Database is None" );
COMMON_SKIP_PATTERN_TO_REASON.put( "^.*\\.test_managed_tx_raises_tx_managed_exec$",
"Driver (still) allows explicit managing of managed transaction" );
String skipMessage = "This test expects hostname verification to be turned off when all certificates are trusted";
COMMON_SKIP_PATTERN_TO_REASON.put( "^.*\\.TestTrustAllCertsConfig\\.test_trusted_ca_wrong_hostname$", skipMessage );
COMMON_SKIP_PATTERN_TO_REASON.put( "^.*\\.TestTrustAllCertsConfig\\.test_untrusted_ca_wrong_hostname$", skipMessage );

ASYNC_SKIP_PATTERN_TO_REASON.putAll( COMMON_SKIP_PATTERN_TO_REASON );

REACTIVE_SKIP_PATTERN_TO_REASON.putAll( COMMON_SKIP_PATTERN_TO_REASON );
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* 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
*
* http://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 neo4j.org.testkit.backend.messages.responses;

import lombok.Builder;
import lombok.Getter;

@Getter
@Builder
public class FrontendError implements TestkitResponse
{
private final FrontendErrorBody data = new FrontendErrorBody("Imagine client code that throws...");

@Override
public String testkitName()
{
return "FrontendError";
}

@Getter
@Builder
public static class FrontendErrorBody
{
private String msg;
}
}