(ctx context.Context, pubClient *raw.PublisherClient, topicName, topicPath string)
| 79 | } |
| 80 | |
| 81 | func createTopic(ctx context.Context, pubClient *raw.PublisherClient, topicName, topicPath string) (dt driver.Topic, cleanup func(), err error) { |
| 82 | _, err = pubClient.CreateTopic(ctx, &pubsubpb.Topic{Name: topicPath}) |
| 83 | if err != nil { |
| 84 | return nil, nil, err |
| 85 | } |
| 86 | dt = openTopic(pubClient, path.Join("projects", projectID, "topics", topicName)) |
| 87 | cleanup = func() { |
| 88 | pubClient.DeleteTopic(ctx, &pubsubpb.DeleteTopicRequest{Topic: topicPath}) |
| 89 | } |
| 90 | return dt, cleanup, nil |
| 91 | } |
| 92 | |
| 93 | func (h *harness) MakeNonexistentTopic(ctx context.Context) (driver.Topic, error) { |
| 94 | return openTopic(h.pubClient, path.Join("projects", projectID, "topics", "nonexistent-topic")), nil |
no test coverage detected