test(plugin): add tests for any (#7341)

This commit is contained in:
Ville Vesilehto
2025-06-02 02:30:01 +03:00
committed by GitHub
parent ad5a00ba21
commit bb33ab5301
2 changed files with 60 additions and 0 deletions

21
plugin/any/setup_test.go Normal file
View File

@@ -0,0 +1,21 @@
package any
import (
"testing"
"github.com/coredns/caddy"
"github.com/coredns/coredns/core/dnsserver"
)
func TestSetup(t *testing.T) {
c := caddy.NewTestController("dns", `any`)
if err := setup(c); err != nil {
t.Fatalf("Expected no errors, but got: %v", err)
}
// Check that the plugin was added to the config
cfg := dnsserver.GetConfig(c)
if len(cfg.Plugin) == 0 {
t.Error("Expected plugin to be added to config")
}
}