Fix test flackyness of acceptanceTestsPermissioning (#6384)

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
pull/6395/head
Fabio Di Fabio 11 months ago committed by GitHub
parent 945a44c598
commit c66054633d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      .circleci/config.yml
  2. 4
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/eth/EthConditions.java
  3. 40
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/eth/SyncingStatusCondition.java
  4. 7
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/cluster/Cluster.java
  5. 40
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/eth/EthSyncingTransaction.java
  6. 4
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/eth/EthTransactions.java
  7. 5
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/permissioning/NodeSmartContractPermissioningAcceptanceTest.java
  8. 5
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/permissioning/NodeSmartContractPermissioningV2AcceptanceTest.java
  9. 2
      acceptance-tests/tests/src/test/resources/permissioning/simple_permissioning_genesis.json
  10. 2
      acceptance-tests/tests/src/test/resources/permissioning/simple_permissioning_v2_genesis.json

@ -269,7 +269,7 @@ jobs:
- capture_test_logs
acceptanceTestsPermissioning:
executor: besu_executor_xl
executor: besu_executor_med
steps:
- prepare
- attach_workspace:
@ -278,7 +278,7 @@ jobs:
name: AcceptanceTests (Non-Mainnet)
no_output_timeout: 20m
command: |
./gradlew --no-daemon acceptanceTestPermissioning
./gradlew --no-daemon --max-workers=1 acceptanceTestPermissioning
- capture_test_results
- capture_test_logs
@ -428,12 +428,12 @@ workflows:
- acceptanceTestsPermissioning:
requires:
- assemble
- acceptanceTestsCliqueBft
- buildDocker:
requires:
- assemble
- buildArm64Docker:
requires:
- buildDocker
- assemble
- publish:
filters:

@ -77,6 +77,10 @@ public class EthConditions {
return new MiningStatusCondition(transactions.mining(), isMining);
}
public Condition syncingStatus(final boolean isSyncing) {
return new SyncingStatusCondition(transactions.syncing(), isSyncing);
}
public Condition expectNewPendingTransactions(
final BigInteger filterId, final List<String> transactionHashes) {
return new NewPendingTransactionFilterChangesCondition(

@ -0,0 +1,40 @@
/*
* Copyright Hyperledger Besu Contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.tests.acceptance.dsl.condition.eth;
import static org.assertj.core.api.Assertions.assertThat;
import org.hyperledger.besu.tests.acceptance.dsl.WaitUtils;
import org.hyperledger.besu.tests.acceptance.dsl.condition.Condition;
import org.hyperledger.besu.tests.acceptance.dsl.node.Node;
import org.hyperledger.besu.tests.acceptance.dsl.transaction.eth.EthSyncingTransaction;
public class SyncingStatusCondition implements Condition {
private final EthSyncingTransaction transaction;
private final boolean syncingMiningStatus;
public SyncingStatusCondition(
final EthSyncingTransaction transaction, final boolean syncingStatus) {
this.transaction = transaction;
this.syncingMiningStatus = syncingStatus;
}
@Override
public void verify(final Node node) {
WaitUtils.waitFor(
10, () -> assertThat(node.execute(transaction)).isEqualTo(syncingMiningStatus));
}
}

@ -86,11 +86,8 @@ public class Cluster implements AutoCloseable {
final Optional<? extends RunnableNode> bootnode = selectAndStartBootnode(nodes);
nodes.parallelStream()
.filter(
node -> {
LOG.info("starting non-bootnode {}", node.getName());
return bootnode.map(boot -> boot != node).orElse(true);
})
.filter(node -> bootnode.map(boot -> boot != node).orElse(true))
.peek(node -> LOG.info("starting non-bootnode {}", node.getName()))
.forEach(this::startNode);
if (clusterConfiguration.isAwaitPeerDiscovery()) {

@ -0,0 +1,40 @@
/*
* Copyright Hyperledger Besu Contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.tests.acceptance.dsl.transaction.eth;
import static org.assertj.core.api.Assertions.assertThat;
import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests;
import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction;
import java.io.IOException;
import org.web3j.protocol.core.methods.response.EthSyncing;
public class EthSyncingTransaction implements Transaction<Boolean> {
EthSyncingTransaction() {}
@Override
public Boolean execute(final NodeRequests node) {
try {
EthSyncing response = node.eth().ethSyncing().send();
assertThat(response).isNotNull();
return response.isSyncing();
} catch (final IOException e) {
throw new RuntimeException(e);
}
}
}

@ -73,6 +73,10 @@ public class EthTransactions {
return new EthMiningTransaction();
}
public EthSyncingTransaction syncing() {
return new EthSyncingTransaction();
}
public EthNewPendingTransactionFilterTransaction newPendingTransactionsFilter() {
return new EthNewPendingTransactionFilterTransaction();
}

@ -49,6 +49,11 @@ public class NodeSmartContractPermissioningAcceptanceTest
permissionedNode.verify(admin.addPeer(bootnode));
permissionedNode.verify(admin.addPeer(allowedNode));
allowedNode.verify(eth.syncingStatus(false));
bootnode.verify(eth.syncingStatus(false));
permissionedNode.verify(eth.syncingStatus(false));
forbiddenNode.verify(eth.syncingStatus(false));
}
@Test

@ -46,6 +46,11 @@ public class NodeSmartContractPermissioningV2AcceptanceTest
permissionedNode.execute(allowNode(permissionedNode));
permissionedNode.verify(connectionIsAllowed(permissionedNode));
allowedNode.verify(eth.syncingStatus(false));
bootnode.verify(eth.syncingStatus(false));
permissionedNode.verify(eth.syncingStatus(false));
forbiddenNode.verify(eth.syncingStatus(false));
}
@Test

@ -4,7 +4,7 @@
"londonBlock": 0,
"zeroBaseFee": true,
"ethash": {
"fixeddifficulty": 100
"fixeddifficulty": 500
}
},
"nonce": "0x42",

@ -4,7 +4,7 @@
"londonBlock": 0,
"zeroBaseFee": true,
"ethash": {
"fixeddifficulty": 100
"fixeddifficulty": 500
}
},
"nonce": "0x42",

Loading…
Cancel
Save