Skip to content

Conversation

@Akshay2191
Copy link
Contributor

Extends the ConfigApply capability to manage NGINX configurations that reference external resources hosted at remote URLs. The agent now handles downloading of these files into the NGINX configuration directory before applying the new configuration.

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING document
  • I have run make install-tools and have attached any dependency changes to this pull request
  • If applicable, I have added tests that prove my fix is effective or that my feature works
  • If applicable, I have checked that any relevant tests pass after adding my changes
  • If applicable, I have updated any relevant documentation (README.md)
  • If applicable, I have tested my cross-platform changes on Ubuntu 22, Redhat 8, SUSE 15 and FreeBSD 13

@Akshay2191 Akshay2191 requested a review from a team as a code owner November 12, 2025 15:50
@github-actions github-actions bot added the chore Pull requests for routine tasks label Nov 12, 2025
@codecov
Copy link

codecov bot commented Nov 12, 2025

Codecov Report

❌ Patch coverage is 87.90698% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.37%. Comparing base (fab01ec) to head (2e981e0).

Files with missing lines Patch % Lines
internal/file/file_manager_service.go 85.16% 15 Missing and 8 partials ⚠️
internal/config/config.go 95.23% 1 Missing and 1 partial ⚠️
internal/file/file_service_operator.go 94.44% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1389      +/-   ##
==========================================
+ Coverage   85.31%   85.37%   +0.05%     
==========================================
  Files         102      102              
  Lines       12974    13165     +191     
==========================================
+ Hits        11069    11239     +170     
- Misses       1418     1432      +14     
- Partials      487      494       +7     
Files with missing lines Coverage Δ
internal/config/defaults.go 100.00% <ø> (ø)
internal/config/flags.go 100.00% <ø> (ø)
internal/config/types.go 87.65% <ø> (ø)
internal/model/config.go 90.47% <ø> (ø)
internal/file/file_service_operator.go 76.97% <94.44%> (+0.67%) ⬆️
internal/config/config.go 87.73% <95.23%> (+0.29%) ⬆️
internal/file/file_manager_service.go 77.43% <85.16%> (+2.61%) ⬆️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

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

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

@Akshay2191 Akshay2191 self-assigned this Nov 19, 2025
wantErrMsg string
wantErr bool
}{
{

Choose a reason for hiding this comment

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

The following scenarios could increase coverage:

  • No destination specified
  • Restricted directory.
  • Two files to the same destination.

}{
{
name: "Test 1: success",
prepare: func(t *testing.T) (string, string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be changed to follow the way other tests are set up and formatted

}

//nolint:gocognit,revive,govet // cognitive complexity is 22
func TestFileManagerService_downloadExternalFiles_Cases(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this test be simplified and changed to match the way other tests are set up and structured

assert.Equal(t, fileName, dstArg, "RenameExternalFile destination argument mismatch")
}

func TestDownloadFileContent_MaxBytesLimit(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can these tests please be combined

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to consolidate these divergent test scenarios (MaxBytes vs. Proxy Errors) but it spiked the cognitive complexity to 23 due the very different validation steps. Therefore I kept them seperate.

return filepath.Join(filepath.Dir(fileName), tempFileName)
}

func (fms *FileManagerService) downloadExternalFile(ctx context.Context, fileAction *model.FileCache,
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we add an extra operator maybe like the file operator to handle the external file download as this file is getting a little too large and complex

@github-actions github-actions bot added dependencies documentation Improvements or additions to documentation labels Dec 18, 2025
@Akshay2191 Akshay2191 force-pushed the external-file-mgmt-integration branch from e50d100 to 2e981e0 Compare December 19, 2025 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Pull requests for routine tasks dependencies documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants