-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #267 from ydb-platform/fix_concurrent_tests
Added experimental option to use native docker port binding
- Loading branch information
Showing
19 changed files
with
583 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
tests/common/src/main/java/tech/ydb/test/integration/docker/DiscoveryServiceProxy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package tech.ydb.test.integration.docker; | ||
|
||
import com.google.protobuf.Any; | ||
import io.grpc.Metadata; | ||
import io.grpc.ServerCall; | ||
import io.grpc.ServerCallHandler; | ||
import io.grpc.ServerMethodDefinition; | ||
import io.grpc.Status; | ||
|
||
import tech.ydb.core.impl.pool.EndpointRecord; | ||
import tech.ydb.proto.OperationProtos; | ||
import tech.ydb.proto.StatusCodesProtos; | ||
import tech.ydb.proto.discovery.DiscoveryProtos; | ||
import tech.ydb.proto.discovery.v1.DiscoveryServiceGrpc; | ||
|
||
|
||
/** | ||
* | ||
* @author Aleksandr Gorshenin | ||
*/ | ||
public class DiscoveryServiceProxy | ||
implements ServerCallHandler<DiscoveryProtos.ListEndpointsRequest, DiscoveryProtos.ListEndpointsResponse> { | ||
|
||
private final EndpointRecord endpoint; | ||
|
||
public DiscoveryServiceProxy(EndpointRecord endpoint) { | ||
this.endpoint = endpoint; | ||
} | ||
|
||
public ServerMethodDefinition<?, ?> toMethodDefinition() { | ||
return ServerMethodDefinition.create(DiscoveryServiceGrpc.getListEndpointsMethod(), this); | ||
} | ||
|
||
@Override | ||
public ServerCall.Listener<DiscoveryProtos.ListEndpointsRequest> startCall( | ||
ServerCall<DiscoveryProtos.ListEndpointsRequest, DiscoveryProtos.ListEndpointsResponse> serverCall, | ||
Metadata metadata | ||
) { | ||
serverCall.request(1); | ||
serverCall.sendHeaders(new Metadata()); | ||
return new ServerCall.Listener<DiscoveryProtos.ListEndpointsRequest>() { | ||
@Override | ||
public void onMessage(DiscoveryProtos.ListEndpointsRequest message) { | ||
serverCall.sendMessage(createDiscoveryResponse()); | ||
} | ||
|
||
@Override | ||
public void onHalfClose() { | ||
serverCall.close(Status.OK, new Metadata()); | ||
} | ||
}; | ||
} | ||
|
||
private DiscoveryProtos.ListEndpointsResponse createDiscoveryResponse() { | ||
DiscoveryProtos.ListEndpointsResult result = DiscoveryProtos.ListEndpointsResult.newBuilder() | ||
.setSelfLocation("PROXY") | ||
.addEndpoints(DiscoveryProtos.EndpointInfo.newBuilder() | ||
.setAddress(endpoint.getHost()) | ||
.setPort(endpoint.getPort()) | ||
.build() | ||
) | ||
.build(); | ||
|
||
OperationProtos.Operation operation = OperationProtos.Operation.newBuilder() | ||
.setReady(true) | ||
.setStatus(StatusCodesProtos.StatusIds.StatusCode.SUCCESS) | ||
.setId("grpc-proxy-discovery") | ||
.setResult(Any.pack(result)) | ||
.build(); | ||
|
||
return DiscoveryProtos.ListEndpointsResponse.newBuilder() | ||
.setOperation(operation) | ||
.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.