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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user