@@ -12,7 +12,7 @@ import (
1212
1313func TestTheRunsLookForTheMACOfTheBuildersCard (t * testing.T ) {
1414 // act
15- card , network := builder .Network ()
15+ card , network := builder .Network (builder. Resolving { IPv4 : true , IPv6 : true } )
1616
1717 // assert
1818 require .NotEmpty (t , card .MAC )
@@ -21,7 +21,7 @@ func TestTheRunsLookForTheMACOfTheBuildersCard(t *testing.T) {
2121
2222func TestARunGetsAnIPv4AddressOfItsOwnOnTheCardsNetwork (t * testing.T ) {
2323 // act
24- card , network := builder .Network ()
24+ card , network := builder .Network (builder. Resolving { IPv4 : true , IPv6 : true } )
2525
2626 // assert
2727 prefix , err := netip .ParsePrefix (card .IPv4 .Prefix )
@@ -37,7 +37,7 @@ func TestARunGetsAnIPv4AddressOfItsOwnOnTheCardsNetwork(t *testing.T) {
3737
3838func TestARunGoesOutThroughTheIPv4GatewayOfTheCardsNetwork (t * testing.T ) {
3939 // act
40- card , network := builder .Network ()
40+ card , network := builder .Network (builder. Resolving { IPv4 : true , IPv6 : true } )
4141
4242 // assert
4343 prefix , err := netip .ParsePrefix (card .IPv4 .Prefix )
@@ -50,7 +50,7 @@ func TestARunGoesOutThroughTheIPv4GatewayOfTheCardsNetwork(t *testing.T) {
5050
5151func TestARunResolvesThroughTheIPv4NameserverOfTheCardsNetwork (t * testing.T ) {
5252 // act
53- card , network := builder .Network ()
53+ card , network := builder .Network (builder. Resolving { IPv4 : true , IPv6 : true } )
5454
5555 // assert
5656 prefix , err := netip .ParsePrefix (card .IPv4 .Prefix )
@@ -63,7 +63,7 @@ func TestARunResolvesThroughTheIPv4NameserverOfTheCardsNetwork(t *testing.T) {
6363
6464func TestARunGetsAnIPv6AddressOfItsOwnOnTheCardsNetwork (t * testing.T ) {
6565 // act
66- card , network := builder .Network ()
66+ card , network := builder .Network (builder. Resolving { IPv4 : true , IPv6 : true } )
6767
6868 // assert
6969 prefix , err := netip .ParsePrefix (card .IPv6 .Prefix )
@@ -79,7 +79,7 @@ func TestARunGetsAnIPv6AddressOfItsOwnOnTheCardsNetwork(t *testing.T) {
7979
8080func TestARunGoesOutThroughTheIPv6GatewayOfTheCardsNetwork (t * testing.T ) {
8181 // act
82- card , network := builder .Network ()
82+ card , network := builder .Network (builder. Resolving { IPv4 : true , IPv6 : true } )
8383
8484 // assert
8585 prefix , err := netip .ParsePrefix (card .IPv6 .Prefix )
@@ -92,7 +92,7 @@ func TestARunGoesOutThroughTheIPv6GatewayOfTheCardsNetwork(t *testing.T) {
9292
9393func TestARunResolvesThroughTheIPv6NameserverOfTheCardsNetwork (t * testing.T ) {
9494 // act
95- card , network := builder .Network ()
95+ card , network := builder .Network (builder. Resolving { IPv4 : true , IPv6 : true } )
9696
9797 // assert
9898 prefix , err := netip .ParsePrefix (card .IPv6 .Prefix )
@@ -102,3 +102,13 @@ func TestARunResolvesThroughTheIPv6NameserverOfTheCardsNetwork(t *testing.T) {
102102 assert .True (t , prefix .Contains (nameserver ))
103103 assert .Equal (t , card .IPv6 .Nameserver , network .IPv6 .Nameserver )
104104}
105+
106+ func TestARunOnAHostThatResolvesOnlyOverIPv4GetsNoIPv6Nameserver (t * testing.T ) {
107+ // act
108+ card , network := builder .Network (builder.Resolving {IPv4 : true })
109+
110+ // assert
111+ assert .NotEmpty (t , card .IPv6 .Nameserver )
112+ assert .Empty (t , network .IPv6 .Nameserver )
113+ assert .Equal (t , card .IPv4 .Nameserver , network .IPv4 .Nameserver )
114+ }
0 commit comments