<commit_before>// These integration tests require root as they need access to network devices.
package root

import (
	"github.com/AutoRoute/node"
	integration "github.com/AutoRoute/node/integration_tests"

	"errors"
	"fmt"
	"net"
	"os/exec"
	"strings"
	"testing"
	"time"
)

func BuildListenAddress(i *net.Interface, port int) string {
	ll, err := node.GetLinkLocalAddr(*i)
	if err != nil {
		panic(err)
	}
	return fmt.Sprintf("[%s%%%s]:%d", ll, i.Name, port)
}

func WaitForDevice(s string) error {
	timeout := time.After(1 * time.Second)
	for range time.Tick(10 * time.Millisecond) {
		select {
		case <-timeout:
			return errors.New(fmt.Sprintf("Error waiting for %s to be reachable", s))
		default:
		}
		_, err := net.InterfaceByName("looptap0-0")<commit_msg>Actually use the passed device in WaitForDevice<commit_after>// These integration tests require root as they need access to network devices.
package root

import (
	"github.com/AutoRoute/node"
	integration "github.com/AutoRoute/node/integration_tests"

	"errors"
	"fmt"
	"net"
	"os/exec"
	"strings"
	"testing"
	"time"
)

func BuildListenAddress(i *net.Interface, port int) string {
	ll, err := node.GetLinkLocalAddr(*i)
	if err != nil {
		panic(err)
	}
	return fmt.Sprintf("[%s%%%s]:%d", ll, i.Name, port)
}

func WaitForDevice(s string) error {
	timeout := time.After(1 * time.Second)
	for range time.Tick(10 * time.Millisecond) {
		select {
		case <-timeout:
			return errors.New(fmt.Sprintf("Error waiting for %s to be reachable", s))
		default:
		}
		_, err := net.InterfaceByName(s)
{'fraction_non_alphanumeric': 0.14248871695680207, 'fraction_numerical': 0.0051579626047711154, 'mean_word_length': 4.27891156462585, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1449962', 'n_tokens_mistral': 573, 'n_tokens_neox': 549, 'n_words': 145}