<commit_before>package lock

import (
	"github.com/bmizerany/assert"
	"doozer/store"
	"doozer/test"
	"testing"
)

func TestLockSimple(t *testing.T) {
	st := store.New()
	defer close(st.Ops)
	fp := &test.FakeProposer{Store: st}
	go Clean(fp.Store, fp)

	// start our session
	fp.Propose(store.MustEncodeSet("/session/a", "1.2.3.4:55", store.Clobber))

	// lock something for a
	fp.Propose(store.MustEncodeSet("/lock/x", "a", store.Missing))
	fp.Propose(store.MustEncodeSet("/lock/y", "b", store.Missing))
	fp.Propose(store.MustEncodeSet("/lock/z", "a", store.Missing))
<commit_msg>fix test -- avoid race<commit_after>package lock

import (
	"github.com/bmizerany/assert"
	"doozer/store"
	"doozer/test"
	"testing"
)

func TestLockSimple(t *testing.T) {
	st := store.New()
	defer close(st.Ops)
	fp := &test.FakeProposer{Store: st}
	go Clean(fp.Store, fp)
	for <-st.Watches < 1 {} // Wait for Clean's watch to take

	// start our session
	fp.Propose(store.MustEncodeSet("/session/a", "1.2.3.4:55", store.Clobber))

	// lock something for a
	fp.Propose(store.MustEncodeSet("/lock/x", "a", store.Missing))
	fp.Propose(store.MustEncodeSet("/lock/y", "b", store.Missing))
	fp.Propose(store.MustEncodeSet("/lock/z", "a", store.Missing))

{'fraction_non_alphanumeric': 0.18811074918566775, 'fraction_numerical': 0.010586319218241042, 'mean_word_length': 4.438053097345133, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '3594744', 'n_tokens_mistral': 492, 'n_tokens_neox': 481, 'n_words': 90}