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

replace pkg/errors with stdlib errors #484

Merged
merged 1 commit into from
Jan 27, 2022
Merged

Conversation

neel-astro
Copy link
Contributor

Description

Changes:

  • Moved from pkg/errors to stdlib errors package as both are functionally almost the same with later being the only package which would receive new functional updates in future. Changes for this migration were:
    • Replace Wrap method with fmt.Errorf with %w formatting verb
    • As we moved away from pkg/errors, golinter was able to pick up more of err113 linting issues for moving the wrapped static errors from code logic to package level vars

🎟 Issue(s)

Related astronomer/issues#3965

🧪 Functional Testing

List the functional testing steps to confirm this feature or fix.

📸 Screenshots

Add screenshots to illustrate the validity of these changes.

📋 Checklist

  • Rebased from the main (or release if patching) branch (before testing)
  • Ran make test before taking out of draft
  • Added/updated applicable tests
  • Tested against Houston-API and Astronomer (if necessary).
  • Communicated to/tagged owners of respective clients potentially impacted by these changes.
  • Updated any related documentation

@codecov
Copy link

codecov bot commented Jan 21, 2022

Codecov Report

Merging #484 (7db031c) into main (301ea78) will increase coverage by 0.03%.
The diff coverage is 29.41%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #484      +/-   ##
==========================================
+ Coverage   66.27%   66.30%   +0.03%     
==========================================
  Files          42       42              
  Lines        3644     3642       -2     
==========================================
  Hits         2415     2415              
+ Misses       1056     1054       -2     
  Partials      173      173              
Impacted Files Coverage Δ
airflow/container.go 48.35% <0.00%> (ø)
airflow/docker_image.go 11.39% <0.00%> (ø)
airflow/docker_registry.go 0.00% <0.00%> (ø)
airflow_versions/http_client.go 79.31% <0.00%> (ø)
cluster/cluster.go 27.14% <0.00%> (ø)
cmd/completion.go 84.00% <0.00%> (ø)
cmd/deploy.go 27.65% <0.00%> (ø)
cmd/deployment.go 85.22% <0.00%> (ø)
cmd/workspace.go 68.95% <0.00%> (ø)
config/config.go 46.37% <0.00%> (ø)
... and 14 more

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 301ea78...7db031c. Read the comment docs.

@bote795
Copy link
Contributor

bote795 commented Jan 21, 2022

do they both return a string? sorry not super familiar with the libs just want to make sure we are not losing any behavior

@neel-astro
Copy link
Contributor Author

Both of them will return an interface of type error which is simply having one method Error() which would return the string of that error.

The only major functional difference between the two libs are that pkg/errors support error stack trace which isn't present in stdlib errors, but that's something which we anyways don't use it in CLI.

Found a decent blog post illustrating that: https://blog.dharnitski.com/2019/09/09/go-errors-are-not-pkg-errors/

Copy link
Contributor

@andriisoldatenko andriisoldatenko left a comment

Choose a reason for hiding this comment

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

well done!

@neel-astro neel-astro merged commit 0621377 into main Jan 27, 2022
AmFlint pushed a commit that referenced this pull request Feb 1, 2022
AmFlint pushed a commit that referenced this pull request Feb 4, 2022
AmFlint pushed a commit that referenced this pull request Feb 7, 2022
andriisoldatenko pushed a commit that referenced this pull request Feb 10, 2022
…ion for houston methods) (#490)

* create client interface and implementation for houston methods

* update controller packages to use new houston client

* update cmds and main to use new houston client

* change houston variable visiblity

* fix linter, rename methods

* moved away from pkg/errors (#484)

* astro-cli should prompt the user for namespace name input when pre-deployment validation is configured (#487)

* based on pre-deployment validation config, user should be prompted for k8 namespace name to be enter instead of select from available k8 namespaces

* added test cases for NamespaceFreeformEntry (Pre-Deployment validation webhook)

* fixed broken test cases for namespaceFreeformEntry

* fixed broken test cases

* updated ErrKubernetesNamespaceNotSpecified message changes

create client interface and implementation for houston methods

fix linter, rename methods

* fix airflow upgrade

* fix test and add mocks for houston client w/ mockery

* fix houston request errors add proper json tags

* rename methods according to code review

* fix new log_tests, use renamed houston newClient method

* deploy test: add assertions on the houston mock client

* move houston mocks to houston directory

* add tests for houston package

Co-authored-by: Neel Dalsania <92356010+neel-astro@users.noreply.github.com>
Co-authored-by: Aj <ajayy101@gmail.com>
AmFlint pushed a commit that referenced this pull request Feb 10, 2022
andriisoldatenko pushed a commit that referenced this pull request Feb 10, 2022
* create client interface and implementation for houston methods

* change houston variable visiblity

* fix linter, rename methods

* moved away from pkg/errors (#484)

* astro-cli should prompt the user for namespace name input when pre-deployment validation is configured (#487)

* based on pre-deployment validation config, user should be prompted for k8 namespace name to be enter instead of select from available k8 namespaces

* added test cases for NamespaceFreeformEntry (Pre-Deployment validation webhook)

* fixed broken test cases for namespaceFreeformEntry

* fixed broken test cases

* updated ErrKubernetesNamespaceNotSpecified message changes

create client interface and implementation for houston methods

fix linter, rename methods

* fix test and add mocks for houston client w/ mockery

* rename methods according to code review

* move houston mocks to houston directory

* refactor tests to use houston client mock

* rename mocks package to use houston_mocks

Co-authored-by: Neel Dalsania <92356010+neel-astro@users.noreply.github.com>
Co-authored-by: Aj <ajayy101@gmail.com>
@neel-astro neel-astro deleted the migrate-from-pkg-errors branch February 9, 2023 13:50
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.

None yet

3 participants