Skip to content
This repository has been archived by the owner on Dec 8, 2021. It is now read-only.

testing: improvements for Backup related tests #1438

Merged
merged 7 commits into from
Mar 20, 2020

Conversation

tmatsuo
Copy link
Contributor

@tmatsuo tmatsuo commented Mar 19, 2020

  • enable backup related test for the coverage build
  • use shorter timeout for admin clients for backup tests
  • correctly cleanup stale instances by deleting backups first

Fixes #1432 and fixes #1429

We may still want to disable backup related tests for the coverage build. If so, we can run the backup related tests in nightly build.


This change is Reviewable

@tmatsuo tmatsuo requested a review from coryan March 19, 2020 21:12
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Mar 19, 2020
@tmatsuo
Copy link
Contributor Author

tmatsuo commented Mar 19, 2020

Once all the test pass, maybe I'll trigger 5 coverage builds almost simultaneously.

Copy link
Member

@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.

I think we should separate those feature improvements to other PRs, what do you think?

Reviewed 2 of 5 files at r1, 14 of 14 files at r2.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @tmatsuo)


google/cloud/spanner/database_admin_connection.h, line 337 at r2 (raw file):

 *     running checked for completion
 */
std::shared_ptr<DatabaseAdminConnection> MakeDatabaseAdminConnection(

This also fixes #1211 which ideally should go in a separate PR.


google/cloud/spanner/instance_admin_connection.h, line 227 at r2 (raw file):

 *     running checked for completion
 */
std::shared_ptr<InstanceAdminConnection> MakeInstanceAdminConnection(

This also fixes #1212, which ideally should happen in a separate PR, please split.


google/cloud/spanner/integration_tests/backup_integration_test.cc, line 83 at r2 (raw file):

    auto s = spanner_testing::CleanupStaleInstances(project_id_,
                                                    instance_name_regex_);
    EXPECT_STATUS_OK(s) << s.message();

This will actually fail the test when the cleanup fails, maybe just log? I am not sure.


google/cloud/spanner/integration_tests/instance_admin_integration_test.cc, line 80 at r2 (raw file):

      return;
    }
    auto s = spanner_testing::CleanupStaleInstances(project_id_,

Thanks for the refactoring btw, much cleaner.


google/cloud/spanner/testing/cleanup_stale_instances.cc, line 34 at r2 (raw file):

      spanner::MakeInstanceAdminConnection());
  std::vector<std::string> instance_ids =
      [&instance_admin_client, &project_id,

At this point I would just write [&]().


google/cloud/spanner/testing/compiler_supports_regexp.h, line 24 at r2 (raw file):

namespace spanner_testing {
inline namespace SPANNER_CLIENT_NS {
inline bool CompilerSupportsRegexp() {

Thank you for refactoring this.

@codecov
Copy link

codecov bot commented Mar 19, 2020

Codecov Report

Merging #1438 into master will increase coverage by 1.69%.
The diff coverage is 88.57%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1438      +/-   ##
==========================================
+ Coverage   93.63%   95.32%   +1.69%     
==========================================
  Files         186      189       +3     
  Lines       15719    15696      -23     
==========================================
+ Hits        14718    14962     +244     
+ Misses       1001      734     -267
Impacted Files Coverage Δ
google/cloud/spanner/testing/policies.h 100% <100%> (ø)
google/cloud/spanner/samples/samples.cc 89.59% <100%> (+7.06%) ⬆️
...e/cloud/spanner/testing/compiler_supports_regexp.h 100% <100%> (ø)
...tegration_tests/instance_admin_integration_test.cc 95.83% <75%> (+9.78%) ⬆️
...e/cloud/spanner/testing/cleanup_stale_instances.cc 76.92% <76.92%> (ø)
...anner/integration_tests/backup_integration_test.cc 89.24% <93.33%> (+72.84%) ⬆️
google/cloud/spanner/internal/log_wrapper.h 71.42% <0%> (-13.19%) ⬇️
google/cloud/spanner/results.h 95.83% <0%> (-4.17%) ⬇️
google/cloud/spanner/internal/polling_loop.h 83.33% <0%> (-2.39%) ⬇️
...ud/spanner/integration_tests/client_stress_test.cc 80.55% <0%> (-1.86%) ⬇️
... and 22 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f819910...9798640. Read the comment docs.

@tmatsuo
Copy link
Contributor Author

tmatsuo commented Mar 19, 2020

The coverage build took 35:43, better than before :)

@coryan Thanks for the review, I'll split the PR, but before doing so, let me run 5 simultaneous coverage builds as an endurance test.

@tmatsuo
Copy link
Contributor Author

tmatsuo commented Mar 19, 2020

I started 5 coverage-presubmit builds

@tmatsuo
Copy link
Contributor Author

tmatsuo commented Mar 19, 2020

All the 5 coverage-presubmit builds passed with the latency of 33:21, 35:14, 35:49, 34:52, and 36:11.

Much better :)

Copy link
Contributor Author

@tmatsuo tmatsuo left a comment

Choose a reason for hiding this comment

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

Rebased to master, with some cleanups. PTAL

Reviewable status: 0 of 12 files reviewed, 6 unresolved discussions (waiting on @coryan)


google/cloud/spanner/database_admin_connection.h, line 337 at r2 (raw file):

Previously, coryan (Carlos O'Ryan) wrote…

This also fixes #1211 which ideally should go in a separate PR.

Done.


google/cloud/spanner/instance_admin_connection.h, line 227 at r2 (raw file):

Previously, coryan (Carlos O'Ryan) wrote…

This also fixes #1212, which ideally should happen in a separate PR, please split.

Done.


google/cloud/spanner/integration_tests/backup_integration_test.cc, line 83 at r2 (raw file):

Previously, coryan (Carlos O'Ryan) wrote…

This will actually fail the test when the cleanup fails, maybe just log? I am not sure.

If we only log, we won't notice too many leaks (likely because the cleanup code not working) until a test failure due to too many instances. I'd catch it sooner than later. Thoughts?


google/cloud/spanner/integration_tests/instance_admin_integration_test.cc, line 80 at r2 (raw file):

Previously, coryan (Carlos O'Ryan) wrote…

Thanks for the refactoring btw, much cleaner.

Ack


google/cloud/spanner/testing/cleanup_stale_instances.cc, line 34 at r2 (raw file):

Previously, coryan (Carlos O'Ryan) wrote…

At this point I would just write [&]().

Done.


google/cloud/spanner/testing/compiler_supports_regexp.h, line 24 at r2 (raw file):

Previously, coryan (Carlos O'Ryan) wrote…

Thank you for refactoring this.

Ack

@tmatsuo
Copy link
Contributor Author

tmatsuo commented Mar 20, 2020

FYI, it successfully deleted an instance temporary-instance-2020-03-18-hogehoge with a backup in my project :)

Copy link
Member

@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.

:lgtm:

Reviewed 12 of 12 files at r4.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved


google/cloud/spanner/integration_tests/backup_integration_test.cc, line 83 at r2 (raw file):

Previously, tmatsuo (Takashi Matsuo) wrote…

If we only log, we won't notice too many leaks (likely because the cleanup code not working) until a test failure due to too many instances. I'd catch it sooner than later. Thoughts?

SGTM.

@coryan coryan changed the title testing: improvements for Bakup related tests testing: improvements for Backup related tests Mar 20, 2020
@coryan
Copy link
Member

coryan commented Mar 20, 2020

Pro tip: to fix more than one bug you cannot just say Fixes #NNN #MMM you need to say Fixes #NNN and fixes #MMM.

@tmatsuo tmatsuo merged commit 7986424 into googleapis:master Mar 20, 2020
@tmatsuo tmatsuo deleted the enable-backup-test branch March 20, 2020 17:46
devjgm pushed a commit to devjgm/google-cloud-cpp that referenced this pull request May 7, 2020
…ud-cpp-spanner#1438)

* test: shorten polling policies in backup integration tests

The integration test for backups can take very long. We prefer to fail
the test.

* factor out some logic from backup_integration_test

also use shorter timeout for the samples

* remove the longer timeout for some tests

* factor out the code for cleaning up stale instances

also delete any backups within the instance

* Enable backup related tests for the coverage build

* use spanner::ExponentialBackoffPolicy

Co-authored-by: Carlos O'Ryan <coryan@google.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
3 participants