Sitelet https://github.com/googleapis/google-cloud-java/issues/42
Skip to content

Testing PubsubService #42

Description

@psakkaris

I would like to contribute to this project by helping out on the Pubsub feature. I forked the repo and implemented a PubsubRpc client. I will now move on to create a PubsubService and Examples with documentation. But, I have a question with testing:

To unit test I can make a mock PubsubRpc client that simulates response json from the rest api, however, I was thinking a better way could be to have a Pubsub emulation available as a local development environment like the Datastore local dev server. I know as a user of GCP that would make my life much easier for testing things out. So not only do we get a good unit testing mechanism, but it will be a valuable tool for developers in general. What are your thoughts on this functionality, and if I decide to add this local dev pubsub environment, do you think it belongs in gcloud-java or somewhere else?

Activity

  1. aozarov commented on Apr 8, 2015

    @aozarov
    Contributor

    Having your contribution would be awesome!
    I agree that using a local implementation for PubSub (such as the gcd.sh for Datastore) for testing would be great but this should be decided by someone from the service (I will make sure they respond to this issue). If you were planning to write such tool in Java then, as you suggested, you can create a c.g.gcloud.spi.PubsubRpc version for testing that delegates to it directly (until its available as an external process).

  2. tmatsuo commented on Apr 8, 2015

    @tmatsuo
    Contributor

    This is great! Here is my opinion. Since the local emulator can be an independent server process, it will benefit users of other languages. In that sense I think the emulator should live somewhere else other than gcloud-java. Ideally it should become a sub component of gcloud sdk (Google Cloud SDK).

    @psakkaris @aozarov WDYT?

  3. psakkaris commented on Apr 8, 2015

    @psakkaris
    Author

    Thanks for the feedback! Yes gcloud sdk seems the most appropriate place for a pubsub emulator. gcloud sdk is also open source correct? I found this https://code.google.com/p/google-cloud-sdk/

  4. proppy commented on Apr 8, 2015

    @proppy

    Even if the cloud-sdk code is under Apache 2.0, I don't think there is a public repository for you to contribute to atm. /cc @skelterjohn

    I would suggest to start a repository independent from the cloud-sdk, recommends its usage from the various gcloud- repo once it is tested, and work into including it into the gcloud distribution as a separate effort.

  5. tmatsuo commented on Apr 8, 2015

    @tmatsuo
    Contributor

    @proppy Yup, that sounds right to me. Thanks!

  6. psakkaris commented on Apr 8, 2015

    @psakkaris
    Author

    ok sounds good!

  7. pjvds commented on Apr 30, 2015

    @pjvds

    There is an issue at the Official Google Cloud Pub/Sub feature request and issue tracker. The best way to let the team know you are interested in this feature is to vote for it by starring the issue.

  8. tmatsuo commented on May 6, 2015

    @tmatsuo
    Contributor

    @psakkaris How are the things going with PubsubRpc?
    For the tests for PubsubRpc, I would just use mocks.

    @aozarov WDYT?

  9. tmatsuo commented on May 6, 2015

    @tmatsuo
    Contributor

    Also if you want to have integration tests, you can even use the actual cloud project for testing purpose. I can setup the billing whitelisted project, a service account, and the travis configuration for the service account key.

  10. aozarov commented on May 6, 2015

    @aozarov
    Contributor

    Yes, I think using mocks as an interim solution for unit-tests until local
    service is available should be fine.

    On Wed, May 6, 2015 at 10:50 AM, Takashi Matsuo notifications@github.com
    wrote:

    @psakkaris https://github.com/psakkaris How are the things going with
    PubsubRpc?
    For the tests for PubsubRpc, I would just use mocks.

    @aozarov https://github.com/aozarov WDYT?

    —
    Reply to this email directly or view it on GitHub
    #42 (comment)
    .

  11. psakkaris commented on May 8, 2015

    @psakkaris
    Author

    Hey guys, PubsubRpc is implemented and checked in on my fork. I am now moving on to the higher level PubsubService. I'll just use mocks for the unit testing. If all goes as planned I should have everything in with example documentation by end of month.

  12. aozarov commented on May 8, 2015

    @aozarov
    Contributor

    Thank is great news! Thank you for your contribution and let me know when
    you things are ready for review.
    Arie.

    On Fri, May 8, 2015 at 2:13 PM, Periklis (Perry) Sakkaris <notifications@
    github.com> wrote:

    Hey guys, PubsubRpc is implemented and checked in on my fork. I am now
    moving on to the higher level PubsubService. I'll just use mocks for the
    unit testing. If all goes as planned I should have everything in with
    example documentation by end of month.

    —
    Reply to this email directly or view it on GitHub
    #42 (comment)
    .

  13. aozarov commented on May 29, 2015

    @aozarov
    Contributor

    @psakkaris any updates?

  14. added a commit that references this issue on Mar 29, 2016
  15. mziccard commented on Jul 22, 2016

    @mziccard
    Contributor

    Closing this, support for Pub/Sub using gRPC was added in #1085

  16. 10 remaining items

  17. added a commit that references this issue on Dec 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

🚨 criticalP0 critical issue. Requires immediate fixtriage meI really want to be triaged.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions