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

Add vtctldclient missing cmds and remove remaining vtctl[client] usage in e2e tests #17442

Open
wants to merge 30 commits into
base: main
Choose a base branch
from

Conversation

mattlord
Copy link
Contributor

@mattlord mattlord commented Dec 27, 2024

Description

This implements client commands in vtctldclient that were never ported during the client migration. These are things that were identified while moving all endtoend tests to use vtctldclient exclusively in #17441. The missing commands being:

  • CopySchemaShard
  • ValidatePermissionsKeyspace
  • ValidatePermissionsShard
  • ValidateSchemaShard
  • WriteTopologyPath

Command examples:

CopySchemaShard

# no output on success
❯ vtctlclient CopySchemaShard commerce/0 customer/0
W0102 09:07:46.299694   36486 log.go:39] Failed to read in config : Config File "vtconfig" Not Found in "[/Users/matt/git/vitess]". This is optional, and can be ignored if you are not using config files. For a detailed explanation, see https://github.com/vitessio/vitess/blob/main/doc/viper/viper.md#config-files.
CopySchemaShard Error: rpc error: code = Unknown desc = GetShard(customer, 0) failed: node doesn't exist: /vitess/global/keyspaces/customer/shards/0/Shard
E0102 09:07:46.308410   36486 main.go:105] remote error: rpc error: code = Unknown desc = GetShard(customer, 0) failed: node doesn't exist: /vitess/global/keyspaces/customer/shards/0/Shard

❯ vtctldclient CopySchemaShard commerce/0 customer/0
E0102 09:02:53.867987   33032 main.go:56] rpc error: code = Unknown desc = GetShard(customer, 0) failed: node doesn't exist: /vitess/global/keyspaces/customer/shards/0/Shard

ValidatePermissionsKeyspace, ValidatePermissionsShard

❯ vtctlclient ValidatePermissionsKeyspace commerce
W0101 13:58:38.218227   32307 log.go:39] Failed to read in config : Config File "vtconfig" Not Found in "[/Users/matt/git/vitess]". This is optional, and can be ignored if you are not using config files. For a detailed explanation, see https://github.com/vitessio/vitess/blob/main/doc/viper/viper.md#config-files.
ValidatePermissionsKeyspace Error: rpc error: code = Unknown desc = permissions diffs: zone1-0000000100 has an extra user localhost:mlord;zone1-0000000100 has an extra user localhost:mlord
E0101 13:58:38.237814   32307 main.go:105] remote error: rpc error: code = Unknown desc = permissions diffs: zone1-0000000100 has an extra user localhost:mlord;zone1-0000000100 has an extra user localhost:mlord

❯ vtctldclient ValidatePermissionsKeyspace commerce
E0101 13:58:55.687067   32429 main.go:56] rpc error: code = Unknown desc = permissions diffs: zone1-0000000100 has an extra user localhost:mlord

❯ vtctlclient ValidatePermissionsShard commerce/0
W0101 13:59:55.640410   32898 log.go:39] Failed to read in config : Config File "vtconfig" Not Found in "[/Users/matt/git/vitess]". This is optional, and can be ignored if you are not using config files. For a detailed explanation, see https://github.com/vitessio/vitess/blob/main/doc/viper/viper.md#config-files.
ValidatePermissionsShard Error: rpc error: code = Unknown desc = permissions diffs: zone1-0000000100 has an extra user localhost:mlord;zone1-0000000100 has an extra user localhost:mlord
E0101 13:59:55.655940   32898 main.go:105] remote error: rpc error: code = Unknown desc = permissions diffs: zone1-0000000100 has an extra user localhost:mlord;zone1-0000000100 has an extra user localhost:mlord

❯ vtctldclient ValidatePermissionsShard commerce/0
E0101 13:59:59.051856   33004 main.go:56] rpc error: code = Unknown desc = permissions diffs: zone1-0000000100 has an extra user localhost:mlord

ValidateSchemaShard

❯ vtctlclient ValidateSchemaShard commerce/0
W0102 09:09:54.960557   37634 log.go:39] Failed to read in config : Config File "vtconfig" Not Found in "[/Users/matt/git/vitess]". This is optional, and can be ignored if you are not using config files. For a detailed explanation, see https://github.com/vitessio/vitess/blob/main/doc/viper/viper.md#config-files.
ValidatePermissionsShard Error: rpc error: code = Unknown desc = permissions diffs: zone1-0000000100 has an extra user localhost:mlord;zone1-0000000100 has an extra user localhost:mlord
E0102 09:09:54.981317   37634 main.go:105] remote error: rpc error: code = Unknown desc = permissions diffs: zone1-0000000100 has an extra user localhost:mlord;zone1-0000000100 has an extra user localhost:mlord

❯ vtctldclient ValidateSchemaShard commerce/0
[
  "zone1-0000000100 has an extra table named mlord",
  "zone1-0000000100 has an extra table named mlord"
]

WriteTopologyPath

❯ vtctlclient TopoCp -- --to_topo /tmp/foo.txt "/tmp"
W0102 09:19:10.219407   42425 log.go:39] Failed to read in config : Config File "vtconfig" Not Found in "[/Users/matt/git/vitess]". This is optional, and can be ignored if you are not using config files. For a detailed explanation, see https://github.com/vitessio/vitess/blob/main/doc/viper/viper.md#config-files.

❯ vtctldclient --server=internal WriteTopologyPath "/tmp" /tmp/foo.txt

With these in place (and after merging in main after #17441 was merged) we then also replace all remaining vtctl[client] usage in the e2e tests with usage of vtctldclient.

Related Issue(s)

Checklist

  • "Backport to:" labels have been added if this change should be back-ported to release branches
  • If this change is to be back-ported to previous releases, a justification is included in the PR description
  • Tests were added or are not required
  • Did the new or modified tests pass consistently locally and on CI?
  • Documentation: Update docs for https://github.com/vitessio/vitess/pull/17442 website#1912

Copy link
Contributor

vitess-bot bot commented Dec 27, 2024

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • Ensure there is a link to an issue (except for internal cleanup and flaky test fixes), new features should have an RFC that documents use cases and test cases.

Tests

  • Bug fixes should have at least one unit or end-to-end test, enhancement and new features should have a sufficient number of tests.

Documentation

  • Apply the release notes (needs details) label if users need to know about this change.
  • New features should be documented.
  • There should be some code comments as to why things are implemented the way they are.
  • There should be a comment at the top of each new or modified test to explain what the test does.

New flags

  • Is this flag really necessary?
  • Flag names must be clear and intuitive, use dashes (-), and have a clear help text.

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow needs to be marked as required, the maintainer team must be notified.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from vitess-operator and arewefastyet, if used there.
  • vtctl command output order should be stable and awk-able.

@vitess-bot vitess-bot bot added NeedsBackportReason If backport labels have been applied to a PR, a justification is required NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsWebsiteDocsUpdate What it says labels Dec 27, 2024
@mattlord mattlord added Type: Internal Cleanup Component: vtctldclient and removed NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Dec 27, 2024
@github-actions github-actions bot added this to the v22.0.0 milestone Dec 27, 2024
Copy link

codecov bot commented Dec 27, 2024

Codecov Report

Attention: Patch coverage is 12.17949% with 274 lines in your changes missing coverage. Please review.

Project coverage is 67.60%. Comparing base (b8b0383) to head (e1832b2).

Files with missing lines Patch % Lines
go/vt/vtctl/grpcvtctldserver/server.go 7.76% 95 Missing ⚠️
go/cmd/vtctldclient/command/schema.go 17.43% 90 Missing ⚠️
go/cmd/vtctldclient/command/permissions.go 8.51% 43 Missing ⚠️
go/cmd/vtctldclient/command/topology.go 14.28% 30 Missing ⚠️
go/vt/vtctl/grpcvtctldclient/client_gen.go 0.00% 10 Missing ⚠️
go/vt/vtctl/localvtctldclient/client_gen.go 0.00% 4 Missing ⚠️
go/cmd/vtctldclient/main.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17442      +/-   ##
==========================================
- Coverage   67.65%   67.60%   -0.06%     
==========================================
  Files        1584     1585       +1     
  Lines      254360   254599     +239     
==========================================
+ Hits       172097   172130      +33     
- Misses      82263    82469     +206     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mattlord mattlord force-pushed the vtctldclient_missing_cmds branch 2 times, most recently from 9824c10 to ec59343 Compare December 27, 2024 12:41
@mattlord mattlord force-pushed the vtctldclient_missing_cmds branch from ec59343 to 851ccac Compare December 27, 2024 22:53
Signed-off-by: Matt Lord <[email protected]>
@mattlord mattlord force-pushed the vtctldclient_missing_cmds branch from 8c5f3e9 to 05c4c1d Compare December 27, 2024 23:47
Signed-off-by: Matt Lord <[email protected]>
@mattlord mattlord removed NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsWebsiteDocsUpdate What it says NeedsIssue A linked issue is missing for this Pull Request labels Dec 28, 2024
@mattlord mattlord force-pushed the vtctldclient_missing_cmds branch 2 times, most recently from 3018fa3 to 4465813 Compare January 1, 2025 21:13
This reverts commit a091042.

Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
@mattlord mattlord added the NeedsWebsiteDocsUpdate What it says label Jan 3, 2025
@mattlord mattlord force-pushed the vtctldclient_missing_cmds branch 3 times, most recently from b2b65c8 to 8f66a9f Compare January 3, 2025 05:48
Signed-off-by: Matt Lord <[email protected]>
mattlord added a commit to vitessio/website that referenced this pull request Jan 3, 2025
@mattlord mattlord removed the NeedsWebsiteDocsUpdate What it says label Jan 3, 2025
Signed-off-by: Matt Lord <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants