state := getStatefileContents(statefilePath) Expect(state.InstanceBindings["foo"]).To(BeEmpty()) }) Context("Concurrency", func() { It("prevents simultaneous edits", func() { chan1 := make(chan struct{}) chan2 := make(chan struct{}) action := func(control chan struct{}) { defer GinkgoRecover() repo.Unbind("foo", "foo-binding") close(control) } repo.Lock() go action(chan1) Consistently(chan1).ShouldNot(BeClosed()) repo.Unlock() Eventually(chan1).Should(BeClosed()) go action(chan2) Eventually(chan2).Should(BeClosed()) }) })