<commit_before>package memberlist

import (
	"log"
	"os"
	"testing"
	"time"
)

// CheckInteg will skip a test if integration testing is not enabled.
func CheckInteg(t *testing.T) {
	if !IsInteg() {
		t.SkipNow()
	}
}

// IsInteg returns a boolean telling you if we're in integ testing mode.
func IsInteg() bool {
	return os.Getenv("INTEG_TESTS") != ""
}

// Tests the memberlist by creating a cluster of 100 nodes
// and checking that we get strong convergence of changes.
func TestMemberlist_Integ(t *testing.T) {
	CheckInteg(t)

	num := 16
	var members []*Memberlist

	joinCh := make(chan *Node, num)
	leaveCh := make(chan *Node, num)

	for i := 0; i < num; i++ {
		addr, _ := GetBindAddr()
		c := DefaultConfig()
		c.Name = addr
		c.BindAddr = addr
		c.RTT = 500 * time.Microsecond
		c.ProbeInterval = 10 * time.Millisecond
		c.GossipInterval = 5 * time.Millisecond
		c.PushPullInterval = 100 * time.Millisecond

		m, err := Create(c)
		if err != nil {
			t.Fatalf("unexpected err: %s", err)
		}
		members = append(members, m)
		defer m.Shutdown()

		if i == 0 {
			m.config.JoinCh = joinCh
			m.config.LeaveCh = leaveCh
		} else {
			last := members[i-1]
			num, err := m.Join([]string{last.config.Name})<commit_msg>Nitpick on integ tests, not to modify config after create<commit_after>package memberlist

import (
	"log"
	"os"
	"testing"
	"time"
)

// CheckInteg will skip a test if integration testing is not enabled.
func CheckInteg(t *testing.T) {
	if !IsInteg() {
		t.SkipNow()
	}
}

// IsInteg returns a boolean telling you if we're in integ testing mode.
func IsInteg() bool {
	return os.Getenv("INTEG_TESTS") != ""
}

// Tests the memberlist by creating a cluster of 100 nodes
// and checking that we get strong convergence of changes.
func TestMemberlist_Integ(t *testing.T) {
	CheckInteg(t)

	num := 16
	var members []*Memberlist

	joinCh := make(chan *Node, num)
	leaveCh := make(chan *Node, num)

	for i := 0; i < num; i++ {
		addr, _ := GetBindAddr()
		c := DefaultConfig()
		c.Name = addr
		c.BindAddr = addr
		c.RTT = 500 * time.Microsecond
		c.ProbeInterval = 10 * time.Millisecond
		c.GossipInterval = 5 * time.Millisecond
		c.PushPullInterval = 100 * time.Millisecond

		if i == 0 {
			c.JoinCh = joinCh
			c.LeaveCh = leaveCh
		}

		m, err := Create(c)
		if err != nil {
			t.Fatalf("unexpected err: %s", err)
		}
		members = append(members, m)
		defer m.Shutdown()

		if i > 0 {
			last := members[i-1]
			num, err := m.Join([]string{last.config.Name})
{'fraction_non_alphanumeric': 0.13322567622123538, 'fraction_numerical': 0.014129995962858296, 'mean_word_length': 3.3020833333333335, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, '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': '7505579', 'n_tokens_mistral': 1010, 'n_tokens_neox': 896, 'n_words': 272}