Skip to content

fix: Updated the domain field update function to decrypt and check the certificate expire#1075

Open
choonkeat1986 wants to merge 1 commit into
mainfrom
domainCert_fix
Open

fix: Updated the domain field update function to decrypt and check the certificate expire#1075
choonkeat1986 wants to merge 1 commit into
mainfrom
domainCert_fix

Conversation

@choonkeat1986

@choonkeat1986 choonkeat1986 commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

PR Checklist
[x ] Unit Tests have been added for new changes
API tests have been updated if applicable
[x ] All commented code has been removed
If you've added a dependency, you've ensured license is compatible with Apache 2.0 and clearly outlined the added dependency.
What are you changing?
Fixing the issue on the domain certificate expire date after edit the existing domain profile and reupload the certificate.
#1019

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the domains Update use case to preserve existing certificate metadata while allowing certificate replacement with expiration validation, and adjusts unit tests to reflect the additional pre-fetch behavior.

Changes:

  • Fetch the existing domain (with certificate data) before updating, and reuse existing cert fields unless a new cert is provided.
  • When a new provisioning cert is provided, validate its expiration and (when available) update the cert in the configured cert store.
  • Update TestUpdate mocks to account for the new initial GetByName call.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
internal/usecase/domains/usecase.go Adds pre-fetch + certificate expiration validation and cert-store handling in Update.
internal/usecase/domains/usecase_test.go Updates TestUpdate expectations for the added GetByName call.

Comment thread internal/usecase/domains/usecase.go
Comment thread internal/usecase/domains/usecase.go
Comment thread internal/usecase/domains/usecase_test.go Outdated
@codecov

codecov Bot commented Jun 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.78378% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 43.65%. Comparing base (fe3c5f0) to head (9b6f7d2).

Files with missing lines Patch % Lines
internal/usecase/domains/usecase.go 83.78% 3 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1075      +/-   ##
==========================================
+ Coverage   43.39%   43.65%   +0.25%     
==========================================
  Files         141      141              
  Lines       13397    13434      +37     
==========================================
+ Hits         5814     5864      +50     
+ Misses       7022     7004      -18     
- Partials      561      566       +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants