You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
raiseTimeoutError(f"Expected at least one snapshot after {timeout_s}s")
3088
+
returnsnapshots
3089
+
3090
+
# Pattern for these tests:
3091
+
# 1. wait for any startup triggered txs to commit and net to settle
3092
+
# 2. wait for a snapshot with the latest committed tx, or wait 5s
3093
+
# 3. record baseline
3094
+
# 4. record new snapshots over 10s and compare that to the baseline
3082
3095
3083
3096
# min_tx set low
3084
3097
withnet_with_min_tx("_low", 0) asnet:
3085
-
LOG.info("Started")
3086
-
baseline=wait_for_at_least_one(net)
3087
-
LOG.info("Got snapshot count")
3098
+
time.sleep(1)
3099
+
net.get_committed_snapshots(
3100
+
net.find_primary()[0],
3101
+
force_txs=False,
3102
+
wait_for_target_seqno=True,
3103
+
timeout=5,
3104
+
)
3105
+
baseline=get_committed_snapshot_files(net)
3088
3106
time.sleep(10)
3089
-
after=get_snapshot_count(net)
3107
+
final=get_committed_snapshot_files(net)
3090
3108
assert (
3091
-
after>baseline
3092
-
), f"min_tx_count set to 0 should cause many snapshots, got {after-baseline}"
3109
+
len(final-baseline) >=8
3110
+
), f"With min_tx_interval set to 0 we expect snapshots to be generated at around 1 per second, but got {final} snapshots 10s after a baseline of {baseline}, with {final-baseline} new snapshots seen over the test."
3093
3111
3094
3112
# min_tx set just right
3095
3113
withnet_with_min_tx("_exact", 2) asnet:
3096
-
baseline=wait_for_at_least_one(net)
3114
+
time.sleep(1)
3115
+
try:
3116
+
net.get_committed_snapshots(
3117
+
net.find_primary()[0],
3118
+
force_txs=False,
3119
+
wait_for_target_seqno=True,
3120
+
timeout=5,
3121
+
)
3122
+
exceptTimeoutError:
3123
+
pass
3124
+
baseline=get_committed_snapshot_files(net)
3097
3125
time.sleep(10)
3098
-
after=get_snapshot_count(net)
3126
+
final=get_committed_snapshot_files(net)
3099
3127
assert (
3100
-
after==baseline
3101
-
), f"With a exact min_tx we expect to not see any extra snapshots, got {after-baseline}"
3128
+
final==baseline
3129
+
), f"With min_tx_interval set to 2 we expect no snapshots to be generated without transactions, but got {final} snapshots 10s after a baseline of {baseline}, with {final-baseline} new snapshots seen over the test."
3102
3130
3103
3131
# set much higher to show that
3104
3132
withnet_with_min_tx("_high", 10) asnet:
3105
-
baseline=wait_for_at_least_one(net)
3133
+
time.sleep(1)
3134
+
try:
3135
+
net.get_committed_snapshots(
3136
+
net.find_primary()[0],
3137
+
force_txs=False,
3138
+
wait_for_target_seqno=True,
3139
+
timeout=5,
3140
+
)
3141
+
exceptTimeoutError:
3142
+
pass
3143
+
baseline=get_committed_snapshot_files(net)
3106
3144
time.sleep(10)
3107
-
after=get_snapshot_count(net)
3145
+
final=get_committed_snapshot_files(net)
3108
3146
assert (
3109
-
after==baseline
3110
-
), f"Expect no snapshots when min_tx is high, got {after-baseline}"
3147
+
final==baseline
3148
+
), f"With min_tx_interval set to 10 we expect no snapshots to be generated without transactions, but got {final} snapshots 10s after a baseline of {baseline}, with {final-baseline} new snapshots seen over the test."
3111
3149
3112
-
net.txs.issue(net, number_txs=1)
3113
-
time.sleep(5)
3114
-
after=get_snapshot_count(net)
3150
+
tx_id=net.txs.issue(net, number_txs=1)
3151
+
baseline=get_committed_snapshot_files(net)
3152
+
time.sleep(10)
3153
+
final=get_committed_snapshot_files(net)
3115
3154
assert (
3116
-
after==baseline
3117
-
), f"Expect no snapshots when min_tx is high and only 1 tx issued, got {after-baseline}"
3155
+
final==baseline
3156
+
), f"With min_tx_interval set to 10 and we expect no snapshots to be generated with only one extra tx, but got {final} snapshots 10s after a baseline of {baseline}, and in total saw {final-baseline} new snapshots over the test."
3118
3157
3119
3158
net.txs.issue(net, number_txs=20)
3120
-
time.sleep(5)
3121
-
after=get_snapshot_count(net)
3122
-
assert (
3123
-
after>baseline
3124
-
), f"Expect at least one snapshot after issuing many txs, got {after-baseline}"
0 commit comments