Skip to content

test(traefik): add TestCustomProjectConfig for custom project-level Traefik configuration - #8114

Merged
rfay merged 1 commit into
ddev:mainfrom
rfay:20260206_rfay_custom_traefik_testing
Feb 6, 2026
Merged

rfay merged 1 commit into
ddev:mainfrom
rfay:20260206_rfay_custom_traefik_testing

Conversation

@rfay

@rfay rfay commented Feb 6, 2026 •

Copy link
Copy Markdown
Member

The Issue

We didn't have adequate test coverage for custom project traefik configuration.

Custom project-level Traefik configuration (after removing #ddev-generated) lacked automated testing to verify the complete workflow. The existing tests covered global custom configuration but not project-specific customization.

How This PR Solves The Issue

Adds TestCustomProjectConfig which:

  • Generates default project Traefik config with #ddev-generated marker
  • Removes the marker to take ownership of the configuration
  • Modifies config to enable HTTP→HTTPS redirect middleware (commented out by default)
  • Verifies the custom config propagates to:
    • Project's .ddev/traefik/config/ directory
    • Global ~/.ddev/traefik/config/ directory
    • Router container's /mnt/ddev-global-cache/traefik/config/ volume
  • Validates actual behavior change by confirming HTTP requests redirect to HTTPS

Related to test attempts in

Hopefully we can figure out where we're at with current HEAD and this test, when we understand that and have good testing the related PRs may be able to proceed.

Manual Testing Instructions

make testpkg TESTARGS="-run TestCustomProjectConfig"

The test should pass and demonstrate that:

  1. Custom project config (without #ddev-generated) is not overwritten
  2. The config is properly deployed to all expected locations
  3. Traefik actually uses the custom configuration (HTTP→HTTPS redirect works)

Automated Testing Overview

TestCustomProjectConfig covers the complete end-to-end workflow for custom project-level Traefik configuration as documented in docs/users/extend/traefik-router.md.

Key validations:

  • File propagation through the entire config chain
  • Traefik loads and applies the custom configuration
  • Behavior changes as expected (HTTP→HTTPS redirect)
  • Cleanup removes custom config so it regenerates properly

Release/Deployment Notes

No deployment impact. This is purely a test enhancement to improve coverage of an existing feature (custom project-level Traefik configuration).

…nfiguration

## The Issue

Custom project-level Traefik configuration (after removing #ddev-generated)
lacked automated testing to verify the complete workflow. The existing tests
covered global custom configuration but not project-specific customization.

## How This PR Solves The Issue

Adds `TestCustomProjectConfig` which:
- Generates default project Traefik config with #ddev-generated marker
- Removes the marker to take ownership of the configuration
- Modifies config to enable HTTP→HTTPS redirect middleware (commented out by default)
- Verifies the custom config propagates to:
  - Project's .ddev/traefik/config/ directory
  - Global ~/.ddev/traefik/config/ directory
  - Router container's /mnt/ddev-global-cache/traefik/config/ volume
- Validates actual behavior change by confirming HTTP requests redirect to HTTPS

## Manual Testing Instructions

```bash
make testpkg TESTARGS="-run TestCustomProjectConfig"
```

The test should pass and demonstrate that:
1. Custom project config (without #ddev-generated) is not overwritten
2. The config is properly deployed to all expected locations
3. Traefik actually uses the custom configuration (HTTP→HTTPS redirect works)

## Automated Testing Overview

The new test covers the complete end-to-end workflow for custom project-level
Traefik configuration as documented in docs/users/extend/traefik-router.md.

Key validations:
- File propagation through the entire config chain
- Traefik loads and applies the custom configuration
- Behavior changes as expected (HTTP→HTTPS redirect)
- Cleanup removes custom config so it regenerates properly

## Release/Deployment Notes

No deployment impact. This is purely a test enhancement to improve coverage
of an existing feature (custom project-level Traefik configuration).

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@github-actions

github-actions Bot commented Feb 6, 2026

Copy link
Copy Markdown

@rfay
rfay marked this pull request as ready for review February 6, 2026 19:10
@rfay
rfay requested a review from a team as a code owner February 6, 2026 19:10
@rfay
rfay requested a review from stasadev February 6, 2026 19:10

@stasadev stasadev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me.

@rfay
rfay merged commit d69b7c6 into ddev:main Feb 6, 2026
35 of 36 checks passed
@rfay
rfay deleted the 20260206_rfay_custom_traefik_testing branch February 6, 2026 20:50
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.

2 participants