ci: run plugin tests on Windows (#8314)

Plugin package tests previously ran only on Linux, so Windows-
specific failures were never caught. Run them in CI and make the
affected tests portable across platforms.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
This commit is contained in:
Ville Vesilehto
2026-07-19 13:52:23 +03:00
committed by GitHub
parent 96ec17d5c6
commit 077774e0cd
11 changed files with 124 additions and 99 deletions

View File

@@ -2,6 +2,7 @@ package tls
import (
"crypto/tls"
"io"
"path/filepath"
"strings"
"testing"
@@ -52,6 +53,12 @@ func TestTLS(t *testing.T) {
t.Errorf("Test %d: Expected error to contain: %v, found error: %v, input: %s", i, test.expectedErrContent, err, test.input)
}
}
// setup registers OnShutdown to close KeyLogWriter, but tests never shut down.
// Close explicitly so t.TempDir cleanup can remove the file on Windows.
if err == nil {
closeKeyLogWriter(t, dnsserver.GetConfig(c))
}
}
}
@@ -121,5 +128,22 @@ func TestTLSKeyLog(t *testing.T) {
if cfg.TLSConfig.KeyLogWriter == nil {
t.Fatal("KeyLogWriter is not set")
}
// setup registers OnShutdown to close KeyLogWriter, but tests never shut down.
// Close explicitly so t.TempDir cleanup can remove the file on Windows.
closeKeyLogWriter(t, cfg)
})
}
func closeKeyLogWriter(t *testing.T, cfg *dnsserver.Config) {
t.Helper()
if cfg.TLSConfig == nil {
return
}
closer, ok := cfg.TLSConfig.KeyLogWriter.(io.Closer)
if !ok {
return
}
t.Cleanup(func() {
closer.Close()
})
}