integration: fix STM tests to compile against new interface
@@ -63,7 +63,8 @@ func TestSTMConflict(t *testing.T) {
return nil
}
go func() {
- _, err := concurrency.NewSTMRepeatable(context.TODO(), curEtcdc, applyf)
+ iso := concurrency.WithIsolation(concurrency.RepeatableReads)
+ _, err := concurrency.NewSTM(curEtcdc, applyf, iso)
errc <- err
}()
}
@@ -100,7 +101,9 @@ func TestSTMPutNewKey(t *testing.T) {
stm.Put("foo", "bar")
return nil
}
- if _, err := concurrency.NewSTMRepeatable(context.TODO(), etcdc, applyf); err != nil {
+
+ iso := concurrency.WithIsolation(concurrency.RepeatableReads)
+ if _, err := concurrency.NewSTM(etcdc, applyf, iso); err != nil {
t.Fatalf("error on stm txn (%v)", err)
}
@@ -126,7 +129,10 @@ func TestSTMAbort(t *testing.T) {
stm.Put("foo", "bap")
return nil
}
- if _, err := concurrency.NewSTMRepeatable(ctx, etcdc, applyf); err == nil {
+
+ iso := concurrency.WithIsolation(concurrency.RepeatableReads)
+ sctx := concurrency.WithAbortContext(ctx)
+ if _, err := concurrency.NewSTM(etcdc, applyf, iso, sctx); err == nil {
t.Fatalf("no error on stm txn")
}
@@ -186,7 +192,8 @@ func TestSTMSerialize(t *testing.T) {
return nil
}
go func() {
- _, err := concurrency.NewSTMSerializable(context.TODO(), curEtcdc, applyf)
+ iso := concurrency.WithIsolation(concurrency.Serializable)
+ _, err := concurrency.NewSTM(curEtcdc, applyf, iso)
errc <- err
}()
}
@@ -229,7 +236,9 @@ func TestSTMApplyOnConcurrentDeletion(t *testing.T) {
stm.Put("foo2", "bar2")
return nil
}
- if _, err := concurrency.NewSTMRepeatable(context.TODO(), etcdc, applyf); err != nil {
+
+ iso := concurrency.WithIsolation(concurrency.RepeatableReads)
+ if _, err := concurrency.NewSTM(etcdc, applyf, iso); err != nil {
t.Fatalf("error on stm txn (%v)", err)
}
if try != 2 {
