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 (kubernetes-client-api) : Remove opinionated messages from Config's errorMessages and deprecate it (#5166) #5199

Merged
merged 1 commit into from
Jun 19, 2023

Conversation

rohanKanojia
Copy link
Member

Description

Fix #5166

  • Remove opinionated status code to message mappings from Config
  • Deprecate Config.errorMessages field in favor of kubernetes status
  • Update OperationSupport to only rely on Kubernetes status for error messages

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change
  • Chore (non-breaking change which doesn't affect codebase;
    test, version modification, documentation, etc.)

Checklist

  • Code contributed by me aligns with current project license: Apache 2.0
  • I Added CHANGELOG entry regarding this change
  • I have implemented unit tests to cover my changes
  • I have added/updated the javadocs and other documentation accordingly
  • No new bugs, code smells, etc. in SonarCloud report
  • I tested my code in Kubernetes
  • I tested my code in OpenShift

@rohanKanojia rohanKanojia marked this pull request as ready for review June 2, 2023 08:28
Copy link
Contributor

@shawkins shawkins left a comment

Choose a reason for hiding this comment

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

If the logic to update the error message is removed, then let's just remove the errorMessages from the Config rather than deprecating them - if you use a ConfigBuilder (and don't read the changelog) you won't know that it's a deprecated field.

I hope to get around to sundrio/sundrio#383 that could help us have deprecated builder methods eventually.

…'s `errorMessages` and deprecate it (fabric8io#5166)

+ Remove opinionated status code to message mappings from Config
+ Deprecate Config.errorMessages field in favor of kubernetes status
+ Update OperationSupport to only rely on Kubernetes status for error
  messages

Signed-off-by: Rohan Kumar <[email protected]>
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell E 4 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

assertThatExceptionOfType(KubernetesClientException.class)
.isThrownBy(eventResource::delete)
.withMessageContaining(customMessage)
.hasFieldOrPropertyWithValue("code", HTTP_FORBIDDEN);
Copy link
Member

Choose a reason for hiding this comment

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

I'm going to approve and merge this anyway, but please (once more) note:

Don't use constants in the test assertions, especially if those constants are also used when defining the test expectations. This is an external constant and there's no problem, but if we had defined this constant internally wrongly with a 503 instead, the test would be passing and not revealing a problem

@manusa manusa added this to the 6.8.0 milestone Jun 19, 2023
@manusa manusa merged commit 55f153f into fabric8io:master Jun 19, 2023
@rohanKanojia rohanKanojia deleted the pr/issue5166 branch June 19, 2023 06:00
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this pull request Jun 25, 2024
This field was deprecated in fabric8io#5199 , we should remove this in v7

Signed-off-by: Rohan Kumar <[email protected]>
manusa pushed a commit that referenced this pull request Jun 25, 2024
This field was deprecated in #5199 , we should remove this in v7

Signed-off-by: Rohan Kumar <[email protected]>
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.

useless and misleading message in Config.fromKubeconfig
3 participants