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

🌱 TMC E2E tests sharding support - step 1 #2908

Merged

Conversation

davidfestal
Copy link
Member

@davidfestal davidfestal commented Mar 20, 2023

Summary

First step towars sharding support for TMC e2e tests

This PR is a prefactored PR coming from PR #2675

Related issue(s)

kcp-dev/contrib-tmc#45

var syncTargetClusterName logicalcluster.Name
Eventually(t, func() (success bool, reason string) {
syncTarget, err := kcpClusterClient.Cluster(syncerConfig.SyncTargetPath).WorkloadV1alpha1().SyncTargets().Get(ctx, syncerConfig.SyncTargetName, metav1.GetOptions{})
require.NoError(t, err)
if len(syncTarget.Status.VirtualWorkspaces) != 1 {
return false, ""
if len(syncTarget.Status.VirtualWorkspaces) != len(sf.upstreamServer.ShardNames()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

IMHO it is not sufficient for downstream users to compare the lengths of these two slices to determine if the sync target is "ready" - the consumer should stream the set of virtual workspace URLs and handle them as they pop into and out of existence.

Copy link
Contributor

Choose a reason for hiding this comment

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

Note that:

  • set equality is really what we want, not length
  • making partial progress when one URL is missing / slow to be posted is desired

Copy link
Member Author

Choose a reason for hiding this comment

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

downstream users

what do you mean here ?

compare the lengths of these two slices to determine if the sync target is "ready"

Having the VW URLs set is not what makes the SyncTarget in general. In the Syncer, we watch these URLs and react to any change (when a new shard is added).
But in the context of e2e tests, when the number of shards is a characteristic of the test case (how the shared server is being deployed by the related fixture), we wait until the SyncTarget has the expected number of virtual workspaces).

set equality is really what we want, not length

equality with what ? chacking the context of the SyncTarget VW URLs, to ensure they match (though not being equal with) the VW URLS of the shards, would be the purpose of a dedicated test. I don't think it makes sense.

making partial progress when one URL is missing / slow to be posted is desired

I don't really understand the point here, in the e2e fixture.

Copy link
Contributor

Choose a reason for hiding this comment

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

We should never write code that's end-to-end test specific. All that does is remove useful learning from real use-cases.

equality with what ?

Shards A, B, C -> virtual workspace URLs for those shards. Using the current logic we race: shards A B D, URLs A, B, C still is called "ready"

I don't really understand the point here, in the e2e fixture.

A static list of URLs is the wrong abstraction with which we should expose the URLs associated with this virtual view. If/when we start having dynamic shard lifecycle in the tests, this will lead to flakes.

Copy link
Member Author

Choose a reason for hiding this comment

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

According to what we discussed, I changed the static URL lists in the SyncTarget fixture to be functions.
This we can easily follow the same pattern as what is done for APIExport and not depend anymore on the number of shards.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in the rebased commit: 9403375

Signed-off-by: David Festal <dfestal@redhat.com>
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 29, 2023
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 29, 2023
@sttts
Copy link
Member

sttts commented Mar 29, 2023

/approve

@stevekuznetsov had comments. Leaving lgtm to him.

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 29, 2023
Signed-off-by: David Festal <dfestal@redhat.com>
Signed-off-by: David Festal <dfestal@redhat.com>
Signed-off-by: David Festal <dfestal@redhat.com>
Copy link
Contributor

@stevekuznetsov stevekuznetsov left a comment

Choose a reason for hiding this comment

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

Looks good!

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 29, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 29, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: stevekuznetsov, sttts

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [stevekuznetsov,sttts]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit ebf24bb into kcp-dev:main Mar 29, 2023
7 checks passed
@kcp-ci-bot kcp-ci-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants