-
Notifications
You must be signed in to change notification settings - Fork 64
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
Give better message to user for MissingValueAtPath and OutputPathNotSatisfied #406
Conversation
✔️ Deploy Preview for elated-stonebraker-105904 ready! 🔨 Explore the source changes: 65e2a40 🔍 Inspect the deploy log: https://app.netlify.com/sites/elated-stonebraker-105904/deploys/61a53bf2e6733300087a3ce6 😎 Browse the preview: https://deploy-preview-406--elated-stonebraker-105904.netlify.app |
obj.SetNamespace("my-ns") | ||
|
||
condition := deliverable.MissingValueAtPathCondition(obj, "spec.foo") | ||
Expect(condition.Message).To(Equal("Waiting to read value [spec.foo] from resource [widget.thing.io/my-widget] in namespace [my-ns]")) |
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.
nice!
pkg/realizer/deliverable/errors.go
Outdated
) | ||
|
||
const NO_JSONPATH_CONTEXT = "<no jsonpath context>" |
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.
oh, we usually go with PascalCase rather than UPPER_CASE_WITH_UNDERSCORES for constants
pkg/apis/v1alpha1/cluster_supply_chain.go
29:const (
30- SupplyChainReady = "Ready"
31- SupplyChainTemplatesReady = "TemplatesReady"
--
34:const (
35- ReadyTemplatesReadyReason = "Ready"
36- NotFoundTemplatesReadyReason = "TemplatesNotFound"
@@ -332,7 +332,7 @@ var _ = Describe("Realizer", func() { | |||
It("returns RetrieveOutputError", func() { | |||
_, _, err := rlzr.Realize(ctx, runnable, systemRepo, runnableRepo) | |||
Expect(err).To(HaveOccurred()) | |||
Expect(err.Error()).To(ContainSubstring(`unable to retrieve outputs from stamped object for runnable 'my-important-ns/my-runnable': failed to evaluate path [data.hasnot]: evaluate: find results: hasnot is not found`)) | |||
Expect(err.Error()).To(ContainSubstring(`unable to retrieve outputs from stamped object [my-important-ns/my-stamped-resource-] of type [configmap] for runnable [my-important-ns/my-runnable]: failed to evaluate path [data.hasnot]: evaluate: find results: hasnot is not found`)) |
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.
nice!
# Conflicts: # pkg/controller/deliverable/reconciler_test.go # pkg/controller/runnable/reconciler_test.go # pkg/realizer/runnable/errors.go # pkg/realizer/runnable/realizer.go # pkg/realizer/runnable/realizer_test.go
@@ -31,18 +31,19 @@ type Outputs map[string]apiextensionsv1.JSON | |||
type ClusterRunTemplate interface { | |||
GetName() string | |||
GetResourceTemplate() v1alpha1.TemplateSpec | |||
GetOutput(stampedObjects []*unstructured.Unstructured) (Outputs, error) | |||
GetOutput(stampedObjects []*unstructured.Unstructured) (Outputs, *unstructured.Unstructured, error) |
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.
nit: not everyone agrees with this, but, for interfaces, I find useful to name the returns so that it's less ambiguous at a first look (in a codebase with little comments) to understand what's supposed to be returned. do you think that's something we should try/think about at some point? any thoughts on it?
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.
lgtm! just a couple nits
No description provided.