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

Give better message to user for MissingValueAtPath and OutputPathNotSatisfied #406

Merged
merged 3 commits into from
Nov 29, 2021

Conversation

emmjohnson
Copy link
Contributor

No description provided.

@netlify
Copy link

netlify bot commented Nov 29, 2021

✔️ 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]"))
Copy link
Contributor

Choose a reason for hiding this comment

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

nice!

)

const NO_JSONPATH_CONTEXT = "<no jsonpath context>"
Copy link
Contributor

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`))
Copy link
Contributor

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)
Copy link
Contributor

@cirocosta cirocosta Nov 29, 2021

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?

Copy link
Contributor

@cirocosta cirocosta left a 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

@emmjohnson emmjohnson merged commit 9288632 into main Nov 29, 2021
@emmjohnson emmjohnson deleted the 378-deliverable-runnable branch November 29, 2021 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants