Skip to content
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

update TESTING.md #4409

Merged
merged 1 commit into from
Feb 7, 2019
Merged
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
45 changes: 1 addition & 44 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,50 +156,7 @@ uses the `RemoteLoggingHelper` to create a metric.

You can test against a Pub/Sub emulator:

1. [Install Cloud SDK](https://cloud.google.com/sdk/downloads)

2. Start the emulator:
```shell
$ gcloud beta emulators pubsub start
```

To determine which host/port the emulator is running on:
```shell
$ gcloud beta emulators pubsub env-init
# Sample output:
# export PUBSUB_EMULATOR_HOST=localhost:8759
```

3. Point your client to the emulator.
```java
String hostport = System.getenv("PUBSUB_EMULATOR_HOST");
ManagedChannel channel = ManagedChannelBuilder.forTarget(hostport).usePlaintext(true).build();
try {
ChannelProvider channelProvider = FixedChannelProvider.create(channel);
CredentialsProvider credentialsProvider = new NoCredentialsProvider();

// Similarly for SubscriptionAdminSettings
TopicAdminClient topicClient = TopicAdminClient.create(
TopicAdminSettings
.defaultBuilder()
.setTransportProvider(
GrpcTransportProvider.newBuilder()
.setChannelProvider(channelProvider)
.build())
.setCredentialsProvider(credentialsProvider)
.build());

// Similarly for Subscriber
Publisher publisher =
Publisher
.defaultBuilder(topicName)
.setChannelProvider(channelProvider)
.setCredentialsProvider(credentialsProvider)
.build();
} finally {
channel.shutdown();
}
```
1. [Set up the emulator](https://cloud.google.com/pubsub/docs/emulator)

### Testing code that uses Redis

Expand Down