-
Notifications
You must be signed in to change notification settings - Fork 6.4k
chore(server): better error message for missing action (#20408) #20409
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
chore(server): better error message for missing action (#20408) #20409
Conversation
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
❌ Preview Environment deleted from BunnyshellAvailable commands (reply to this comment):
|
@@ -24,13 +24,22 @@ import ( | |||
|
|||
const ( | |||
incorrectReturnType = "expect %s output from Lua script, not %s" | |||
incorrectInnerType = "expect %s inner type from Lua script, not %s" |
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.
This field isn't used anymore, just deleted it while I was in here.
@@ -266,7 +266,7 @@ func TestGetHealthScriptNoPredefined(t *testing.T) { | |||
vm := VM{} | |||
script, useOpenLibs, err := vm.GetHealthScript(testObj) | |||
require.NoError(t, err) | |||
assert.True(t, useOpenLibs) | |||
assert.False(t, useOpenLibs) |
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.
Returning false
is fine, this return value won't be used when the returned script is ""
.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #20409 +/- ##
==========================================
+ Coverage 56.02% 56.05% +0.03%
==========================================
Files 322 322
Lines 44802 44810 +8
==========================================
+ Hits 25099 25119 +20
+ Misses 17104 17096 -8
+ Partials 2599 2595 -4 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
var doesNotExist *ScriptDoesNotExistError | ||
if errors.As(err, &doesNotExist) { | ||
// It's okay if no built-in health script exists. Just return an empty string and let the caller handle it. | ||
return "", false, nil |
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.
return "", false, nil | |
return "", false, nil |
why are we returning error as nil here?
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.
Per the comment "It's okay if no built-in health script exists. Just return an empty string and let the caller handle it."
Absence of a health check isn't a problem in the context of this function. We just skip health checks for that resource.
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.
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.
LGTM!!
… (argoproj#20409) * chore(server): better error message for missing action Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * Update util/lua/lua_test.go Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --------- Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
… (argoproj#20409) * chore(server): better error message for missing action Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * Update util/lua/lua_test.go Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --------- Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Adrian Aneci <aneci@adobe.com>
Fixes #20408
The output is much nicer: