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 e2e testing of server-side apply for openshift types #25652

Merged
merged 6 commits into from Nov 18, 2020

Conversation

marun
Copy link
Contributor

@marun marun commented Oct 31, 2020

TODO

  • Fix conversion errors for oauth.openshift.io/v1 and user.openshift.io/v1 groups
    • These groups are served by oauth-apiserver

/cc @sttts @stlaz @p0lyn0mial

@marun marun force-pushed the test-server-side-apply branch 2 times, most recently from c2f200a to bfee082 Compare October 31, 2020 07:12
}
kubeClient, err := kubernetes.NewForConfig(oc.AdminConfig())
o.Expect(err).NotTo(o.HaveOccurred())
mapper = restmapper.NewDeferredDiscoveryRESTMapper(discocache.NewMemCacheClient(kubeClient.Discovery()))
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: why a new one for each subtest?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note the conditional check above. It's initialized once per worker, not once per subtest. My ginkgo-foo is weak, if there's a better way to accomplish this I'm all ears!

// Ensure that any stub embedding the etcd test namespace
// is updated to use local test namespace instead.
if len(testNamespace) > 0 {
stub = strings.Replace(stub, exetcd.TestNamespace, testNamespace, -1)
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a need to use the etcd storage test namespace? Would rather use a unique namespace here to avoid conflicts, and to reduce shared logic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am using a unique namespace - that's testNamespace. It only needs to be used when the resource itself is namespaced since many of the types are cluster-scoped. This minimizes the need to provision new namespaces since that is not cheap.

@sttts
Copy link
Contributor

sttts commented Nov 2, 2020

Overall it looks good!

types.ApplyPatchType,
serializedObj,
metav1.PatchOptions{
FieldManager: "apply_test",
Copy link
Contributor

Choose a reason for hiding this comment

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

is this what it takes to do server-side apply?

Copy link
Contributor

Choose a reason for hiding this comment

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

the patch type especially.

Copy link
Contributor

Choose a reason for hiding this comment

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

oh, okay, it points to the client that made the update.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This just points to who made an update, and it can be supplied with CREATE, UPDATE or PATCH. The key to performing server-side apply is types.ApplyPatchType.

o.Expect(err).NotTo(o.HaveOccurred())

g.By(fmt.Sprintf("updating the %s via apply", unstructuredObj.GetKind()))
obj, err := resourceClient.Patch(
Copy link
Contributor

Choose a reason for hiding this comment

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

we don't have to actually change the object to test the server-side apply logic?
is setting a FieldManager a good indicator?

Copy link
Contributor

Choose a reason for hiding this comment

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

A good first step. It won't tell us that our schema is correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The server-side logic has reasonable integration tests in upstream. The goal of this test is validating that openshift types are compatible with server-side apply vs validating server-side apply itself.

@marun
Copy link
Contributor Author

marun commented Nov 5, 2020

/retest

1 similar comment
@marun
Copy link
Contributor Author

marun commented Nov 6, 2020

/retest

@marun marun changed the title WIP Add e2e testing of server-side apply for openshift types Add e2e testing of server-side apply for openshift types Nov 10, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 10, 2020
@marun
Copy link
Contributor Author

marun commented Nov 10, 2020

@marun
Copy link
Contributor Author

marun commented Nov 10, 2020

/retest

2 similar comments
@marun
Copy link
Contributor Author

marun commented Nov 10, 2020

/retest

@marun
Copy link
Contributor Author

marun commented Nov 10, 2020

/retest

@p0lyn0mial
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 16, 2020
@sttts
Copy link
Contributor

sttts commented Nov 16, 2020

/approve

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: marun, p0lyn0mial, 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:

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

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 16, 2020
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

6 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit b03d30e into openshift:master Nov 18, 2020
@marun
Copy link
Contributor Author

marun commented Nov 18, 2020

/cherry-pick release-4.6

@openshift-cherrypick-robot

@marun: #25652 failed to apply on top of branch "release-4.6":

Applying: Update api references for etcd storage path data
Applying: Export etcd storage data configuration for reuse by apply testing
Applying: Ensure an etcd storage path stub that can pass validation for apply
Applying: Ensure CLI.SetupProject returns the name of the project it creates
Using index info to reconstruct a base tree...
M	test/extended/util/client.go
Falling back to patching base and 3-way merge...
Auto-merging test/extended/util/client.go
Applying: Add e2e testing of server-side apply for openshift types
Applying: Update test annotations
Using index info to reconstruct a base tree...
M	test/extended/util/annotate/generated/zz_generated.annotations.go
Falling back to patching base and 3-way merge...
Auto-merging test/extended/util/annotate/generated/zz_generated.annotations.go
CONFLICT (content): Merge conflict in test/extended/util/annotate/generated/zz_generated.annotations.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0006 Update test annotations
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-4.6

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants