feat: add ManualDNSChallenge component and related hooks for manual DNS challenge management

- Implemented `useManualChallenge`, `useChallengePoll`, and `useManualChallengeMutations` hooks for managing manual DNS challenges.
- Created tests for the `useManualChallenge` hooks to ensure correct fetching and mutation behavior.
- Added `ManualDNSChallenge` component for displaying challenge details and actions.
- Developed end-to-end tests for the Manual DNS Provider feature, covering provider selection, challenge UI, and accessibility compliance.
- Included error handling tests for verification failures and network errors.
This commit is contained in:
GitHub Actions
2026-01-12 04:01:40 +00:00
parent a199dfd079
commit d7939bed70
132 changed files with 8680 additions and 878 deletions

View File

@@ -9,10 +9,10 @@ import (
func TestInternalServiceHostAllowlist(t *testing.T) {
// Save original env var
originalEnv := os.Getenv(InternalServiceHostAllowlistEnvVar)
defer os.Setenv(InternalServiceHostAllowlistEnvVar, originalEnv)
defer func() { _ = os.Setenv(InternalServiceHostAllowlistEnvVar, originalEnv) }()
t.Run("DefaultLocalhostOnly", func(t *testing.T) {
os.Setenv(InternalServiceHostAllowlistEnvVar, "")
_ = os.Setenv(InternalServiceHostAllowlistEnvVar, "")
allowlist := InternalServiceHostAllowlist()
// Should contain localhost entries
@@ -30,7 +30,7 @@ func TestInternalServiceHostAllowlist(t *testing.T) {
})
t.Run("WithAdditionalHosts", func(t *testing.T) {
os.Setenv(InternalServiceHostAllowlistEnvVar, "crowdsec,caddy,traefik")
_ = os.Setenv(InternalServiceHostAllowlistEnvVar, "crowdsec,caddy,traefik")
allowlist := InternalServiceHostAllowlist()
// Should contain localhost + additional hosts
@@ -47,7 +47,7 @@ func TestInternalServiceHostAllowlist(t *testing.T) {
})
t.Run("WithEmptyAndWhitespaceEntries", func(t *testing.T) {
os.Setenv(InternalServiceHostAllowlistEnvVar, " , crowdsec , , caddy , ")
_ = os.Setenv(InternalServiceHostAllowlistEnvVar, " , crowdsec , , caddy , ")
allowlist := InternalServiceHostAllowlist()
// Should contain localhost + valid hosts (empty and whitespace ignored)
@@ -64,7 +64,7 @@ func TestInternalServiceHostAllowlist(t *testing.T) {
})
t.Run("WithInvalidEntries", func(t *testing.T) {
os.Setenv(InternalServiceHostAllowlistEnvVar, "crowdsec,http://invalid,user@host,/path")
_ = os.Setenv(InternalServiceHostAllowlistEnvVar, "crowdsec,http://invalid,user@host,/path")
allowlist := InternalServiceHostAllowlist()
// Should only have localhost + crowdsec (others rejected)