Skip to content

Commit

Permalink
fix: Change replication-related terms in tests
Browse files Browse the repository at this point in the history
Signed-off-by: Bartłomiej Święcki <[email protected]>
  • Loading branch information
Bartłomiej Święcki committed Nov 9, 2022
1 parent 326363b commit ab3e211
Show file tree
Hide file tree
Showing 7 changed files with 302 additions and 302 deletions.
44 changes: 22 additions & 22 deletions embedded/store/immustore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2293,19 +2293,19 @@ func TestUncommittedTxOverwriting(t *testing.T) {
}

func TestExportAndReplicateTx(t *testing.T) {
masterDir := t.TempDir()
primaryDir := t.TempDir()

masterStore, err := Open(masterDir, DefaultOptions())
primaryStore, err := Open(primaryDir, DefaultOptions())
require.NoError(t, err)
defer immustoreClose(t, masterStore)
defer immustoreClose(t, primaryStore)

replicaDir := t.TempDir()

replicaStore, err := Open(replicaDir, DefaultOptions())
require.NoError(t, err)
defer immustoreClose(t, replicaStore)

tx, err := masterStore.NewWriteOnlyTx()
tx, err := primaryStore.NewWriteOnlyTx()
require.NoError(t, err)

tx.WithMetadata(NewTxMetadata())
Expand All @@ -2317,9 +2317,9 @@ func TestExportAndReplicateTx(t *testing.T) {
require.NoError(t, err)
require.NotNil(t, hdr)

txholder := tempTxHolder(t, masterStore)
txholder := tempTxHolder(t, primaryStore)

etx, err := masterStore.ExportTx(1, false, txholder)
etx, err := primaryStore.ExportTx(1, false, txholder)
require.NoError(t, err)

rhdr, err := replicaStore.ReplicateTx(etx, false)
Expand All @@ -2334,19 +2334,19 @@ func TestExportAndReplicateTx(t *testing.T) {
}

func TestExportAndReplicateTxCornerCases(t *testing.T) {
masterDir := t.TempDir()
primaryDir := t.TempDir()

masterStore, err := Open(masterDir, DefaultOptions())
primaryStore, err := Open(primaryDir, DefaultOptions())
require.NoError(t, err)
defer immustoreClose(t, masterStore)
defer immustoreClose(t, primaryStore)

replicaDir := t.TempDir()

replicaStore, err := Open(replicaDir, DefaultOptions().WithMaxActiveTransactions(1))
require.NoError(t, err)
defer immustoreClose(t, replicaStore)

tx, err := masterStore.NewWriteOnlyTx()
tx, err := primaryStore.NewWriteOnlyTx()
require.NoError(t, err)

tx.WithMetadata(NewTxMetadata())
Expand All @@ -2358,10 +2358,10 @@ func TestExportAndReplicateTxCornerCases(t *testing.T) {
require.NoError(t, err)
require.NotNil(t, hdr)

txholder := tempTxHolder(t, masterStore)
txholder := tempTxHolder(t, primaryStore)

t.Run("prevent replicating broken data", func(t *testing.T) {
etx, err := masterStore.ExportTx(1, false, txholder)
etx, err := primaryStore.ExportTx(1, false, txholder)
require.NoError(t, err)

for i := range etx {
Expand Down Expand Up @@ -2392,11 +2392,11 @@ func TestExportAndReplicateTxCornerCases(t *testing.T) {
}

func TestExportAndReplicateTxSimultaneousWriters(t *testing.T) {
masterDir := t.TempDir()
primaryDir := t.TempDir()

masterStore, err := Open(masterDir, DefaultOptions())
primaryStore, err := Open(primaryDir, DefaultOptions())
require.NoError(t, err)
defer immustoreClose(t, masterStore)
defer immustoreClose(t, primaryStore)

replicaDir := t.TempDir()

Expand All @@ -2409,7 +2409,7 @@ func TestExportAndReplicateTxSimultaneousWriters(t *testing.T) {

for i := 0; i < txCount; i++ {
t.Run(fmt.Sprintf("tx: %d", i), func(t *testing.T) {
tx, err := masterStore.NewWriteOnlyTx()
tx, err := primaryStore.NewWriteOnlyTx()
require.NoError(t, err)

tx.WithMetadata(NewTxMetadata())
Expand All @@ -2422,7 +2422,7 @@ func TestExportAndReplicateTxSimultaneousWriters(t *testing.T) {
require.NotNil(t, hdr)

txholder := tempTxHolder(t, replicaStore)
etx, err := masterStore.ExportTx(hdr.ID, false, txholder)
etx, err := primaryStore.ExportTx(hdr.ID, false, txholder)
require.NoError(t, err)

// Replicate the same transactions concurrently, only one must succeed
Expand Down Expand Up @@ -2452,11 +2452,11 @@ func TestExportAndReplicateTxSimultaneousWriters(t *testing.T) {
}

func TestExportAndReplicateTxDisorderedReplication(t *testing.T) {
masterDir := t.TempDir()
primaryDir := t.TempDir()

masterStore, err := Open(masterDir, DefaultOptions())
primaryStore, err := Open(primaryDir, DefaultOptions())
require.NoError(t, err)
defer immustoreClose(t, masterStore)
defer immustoreClose(t, primaryStore)

replicaDir := t.TempDir()

Expand All @@ -2472,7 +2472,7 @@ func TestExportAndReplicateTxDisorderedReplication(t *testing.T) {
txholder := tempTxHolder(t, replicaStore)

for i := 0; i < txCount; i++ {
tx, err := masterStore.NewWriteOnlyTx()
tx, err := primaryStore.NewWriteOnlyTx()
require.NoError(t, err)

tx.WithMetadata(NewTxMetadata())
Expand All @@ -2484,7 +2484,7 @@ func TestExportAndReplicateTxDisorderedReplication(t *testing.T) {
require.NoError(t, err)
require.NotNil(t, hdr)

etx, err := masterStore.ExportTx(hdr.ID, false, txholder)
etx, err := primaryStore.ExportTx(hdr.ID, false, txholder)
require.NoError(t, err)

etxs <- etx
Expand Down
Loading

0 comments on commit ab3e211

Please sign in to comment.