-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Client tests #27
Conversation
There was a problem hiding this 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.
pkg/client/client.go
Outdated
if err != nil { | ||
return err | ||
} | ||
if isNamespaced(mapping) { | ||
return client.Put(). | ||
Namespace(meta.GetNamespace()). |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
pkg/client/client.go
Outdated
if err != nil { | ||
return err | ||
} | ||
if isNamespaced(mapping) { | ||
return client.Delete(). | ||
Namespace(meta.GetNamespace()). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment about "NamespaceIfScoped"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
pkg/client/client.go
Outdated
if err != nil { | ||
return err | ||
} | ||
if isNamespaced(mapping) { | ||
return client.Get(). | ||
Namespace(key.Namespace). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment about "NamspaceIfScoped".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
pkg/client/client.go
Outdated
ns = opts.Namespace | ||
if isNamespaced(mapping) && opts != nil && len(opts.Namespace) > 0 { | ||
return client.Get(). | ||
Namespace(opts.Namespace). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment about "NamespaceIfScoped"
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
34cf975
to
a9d2f7b
Compare
PTAL |
There was a problem hiding this 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.
pkg/client/client.go
Outdated
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 |
There was a problem hiding this comment.
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" ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
/lgtm |
Addressed the comments. PTAL. |
/lgtm |
New changes are detected. LGTM label has been removed. |
Client tests
✨ Update to newer kcp apimachinery, logicalcluster packages
No description provided.