mirror of
https://github.com/juanfont/headscale.git
synced 2026-10-27 16:56:49 +09:00
Adds DNS-01 for headscale's own certificate through dns.challenge.provider, with the same propagation check as node certificates. Storage format changes: first start gets a new account and certificate. Updates #2527 Updates #504
34 lines
707 B
Go
34 lines
707 B
Go
package zlog
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/json"
|
|
"testing"
|
|
|
|
"github.com/rs/zerolog"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
func TestZap(t *testing.T) {
|
|
var buf bytes.Buffer
|
|
|
|
logger := Zap(zerolog.New(&buf).Level(zerolog.InfoLevel)).
|
|
Named("acme").
|
|
With(zap.String("issuer", "letsencrypt"))
|
|
|
|
logger.Debug("below the logger's level")
|
|
logger.Warn("renewing", zap.Int("attempt", 2))
|
|
|
|
var got map[string]any
|
|
require.NoError(t, json.Unmarshal(buf.Bytes(), &got), buf.String())
|
|
assert.Equal(t, map[string]any{
|
|
"level": "warn",
|
|
"logger": "acme",
|
|
"issuer": "letsencrypt",
|
|
"attempt": float64(2),
|
|
"message": "renewing",
|
|
}, got)
|
|
}
|