<commit_before>package serfer

import (
	"testing"
	"time"

	"github.com/hashicorp/serf/serf"
	"github.com/stretchr/testify/assert"
	"golang.org/x/net/context"

	tomb "gopkg.in/tomb.v2"
)

func TestRunSerfer(t *testing.T) {

	// Create event
	evt := &MockEvent{}

	// Create handler
	handler := &MockEventHandler{}
	handler.On("HandleEvent", evt).Return()

	// Create channel and serfer
	ch := make(chan serf.Event, 1)
	serfer := NewSerfer(ch, handler)

	// Setup test
	var death tomb.Tomb
	ctx, cancel := context.WithCancel(context.Background())

	// Start serfer
	death.Go(func() error {
		return serfer.Run(ctx)
	})

	// Send event
	select {
	case ch <- evt:
	case <-time.After(time.Second):
		t.Fatal("Event was not sent over channel")
	}<commit_msg>Update tests<commit_after>package serfer

import (
	"testing"
	"time"

	"github.com/hashicorp/serf/serf"
	"github.com/stretchr/testify/assert"
	"golang.org/x/net/context"

	tomb "gopkg.in/tomb.v2"
)

func TestRunSerfer(t *testing.T) {

	// Create event
	evt := &MockEvent{}

	// Create handler
	handler := &MockEventHandler{}
	handler.On("HandleEvent", evt).Return()

	// Create channel and serfer
	ch := make(chan serf.Event, 1)
	serfer := NewSerfer(ch, handler)

	// Setup test
	var death tomb.Tomb
	ctx, cancel := context.WithCancel(context.Background())

	// Start serfer
	death.Go(func() error {
		return serfer.Run(ctx)
	})

	// Send events
	select {
	case ch <- evt:
	case <-time.After(time.Second):
		t.Fatal("Event was not sent over channel")
	}
	ch <- evt
{'fraction_non_alphanumeric': 0.15404871626069783, 'fraction_numerical': 0.0026333113890717576, 'mean_word_length': 3.6483180428134556, 'pattern_counts': {'":': 0, '<': 8, '<?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': '5781514', 'n_tokens_mistral': 600, 'n_tokens_neox': 574, 'n_words': 127}