Skip to content

Client tests #27

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

Merged
merged 1 commit into from
Jun 13, 2018
Merged

Client tests #27

merged 1 commit into from
Jun 13, 2018

Conversation

pwittrock
Copy link
Contributor

No description provided.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 12, 2018
@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jun 12, 2018
Copy link
Contributor

@seans3 seans3 left a comment

Choose a reason for hiding this comment

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

Kinda ugly to pass the mapping around and also store it in an additional map. Maybe we can clean this up later.

if err != nil {
return err
}
if isNamespaced(mapping) {
return client.Put().
Namespace(meta.GetNamespace()).
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 a version of this method called "NamespaceIfScoped" which would simplify this "if" block.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

if err != nil {
return err
}
if isNamespaced(mapping) {
return client.Delete().
Namespace(meta.GetNamespace()).
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment about "NamespaceIfScoped"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

if err != nil {
return err
}
if isNamespaced(mapping) {
return client.Get().
Namespace(key.Namespace).
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment about "NamspaceIfScoped".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

ns = opts.Namespace
if isNamespaced(mapping) && opts != nil && len(opts.Namespace) > 0 {
return client.Get().
Namespace(opts.Namespace).
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment about "NamespaceIfScoped"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

// ReadInterface knows how to read and list Kubernetes objects.
type ReadInterface interface {
// Reader knows how to read and list Kubernetes objects.
type Reader interface {
Copy link
Contributor

Choose a reason for hiding this comment

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

Reader is a better interface name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

// WriteInterface knows how to create, delete, and update Kubernetes objects.
type WriteInterface interface {
// Writer knows how to create, delete, and update Kubernetes objects.
type Writer interface {
Copy link
Contributor

Choose a reason for hiding this comment

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

Writer is a better interface name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@pwittrock pwittrock force-pushed the client branch 2 times, most recently from 34cf975 to a9d2f7b Compare June 12, 2018 23:43
@pwittrock
Copy link
Contributor Author

PTAL

Copy link
Contributor

@seans3 seans3 left a comment

Choose a reason for hiding this comment

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

Feels like better, simpler abstractions.

return nil, nil, "", err
}
return meta, client, resource, err
// client is a client.Client that reads and writes directly from/to an API server. It lazily initialized
Copy link
Contributor

Choose a reason for hiding this comment

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

Small grammar nit: It lazily "initializes" ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@seans3
Copy link
Contributor

seans3 commented Jun 13, 2018

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 13, 2018
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 13, 2018
@pwittrock
Copy link
Contributor Author

Addressed the comments. PTAL.

@seans3
Copy link
Contributor

seans3 commented Jun 13, 2018

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 13, 2018
@k8s-ci-robot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 13, 2018
@pwittrock pwittrock added approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Jun 13, 2018
@k8s-ci-robot k8s-ci-robot merged commit 8cdff9c into kubernetes-sigs:master Jun 13, 2018
justinsb pushed a commit to justinsb/controller-runtime that referenced this pull request Dec 7, 2018
stevekuznetsov pushed a commit to stevekuznetsov/controller-runtime that referenced this pull request Oct 10, 2022
✨ Update to newer kcp apimachinery, logicalcluster packages
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants