Uncomment tests that will failed in transition period

This commit is contained in:
Kristoffer Dalby 2022-02-21 23:10:20 +00:00
parent 4ca8181dcb
commit f4c302f1fb
2 changed files with 43 additions and 51 deletions

View file

@ -1,8 +1,6 @@
package headscale package headscale
import ( import (
"fmt"
"gopkg.in/check.v1" "gopkg.in/check.v1"
"inet.af/netaddr" "inet.af/netaddr"
"tailscale.com/tailcfg" "tailscale.com/tailcfg"
@ -225,9 +223,6 @@ func (s *Suite) TestDNSConfigMapResponseWithMagicDNS(c *check.C) {
} }
app.db.Save(machine2InShared1) app.db.Save(machine2InShared1)
err = app.AddSharedMachineToNamespace(machineInShared2, namespaceShared1)
c.Assert(err, check.IsNil)
baseDomain := "foobar.headscale.net" baseDomain := "foobar.headscale.net"
dnsConfigOrig := tailcfg.DNSConfig{ dnsConfigOrig := tailcfg.DNSConfig{
Routes: make(map[string][]dnstype.Resolver), Routes: make(map[string][]dnstype.Resolver),
@ -245,19 +240,21 @@ func (s *Suite) TestDNSConfigMapResponseWithMagicDNS(c *check.C) {
peersOfMachineInShared1, peersOfMachineInShared1,
) )
c.Assert(dnsConfig, check.NotNil) c.Assert(dnsConfig, check.NotNil)
c.Assert(len(dnsConfig.Routes), check.Equals, 2)
domainRouteShared1 := fmt.Sprintf("%s.%s", namespaceShared1.Name, baseDomain) // TODO: Remove comment out when we have all nodes available to every node
_, ok := dnsConfig.Routes[domainRouteShared1] // c.Assert(len(dnsConfig.Routes), check.Equals, 2)
c.Assert(ok, check.Equals, true)
domainRouteShared2 := fmt.Sprintf("%s.%s", namespaceShared2.Name, baseDomain) // domainRouteShared1 := fmt.Sprintf("%s.%s", namespaceShared1.Name, baseDomain)
_, ok = dnsConfig.Routes[domainRouteShared2] // _, ok := dnsConfig.Routes[domainRouteShared1]
c.Assert(ok, check.Equals, true) // c.Assert(ok, check.Equals, true)
//
domainRouteShared3 := fmt.Sprintf("%s.%s", namespaceShared3.Name, baseDomain) // domainRouteShared2 := fmt.Sprintf("%s.%s", namespaceShared2.Name, baseDomain)
_, ok = dnsConfig.Routes[domainRouteShared3] // _, ok = dnsConfig.Routes[domainRouteShared2]
c.Assert(ok, check.Equals, false) // c.Assert(ok, check.Equals, true)
//
// domainRouteShared3 := fmt.Sprintf("%s.%s", namespaceShared3.Name, baseDomain)
// _, ok = dnsConfig.Routes[domainRouteShared3]
// c.Assert(ok, check.Equals, false)
} }
func (s *Suite) TestDNSConfigMapResponseWithoutMagicDNS(c *check.C) { func (s *Suite) TestDNSConfigMapResponseWithoutMagicDNS(c *check.C) {
@ -374,9 +371,6 @@ func (s *Suite) TestDNSConfigMapResponseWithoutMagicDNS(c *check.C) {
} }
app.db.Save(machine2InShared1) app.db.Save(machine2InShared1)
err = app.AddSharedMachineToNamespace(machineInShared2, namespaceShared1)
c.Assert(err, check.IsNil)
baseDomain := "foobar.headscale.net" baseDomain := "foobar.headscale.net"
dnsConfigOrig := tailcfg.DNSConfig{ dnsConfigOrig := tailcfg.DNSConfig{
Routes: make(map[string][]dnstype.Resolver), Routes: make(map[string][]dnstype.Resolver),

View file

@ -1,7 +1,6 @@
package headscale package headscale
import ( import (
"github.com/rs/zerolog/log"
"gopkg.in/check.v1" "gopkg.in/check.v1"
"gorm.io/gorm" "gorm.io/gorm"
"inet.af/netaddr" "inet.af/netaddr"
@ -206,36 +205,35 @@ func (s *Suite) TestGetMapResponseUserProfiles(c *check.C) {
} }
app.db.Save(machine2InShared1) app.db.Save(machine2InShared1)
err = app.AddSharedMachineToNamespace(machineInShared2, namespaceShared1) // TODO: Remove comment out when we have all nodes available to every node
c.Assert(err, check.IsNil) // peersOfMachine1InShared1, err := app.getPeers(machineInShared1)
peersOfMachine1InShared1, err := app.getPeers(machineInShared1) // c.Assert(err, check.IsNil)
c.Assert(err, check.IsNil)
userProfiles := getMapResponseUserProfiles( // userProfiles := getMapResponseUserProfiles(
*machineInShared1, // *machineInShared1,
peersOfMachine1InShared1, // peersOfMachine1InShared1,
) // )
//
log.Trace().Msgf("userProfiles %#v", userProfiles) // log.Trace().Msgf("userProfiles %#v", userProfiles)
c.Assert(len(userProfiles), check.Equals, 2) // c.Assert(len(userProfiles), check.Equals, 2)
//
found := false // found := false
for _, userProfiles := range userProfiles { // for _, userProfiles := range userProfiles {
if userProfiles.DisplayName == namespaceShared1.Name { // if userProfiles.DisplayName == namespaceShared1.Name {
found = true // found = true
//
break // break
} // }
} // }
c.Assert(found, check.Equals, true) // c.Assert(found, check.Equals, true)
//
found = false // found = false
for _, userProfile := range userProfiles { // for _, userProfile := range userProfiles {
if userProfile.DisplayName == namespaceShared2.Name { // if userProfile.DisplayName == namespaceShared2.Name {
found = true // found = true
//
break // break
} // }
} // }
c.Assert(found, check.Equals, true) // c.Assert(found, check.Equals, true)
} }