fix(suites): fix passive health checks for caddy suite (#3627)

This change fixes an issue that was incorrectly marking the primary load balancer target for the front end in dev mode as down.
pull/3586/head^2
James Elliott 2022-06-30 11:39:50 +10:00 committed by GitHub
parent 60e1a9451b
commit 0f7da4fd90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 18 deletions

View File

@ -40,7 +40,6 @@ login.example.com:8080 {
fail_duration 10s fail_duration 10s
max_fails 1 max_fails 1
unhealthy_status 5xx unhealthy_status 5xx
unhealthy_request_count 1
} }
} }
} }

View File

@ -0,0 +1,7 @@
FROM caddy:2.5.1-builder AS builder
RUN xcaddy build fix-empty-copy-headers
FROM caddy:2.5.1
COPY --from=builder /usr/bin/caddy /usr/bin/caddy

View File

@ -2,6 +2,7 @@
version: '3' version: '3'
services: services:
caddy: caddy:
# build: ./example/compose/caddy/ # used for debugging
image: caddy:2.5.1-alpine image: caddy:2.5.1-alpine
volumes: volumes:
- ./example/compose/caddy/Caddyfile:/etc/caddy/Caddyfile - ./example/compose/caddy/Caddyfile:/etc/caddy/Caddyfile

View File

@ -251,7 +251,7 @@ http {
} }
} }
# Example configuration of domains protected by Authelia. # Example configuration of domains protected by Authelia.
server { server {
listen 8080 ssl; listen 8080 ssl;
server_name oidc.example.com server_name oidc.example.com

View File

@ -1,29 +1,14 @@
package suites package suites
import ( import (
"fmt"
"strings"
"testing" "testing"
"github.com/go-rod/rod" "github.com/go-rod/rod"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
) )
func (rs *RodSession) verifyBodyContains(t *testing.T, page *rod.Page, pattern string) { func (rs *RodSession) verifyBodyContains(t *testing.T, page *rod.Page, pattern string) {
body, err := page.Element("body") body, err := page.ElementR("body", pattern)
assert.NoError(t, err) assert.NoError(t, err)
assert.NotNil(t, body) assert.NotNil(t, body)
text, err := body.Text()
assert.NoError(t, err)
assert.NotNil(t, text)
if strings.Contains(text, pattern) {
err = nil
} else {
err = fmt.Errorf("body does not contain pattern: %s", pattern)
}
require.NoError(t, err)
} }