mirror of
				https://github.com/juanfont/headscale.git
				synced 2025-10-28 10:51:44 +01:00 
			
		
		
		
	Use FQDN from tailscale client
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
		
							parent
							
								
									d8144ee2ed
								
							
						
					
					
						commit
						cbbf9fbdef
					
				| @ -69,10 +69,10 @@ func TestPingAllByIP(t *testing.T) { | ||||
| 
 | ||||
| 	t.Logf("%d successful pings out of %d", success, len(allClients)*len(allIps)) | ||||
| 
 | ||||
| 	// err = scenario.Shutdown()
 | ||||
| 	// if err != nil {
 | ||||
| 	// 	t.Errorf("failed to tear down scenario: %s", err)
 | ||||
| 	// }
 | ||||
| 	err = scenario.Shutdown() | ||||
| 	if err != nil { | ||||
| 		t.Errorf("failed to tear down scenario: %s", err) | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| func TestPingAllByHostname(t *testing.T) { | ||||
| @ -94,6 +94,7 @@ func TestPingAllByHostname(t *testing.T) { | ||||
| 	} | ||||
| 
 | ||||
| 	var allClients []*tsic.TailscaleInContainer | ||||
| 	var allHostnames []string | ||||
| 
 | ||||
| 	for namespace := range spec { | ||||
| 		clients, err := scenario.GetClients(namespace) | ||||
| @ -109,13 +110,22 @@ func TestPingAllByHostname(t *testing.T) { | ||||
| 		t.Errorf("failed wait for tailscale clients to be in sync: %s", err) | ||||
| 	} | ||||
| 
 | ||||
| 	for _, client := range allClients { | ||||
| 		fqdn, err := client.FQDN() | ||||
| 		if err != nil { | ||||
| 			t.Errorf("failed to get fqdn of client %s: %s", t.Name(), err) | ||||
| 		} | ||||
| 
 | ||||
| 		allHostnames = append(allHostnames, fqdn) | ||||
| 	} | ||||
| 
 | ||||
| 	success := 0 | ||||
| 
 | ||||
| 	for _, client := range allClients { | ||||
| 		for _, peer := range allClients { | ||||
| 			err := client.Ping(peer.Hostname) | ||||
| 		for _, hostname := range allHostnames { | ||||
| 			err := client.Ping(hostname) | ||||
| 			if err != nil { | ||||
| 				t.Errorf("failed to ping %s from %s: %s", peer.Hostname, client.Hostname, err) | ||||
| 				t.Errorf("failed to ping %s from %s: %s", hostname, client.Hostname, err) | ||||
| 			} else { | ||||
| 				success++ | ||||
| 			} | ||||
|  | ||||
| @ -204,6 +204,15 @@ func (t *TailscaleInContainer) Status() (*ipnstate.Status, error) { | ||||
| 	return &status, err | ||||
| } | ||||
| 
 | ||||
| func (t *TailscaleInContainer) FQDN() (string, error) { | ||||
| 	status, err := t.Status() | ||||
| 	if err != nil { | ||||
| 		return "", fmt.Errorf("failed to get FQDN: %w", err) | ||||
| 	} | ||||
| 
 | ||||
| 	return status.Self.DNSName, nil | ||||
| } | ||||
| 
 | ||||
| func (t *TailscaleInContainer) WaitForPeers(expected int) error { | ||||
| 	return t.pool.Retry(func() error { | ||||
| 		status, err := t.Status() | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user