mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-26 17:03:06 +00:00
Fixed integration tests for shared nodes
This commit is contained in:
parent
6c4c761408
commit
3e1e07e8c1
1 changed files with 34 additions and 36 deletions
|
@ -58,11 +58,11 @@ func TestIntegrationTestSuite(t *testing.T) {
|
||||||
|
|
||||||
s.namespaces = map[string]TestNamespace{
|
s.namespaces = map[string]TestNamespace{
|
||||||
"main": {
|
"main": {
|
||||||
count: 20,
|
count: 5,
|
||||||
tailscales: make(map[string]dockertest.Resource),
|
tailscales: make(map[string]dockertest.Resource),
|
||||||
},
|
},
|
||||||
"shared": {
|
"shared": {
|
||||||
count: 5,
|
count: 2,
|
||||||
tailscales: make(map[string]dockertest.Resource),
|
tailscales: make(map[string]dockertest.Resource),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -503,44 +503,42 @@ func (s *IntegrationTestSuite) TestSharedNodes() {
|
||||||
for hostname := range shared.tailscales {
|
for hostname := range shared.tailscales {
|
||||||
assert.Contains(s.T(), result, hostname)
|
assert.Contains(s.T(), result, hostname)
|
||||||
}
|
}
|
||||||
|
time.Sleep(100 * time.Second) // Wait for the nodes to receive updates
|
||||||
|
|
||||||
// TODO(kradalby): Figure out why these connections are not set up
|
mainIps, err := getIPs(main.tailscales)
|
||||||
// // TODO: See if we can have a more deterministic wait here.
|
assert.Nil(s.T(), err)
|
||||||
// time.Sleep(100 * time.Second)
|
|
||||||
|
|
||||||
// mainIps, err := getIPs(main.tailscales)
|
sharedIps, err := getIPs(shared.tailscales)
|
||||||
// assert.Nil(s.T(), err)
|
assert.Nil(s.T(), err)
|
||||||
|
|
||||||
// sharedIps, err := getIPs(shared.tailscales)
|
for hostname, tailscale := range main.tailscales {
|
||||||
// assert.Nil(s.T(), err)
|
for peername, ip := range sharedIps {
|
||||||
|
s.T().Run(fmt.Sprintf("%s-%s", hostname, peername), func(t *testing.T) {
|
||||||
|
// We currently cant ping ourselves, so skip that.
|
||||||
|
if peername != hostname {
|
||||||
|
// We are only interested in "direct ping" which means what we
|
||||||
|
// might need a couple of more attempts before reaching the node.
|
||||||
|
command := []string{
|
||||||
|
"tailscale", "ping",
|
||||||
|
"--timeout=15s",
|
||||||
|
"--c=20",
|
||||||
|
"--until-direct=true",
|
||||||
|
ip.String(),
|
||||||
|
}
|
||||||
|
|
||||||
// for hostname, tailscale := range main.tailscales {
|
fmt.Printf("Pinging from %s (%s) to %s (%s)\n", hostname, mainIps[hostname], peername, ip)
|
||||||
// for peername, ip := range sharedIps {
|
result, err := executeCommand(
|
||||||
// s.T().Run(fmt.Sprintf("%s-%s", hostname, peername), func(t *testing.T) {
|
&tailscale,
|
||||||
// // We currently cant ping ourselves, so skip that.
|
command,
|
||||||
// if peername != hostname {
|
[]string{},
|
||||||
// // We are only interested in "direct ping" which means what we
|
)
|
||||||
// // might need a couple of more attempts before reaching the node.
|
assert.Nil(t, err)
|
||||||
// command := []string{
|
fmt.Printf("Result for %s: %s\n", hostname, result)
|
||||||
// "tailscale", "ping",
|
assert.Contains(t, result, "pong")
|
||||||
// "--timeout=1s",
|
}
|
||||||
// "--c=20",
|
})
|
||||||
// "--until-direct=true",
|
}
|
||||||
// ip.String(),
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
// fmt.Printf("Pinging from %s (%s) to %s (%s)\n", hostname, mainIps[hostname], peername, ip)
|
|
||||||
// result, err := executeCommand(
|
|
||||||
// &tailscale,
|
|
||||||
// command,
|
|
||||||
// )
|
|
||||||
// assert.Nil(t, err)
|
|
||||||
// fmt.Printf("Result for %s: %s\n", hostname, result)
|
|
||||||
// assert.Contains(t, result, "pong")
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *IntegrationTestSuite) TestTailDrop() {
|
func (s *IntegrationTestSuite) TestTailDrop() {
|
||||||
|
|
Loading…
Reference in a new issue