Skip to content

Commit

Permalink
Add query tests to StressPanel
Browse files Browse the repository at this point in the history
  • Loading branch information
mikera committed May 1, 2024
1 parent 620f385 commit b3fc52a
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions convex-gui/src/main/java/convex/gui/peer/windows/StressPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public class StressPanel extends JPanel {
private JCheckBox syncCheckBox;
private JCheckBox distCheckBox;
private JCheckBox repeatCheckBox;
private JCheckBox queryCheckBox;

private JSplitPane splitPane;
private JPanel resultPanel;
Expand Down Expand Up @@ -145,6 +146,11 @@ public StressPanel(Convex peerView) {
optionPanel.add(repeatCheckBox);
repeatCheckBox.setSelected(false);

optionPanel.add(new JLabel("Query"));
queryCheckBox=new JCheckBox();
optionPanel.add(queryCheckBox);
queryCheckBox.setSelected(false);

optionPanel.add(new JLabel("Repeat timeout"));
repeatTimeSpinner = new JSpinner();
repeatTimeSpinner.setModel(new SpinnerNumberModel(60, 0, 3600, 1));
Expand Down Expand Up @@ -259,11 +265,20 @@ protected String doStressRun() throws Exception {
ATransaction t = buildTransaction(origin, i);

CompletableFuture<Result> fr;
if (syncCheckBox.isSelected()) {
Result r=cc.transactSync(t);
fr=CompletableFuture.completedFuture(r);
} else {
fr = cc.transact(t);
if (queryCheckBox.isSelected()) {
if (syncCheckBox.isSelected()) {
Result r=cc.querySync(t);
fr=CompletableFuture.completedFuture(r);
} else {
fr = cc.query(t);
}
} else {
if (syncCheckBox.isSelected()) {
Result r=cc.transactSync(t);
fr=CompletableFuture.completedFuture(r);
} else {
fr = cc.transact(t);
}
}
synchronized(frs) {
// synchronised so we don't collide with other threads
Expand Down

0 comments on commit b3fc52a

Please sign in to comment.