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

feat: add mock library w/ StreamRange #9998

Merged
merged 6 commits into from
Oct 28, 2022

Conversation

dbolduc
Copy link
Member

@dbolduc dbolduc commented Oct 7, 2022

Fixes #9052

as discussed in go/cloud-cxx:mock-stream-range


This change is Reviewable

@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 94f9d00bae73a3593e31122265f35da440b0c850

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@codecov
Copy link

codecov bot commented Oct 7, 2022

Codecov Report

Base: 93.96% // Head: 93.97% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (111bea4) compared to base (e4ade72).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9998   +/-   ##
=======================================
  Coverage   93.96%   93.97%           
=======================================
  Files        1513     1515    +2     
  Lines      139964   140003   +39     
=======================================
+ Hits       131524   131563   +39     
  Misses       8440     8440           
Impacted Files Coverage Δ
google/cloud/mocks/mock_stream_range.h 100.00% <100.00%> (ø)
google/cloud/mocks/mock_stream_range_test.cc 100.00% <100.00%> (ø)
...integration_tests/schema_admin_integration_test.cc 98.88% <0.00%> (-1.12%) ⬇️
google/cloud/pubsub/subscriber_connection_test.cc 97.81% <0.00%> (-0.55%) ⬇️
google/cloud/pubsub/samples/samples.cc 90.70% <0.00%> (-0.15%) ⬇️
google/cloud/storage/parallel_upload.cc 98.62% <0.00%> (+0.34%) ⬆️
...le/cloud/internal/default_completion_queue_impl.cc 97.15% <0.00%> (+0.56%) ⬆️
...ud/spanner/integration_tests/client_stress_test.cc 84.86% <0.00%> (+0.65%) ⬆️
...e/cloud/pubsublite/internal/alarm_registry_impl.cc 100.00% <0.00%> (+2.94%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@dbolduc dbolduc marked this pull request as ready for review October 7, 2022 18:03
@dbolduc dbolduc requested a review from a team as a code owner October 7, 2022 18:03
google/cloud/google_cloud_cpp_common.cmake Outdated Show resolved Hide resolved

create_bazel_config(google_cloud_cpp_mocks YEAR "2022")

google_cloud_cpp_install_headers("google_cloud_cpp_mocks"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, I think this will install the .h file, but we are not installing the targets (see #5782). Can you check that the header installs correctly (maybe look at the installed files in one of the demo-* builds?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I run

ci/cloudbuild.sh -t demo-fedora-pr -s
# (inside docker shell now)

ci/cloudbuild.sh --local --build demo-install
# (build runs)

ls /h/google-cloud-cpp-installed/include/google/cloud/mocks/
# Output:
#    mock_stream_range.h

And if I run:

grep -rl mocks /h/google-cloud-cpp-installed/lib64/cmake/
# Output:
#    /h/google-cloud-cpp-installed/lib64/cmake/google_cloud_cpp_pubsub/pubsub-targets.cmake

I take it that #5782 involves getting the other mock libraries to show up.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe done? But does it need a pkgconfig thing like we do with rest_internal?

Should it have its own target separate from google_cloud_cpp_common-targets ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's call it done. The pkgconfig thing will be needed for #5782

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pkg-config has been left for a follow up PR.

I did move the targets out of google_cloud_cpp_common-targets.cmake and into a new google_cloud_cpp_mocks-targets.cmake. I think we want to do this to avoid installing the mock targets into the google_cloud_cpp_runtime component.

PTAL, because your original review was from a lifetime ago

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no .pc file, but there is no -config.cmake file either. Is that intentional?

@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 790755488e190dfa0fbb68b30e5b009220e7a8c2

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@dbolduc dbolduc force-pushed the feat-mocks-library branch from 7907554 to 1c0faad Compare October 8, 2022 06:36
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 1c0faad2b35a170e5e6784b42a2113f1acb45d3c

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@dbolduc dbolduc force-pushed the feat-mocks-library branch from 1c0faad to dfdff86 Compare October 8, 2022 07:00
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: dfdff86734fc5473ec2a2f5b13788fc871b7cb27

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

coryan
coryan previously approved these changes Oct 9, 2022
load(":google_cloud_cpp_mocks.bzl", "google_cloud_cpp_mocks_hdrs")

cc_library(
name = "google_cloud_cpp_mocks",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testonly?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@dbolduc dbolduc added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Oct 12, 2022
@dbolduc dbolduc marked this pull request as draft October 17, 2022 15:40
@dbolduc dbolduc force-pushed the feat-mocks-library branch from dfdff86 to b722d1a Compare October 28, 2022 01:58
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: b722d1aee2e4e089864515356c0b73712d696607

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@dbolduc dbolduc removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Oct 28, 2022
@dbolduc dbolduc marked this pull request as ready for review October 28, 2022 02:01
@coryan coryan dismissed their stale review October 28, 2022 02:13

@dbolduc says the reviews are too old.

@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 30a84cca360a2df040aa6bf6dc2e85632442b120

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@@ -214,6 +214,42 @@ install(
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/google_cloud_cpp_common"
COMPONENT google_cloud_cpp_development)

# Create a header-only library for the mocks. We use a CMake `INTERFACE` library
# for these, a regular library would not work on macOS (where the library needs
# at least one .o file). Unfortunately INTERFACE libraries are a bit weird in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this comment is now out of date?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment, it is a header only library.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, but you are not using the absolute paths anymore?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, thanks. I did not read the comment closely.


create_bazel_config(google_cloud_cpp_mocks YEAR "2022")

google_cloud_cpp_install_headers("google_cloud_cpp_mocks"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no .pc file, but there is no -config.cmake file either. Is that intentional?

Copy link
Contributor

@coryan coryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you planning to add a test to cmake-install for this library?

@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 111bea4635cdeb7693bf01f25ac482c3982c8524

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@dbolduc
Copy link
Member Author

dbolduc commented Oct 28, 2022

There is no .pc file, but there is no -config.cmake file either. Is that intentional?

Are you planning to add a test to cmake-install for this library?

I decided to just do the pkgconfig stuff in this PR. (and test it in an environment where find_dependency(GTest) finds gmock_main.)

@dbolduc dbolduc enabled auto-merge (squash) October 28, 2022 14:53
@dbolduc dbolduc merged commit 985768e into googleapis:main Oct 28, 2022
@dbolduc dbolduc deleted the feat-mocks-library branch October 28, 2022 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add public library to hold common mocks and test helpers
4 participants