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

fix getting template by name not returning the associated id #362

Merged
merged 1 commit into from
Nov 13, 2020

Conversation

kqdeng
Copy link
Contributor

@kqdeng kqdeng commented Nov 10, 2020

Description

Fetching a template by name now also returns the associated ID.

Why is this needed

A recent PR #349 added the functionality of fetching a template by name. The returned template is expected to include the ID, name, and template data. However, currently, it would only return the name and the template data. The returned ID is just an empty string.

How Has This Been Tested?

Manually

How are existing users impacted? What migration steps/scripts do we need?

Checklist:

I have:

  • updated the documentation and/or roadmap (if required)
  • added unit or e2e tests
  • provided instructions on how to upgrade

Signed-off-by: Kelly Deng <kelly@packet.com>
@codecov
Copy link

codecov bot commented Nov 10, 2020

Codecov Report

Merging #362 (57b0b1e) into master (0e8e573) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #362   +/-   ##
=======================================
  Coverage   24.74%   24.74%           
=======================================
  Files          14       14           
  Lines        1277     1277           
=======================================
  Hits          316      316           
  Misses        940      940           
  Partials       21       21           
Impacted Files Coverage Δ
grpc-server/template.go 36.53% <100.00%> (ø)
grpc-server/workflow.go 21.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0e8e573...57b0b1e. Read the comment docs.

@mmlb mmlb added the ready-to-merge Signal to Mergify to merge the PR. label Nov 13, 2020
@mmlb mmlb removed the request for review from splaspood November 13, 2020 16:56
}
if fields["name"] == templateName1 {
return "", template1, nil

Choose a reason for hiding this comment

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

These 2 if statements can be combined as one.

@@ -58,8 +58,8 @@ func TestCreateWorkflow(t *testing.T) {
"FailedCreatingWorkflow": {
args: args{
db: mock.DB{
GetTemplateFunc: func(ctx context.Context, fields map[string]string) (string, string, error) {
return "", templateData, nil
GetTemplateFunc: func(ctx context.Context, fields map[string]string) (string, string, string, error) {

Choose a reason for hiding this comment

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

Instead of returning an empty string, maybe we can return a pre-defined name for mock (e.g., MockedTemplate?).

@mergify mergify bot merged commit 5cbbeec into tinkerbell:master Nov 13, 2020
@mmlb mmlb removed the ready-to-merge Signal to Mergify to merge the PR. label Jan 25, 2021
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.

3 participants