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

add test for internal/errors/runtime #984

Merged
merged 8 commits into from
Feb 8, 2021

Conversation

vankichi
Copy link
Contributor

@vankichi vankichi commented Feb 4, 2021

Signed-off-by: vankichi [email protected]

Description:

I added the test for internal/errors/runtime.go and add comment for each function.

Related Issue:

How Has This Been Tested?:

Environment:

  • Go Version: 1.15.7
  • Docker Version: 19.03.8
  • Kubernetes Version: 1.18.2
  • NGT Version: 1.13.1

Types of changes:

  • Bug fix [type/bug]
  • New feature [type/feature]
  • Add tests [type/test]
  • Security related changes [type/security]
  • Add documents [type/documentation]
  • Refactoring [type/refactoring]
  • Update dependencies [type/dependency]
  • Update benchmarks and performances [type/bench]
  • Update CI [type/ci]

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Checklist:

  • I have read the CONTRIBUTING document.
  • I have checked open Pull Requests for the similar feature or fixes?
  • I have added tests and benchmarks to cover my changes.
  • I have ensured all new and existing tests passed.
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly.

@vankichi
Copy link
Contributor Author

vankichi commented Feb 4, 2021

/format

@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Feb 4, 2021

[CHATOPS:HELP] ChatOps commands.

  • 🙆‍♀️ /approve - approve
  • 💌 /changelog - add changelog comment
  • 🍱 /format - format codes and add licenses
  • /gen-test - generate test codes
  • 🏷️ /label - add labels
  • /rebase - rebase master
  • 🔚 2️⃣ 🔚 /label actions/e2e-deploy - run E2E deploy & integration test

@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Feb 4, 2021

[FORMAT] Updating license headers and formatting go codes triggered by vankichi.

@vankichi vankichi self-assigned this Feb 4, 2021
internal/errors/runtime_test.go Outdated Show resolved Hide resolved
}
}(),
func() test {
tString := "10h"
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
string 10h has 3 occurrences, make it a constant (goconst)

internal/errors/runtime_test.go Outdated Show resolved Hide resolved
}
}(),
}
for _, tc := range tests {
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)

}
}(),
}
for _, tc := range tests {
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)

@codecov
Copy link

codecov bot commented Feb 4, 2021

Codecov Report

Merging #984 (722a6ea) into master (81c93d3) will increase coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #984      +/-   ##
==========================================
+ Coverage   14.43%   14.45%   +0.02%     
==========================================
  Files         492      492              
  Lines       27906    27906              
==========================================
+ Hits         4028     4035       +7     
+ Misses      23640    23633       -7     
  Partials      238      238              
Impacted Files Coverage Δ
internal/errors/runtime.go 100.00% <ø> (+100.00%) ⬆️
internal/worker/worker.go 82.29% <0.00%> (-1.05%) ⬇️
internal/worker/queue.go 98.33% <0.00%> (+3.33%) ⬆️

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 81c93d3...5927318. Read the comment docs.

internal/errors/runtime.go Outdated Show resolved Hide resolved
internal/errors/runtime.go Outdated Show resolved Hide resolved
internal/errors/runtime.go Outdated Show resolved Hide resolved
rec: r,
},
want: want{
want: Wrap(defaultErr, Errorf("panic recovered: %v", r).Error()),
Copy link
Contributor

@hlts2 hlts2 Feb 8, 2021

Choose a reason for hiding this comment

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

Should we use New function insted of Wrap function. 🤔
because this want is equal to the test target function like this. 🤔

return Wrap(err, Errorf("panic recovered: %v", rec).Error())

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if we'd like to test the Wrap function, I agree with you.
IMO, about this case, it is not needed.
How do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I got it 👍 I agree with you!

}
defaultErr := New("runtime panic string error")
defaultRuntimeErr := &runtimeErr{
err: New("runtime error is occured"),
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
occured is a misspelling of occurred (misspell)

hlts2
hlts2 previously approved these changes Feb 8, 2021
internal/errors/runtime_test.go Outdated Show resolved Hide resolved
internal/errors/runtime_test.go Show resolved Hide resolved
internal/errors/runtime_test.go Show resolved Hide resolved
internal/errors/runtime_test.go Outdated Show resolved Hide resolved
kevindiu
kevindiu previously approved these changes Feb 8, 2021
Copy link
Contributor

@kevindiu kevindiu left a comment

Choose a reason for hiding this comment

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

LGTM

@kevindiu
Copy link
Contributor

kevindiu commented Feb 8, 2021

/rebase
/format
/approve

@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Feb 8, 2021

[REBASE] Rebase triggered by kevindiu for branch: test/internal/add-newtest-for-errors-runtime

@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Feb 8, 2021

[FORMAT] Updating license headers and formatting go codes triggered by kevindiu.

vdaas-ci
vdaas-ci previously approved these changes Feb 8, 2021
Copy link
Collaborator

@vdaas-ci vdaas-ci left a comment

Choose a reason for hiding this comment

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

[APPROVED] This PR is approved by kevindiu.

@kevindiu
Copy link
Contributor

kevindiu commented Feb 8, 2021

/rebase
/format
/approve

@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Feb 8, 2021

[REBASE] Rebase triggered by kevindiu for branch: test/internal/add-newtest-for-errors-runtime

@vdaas-ci vdaas-ci force-pushed the test/internal/add-newtest-for-errors-runtime branch from 49bbfaa to 5927318 Compare February 8, 2021 09:51
@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Feb 8, 2021

[FORMAT] Updating license headers and formatting go codes triggered by kevindiu.

Copy link
Collaborator

@vdaas-ci vdaas-ci left a comment

Choose a reason for hiding this comment

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

[APPROVED] This PR is approved by kevindiu.

@kevindiu kevindiu merged commit 2eb8668 into master Feb 8, 2021
@kevindiu kevindiu deleted the test/internal/add-newtest-for-errors-runtime branch February 8, 2021 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants