mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 16:24:19 -04:00
test: skip certain network-specific tests on non-Linux (#7318)
Add conditional test skipping for bind and readme tests that rely on Linux-specific loopback interface behavior. These tests reference network configurations that may not exist on for e.g. macOS or other platforms, causing spurious test failures. Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package bind
|
package bind
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/coredns/caddy"
|
"github.com/coredns/caddy"
|
||||||
@@ -8,6 +9,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestSetup(t *testing.T) {
|
func TestSetup(t *testing.T) {
|
||||||
|
// Skip on non-Linux systems as some tests refer to for e.g. loopback interfaces which
|
||||||
|
// are not present on all systems.
|
||||||
|
if runtime.GOOS != "linux" {
|
||||||
|
t.Skipf("Skipping bind test on %s", runtime.GOOS)
|
||||||
|
}
|
||||||
|
|
||||||
for i, test := range []struct {
|
for i, test := range []struct {
|
||||||
config string
|
config string
|
||||||
expected []string
|
expected []string
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
@@ -45,6 +46,12 @@ PrivateKey: f03VplaIEA+KHI9uizlemUSbUJH86hPBPjmcUninPoM=
|
|||||||
// While we're at it - we also check the README.md itself. It should at least have the sections:
|
// While we're at it - we also check the README.md itself. It should at least have the sections:
|
||||||
// Name, Description, Syntax and Examples. See plugin.md for more details.
|
// Name, Description, Syntax and Examples. See plugin.md for more details.
|
||||||
func TestReadme(t *testing.T) {
|
func TestReadme(t *testing.T) {
|
||||||
|
// Skip on non-Linux systems as some tests refer to for e.g. loopback interfaces which
|
||||||
|
// are not present on all systems.
|
||||||
|
if runtime.GOOS != "linux" {
|
||||||
|
t.Skipf("Skipping readme test on %s", runtime.GOOS)
|
||||||
|
}
|
||||||
|
|
||||||
port := 30053
|
port := 30053
|
||||||
caddy.Quiet = true
|
caddy.Quiet = true
|
||||||
dnsserver.Quiet = true
|
dnsserver.Quiet = true
|
||||||
|
|||||||
Reference in New Issue
Block a user