Skip to content
This repository was archived by the owner on Jan 8, 2024. It is now read-only.

Better error handling around missing ODR profiles #2756

Closed
wants to merge 3 commits into from

Conversation

izaaklauer
Copy link
Contributor

Catches an extremely corner-case panic.

Without this, if you try to upsert a project with a git ref, data polling disabled, and a runner profile ref that doesn't exist, we panic.

@izaaklauer izaaklauer requested a review from a team November 19, 2021 15:19
@github-actions github-actions bot added the core label Nov 19, 2021
Copy link
Contributor

@catsby catsby left a comment

Choose a reason for hiding this comment

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

👍 suggestion and comment, take or leave them 😄

@@ -166,7 +166,7 @@ func (s *service) queueJobReqToJob(
}
}

// If the job can be run any any runner, then we attempt to see if we should spawn
// If the job can be run by any runner, then we attempt to see if we should spawn
// on on-demand runner for it. We only consider jobs for any runner because ones
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// on on-demand runner for it. We only consider jobs for any runner because ones
// an on-demand runner for it. We only consider jobs for any runner because ones

if od == nil {
return nil, "", status.Error(codes.FailedPrecondition, "Missing required parameter OnDemandRunnerConfig")
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I don't see any other way into this method outside of the above wrapJobWithRunner, which already performs a nil check on the OnDemandRunnerConfig, so this seems redundant.

Copy link
Contributor

Choose a reason for hiding this comment

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

Came to say the same thing :)

Copy link
Contributor

@mitchellh mitchellh left a comment

Choose a reason for hiding this comment

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

We unit test the ODR launching stuff decently well in the singleprocess package. Any chance we can repro this for a regression test?

Copy link
Contributor

@mitchellh mitchellh left a comment

Choose a reason for hiding this comment

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

Looks good, the only thing I'd add here is given where the code was changed, this should be easily unit testable and we may want to do that.

Copy link
Member

@briancain briancain left a comment

Choose a reason for hiding this comment

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

Short and sweet! I agree, we should add a little unit test in service_job_test.go to cover this, otherwise good to go 😃

@krantzinator
Copy link
Contributor

In writing the tests, I wasn't able to recreate the problem exactly as described in this PR, so, since this isn't urgent and holidays mean we won't cross paths for a couple weeks, I'm just going to leave this little test here for @izaaklauer when he gets back. Take it or leave it 😄 I assume I am missing the crux of this edge case. https://github.com/hashicorp/waypoint/compare/odr-profile-not-found...copy-of-odr-profile-not-found?expand=1

@briancain
Copy link
Member

Ahhh, oops. Looks like we didn't get to this one 😢 I accidentally redid it in #3054 and added a lil' test so I'm going to close this since they are the same!

@briancain briancain closed this Mar 2, 2022
@mitchellh mitchellh deleted the odr-profile-not-found branch May 3, 2022 18:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants