From 5fda6e52382f67670c70c0025f6cca359a59d9f9 Mon Sep 17 00:00:00 2001 From: Hellblazer Date: Sun, 28 Apr 2024 09:12:24 -0700 Subject: [PATCH] fix test params --- .../apollo/choam/fsm/Reconfiguration.java | 5 ++ .../apollo/model/ContainmentDomainTest.java | 50 +++++++++++-------- .../salesforce/apollo/model/DomainTest.java | 50 ++++++++++++------- .../apollo/model/FireFliesTest.java | 50 +++++++++++-------- 4 files changed, 95 insertions(+), 60 deletions(-) diff --git a/choam/src/main/java/com/salesforce/apollo/choam/fsm/Reconfiguration.java b/choam/src/main/java/com/salesforce/apollo/choam/fsm/Reconfiguration.java index f43dbb999..7161c29fd 100644 --- a/choam/src/main/java/com/salesforce/apollo/choam/fsm/Reconfiguration.java +++ b/choam/src/main/java/com/salesforce/apollo/choam/fsm/Reconfiguration.java @@ -109,6 +109,11 @@ public void viewConsensus() { public Transitions viewAcquired() { return GATHER; } + + @Override + public Transitions proposed() { + return null; + } } } diff --git a/model/src/test/java/com/salesforce/apollo/model/ContainmentDomainTest.java b/model/src/test/java/com/salesforce/apollo/model/ContainmentDomainTest.java index 5dd3cbf23..7e990623c 100644 --- a/model/src/test/java/com/salesforce/apollo/model/ContainmentDomainTest.java +++ b/model/src/test/java/com/salesforce/apollo/model/ContainmentDomainTest.java @@ -11,13 +11,14 @@ import com.salesforce.apollo.archipelago.ServerConnectionCache; import com.salesforce.apollo.choam.Parameters; import com.salesforce.apollo.choam.Parameters.Builder; -import com.salesforce.apollo.choam.Parameters.ProducerParameters; import com.salesforce.apollo.choam.Parameters.RuntimeParameters; import com.salesforce.apollo.choam.proto.FoundationSeal; +import com.salesforce.apollo.choam.support.ExponentialBackoffPolicy; import com.salesforce.apollo.context.DynamicContextImpl; import com.salesforce.apollo.cryptography.Digest; import com.salesforce.apollo.cryptography.DigestAlgorithm; import com.salesforce.apollo.delphinius.Oracle; +import com.salesforce.apollo.ethereal.Config; import com.salesforce.apollo.membership.stereotomy.ControlledIdentifierMember; import com.salesforce.apollo.stereotomy.StereotomyImpl; import com.salesforce.apollo.stereotomy.identifier.spec.IdentifierSpecification; @@ -90,13 +91,11 @@ public void before() throws Exception { "jdbc:h2:mem:%s-state".formatted(d), checkpointDirBase, Duration.ofMillis(10), 0.00125, Duration.ofMinutes(1), 3, 10, 0.1); - var domain = new ProcessContainerDomain(group, member, pdParams, params, RuntimeParameters.newBuilder() - .setFoundation( - sealed) - .setContext( - context) - .setCommunications( - localRouter), + var domain = new ProcessContainerDomain(group, member, pdParams, params.clone(), + RuntimeParameters.newBuilder() + .setFoundation(sealed) + .setContext(context) + .setCommunications(localRouter), new InetSocketAddress(0), commsDirectory, ffParams, IdentifierSpecification.newBuilder(), null); domains.add(domain); @@ -120,18 +119,27 @@ public void smoke() throws Exception { } private Builder params() { - var params = Parameters.newBuilder() - .setGenerateGenesis(true) - .setGenesisViewId(GENESIS_VIEW_ID) - .setGossipDuration(Duration.ofMillis(10)) - .setProducer(ProducerParameters.newBuilder() - .setGossipDuration(Duration.ofMillis(20)) - .setBatchInterval(Duration.ofMillis(100)) - .setMaxBatchByteSize(1024 * 1024) - .setMaxBatchCount(3000) - .build()) - .setCheckpointBlockDelta(200); - params.getProducer().ethereal().setEpochLength(4).setNumberOfEpochs(4); - return params; + var template = Parameters.newBuilder() + .setGenerateGenesis(true) + .setGenesisViewId(GENESIS_VIEW_ID) + .setBootstrap(Parameters.BootstrapParameters.newBuilder() + .setGossipDuration(Duration.ofMillis(50)) + .build()) + .setGenesisViewId(DigestAlgorithm.DEFAULT.getOrigin()) + .setGossipDuration(Duration.ofMillis(50)) + .setProducer(Parameters.ProducerParameters.newBuilder() + .setGossipDuration(Duration.ofMillis(50)) + .setBatchInterval(Duration.ofMillis(50)) + .setMaxBatchByteSize(1024 * 1024) + .setMaxBatchCount(10_000) + .setEthereal(Config.newBuilder() + .setNumberOfEpochs(3) + .setEpochLength(7)) + .build()) + .setCheckpointBlockDelta(200) + .setDrainPolicy(ExponentialBackoffPolicy.newBuilder() + .setInitialBackoff(Duration.ofMillis(1)) + .setMaxBackoff(Duration.ofMillis(1))); + return template; } } diff --git a/model/src/test/java/com/salesforce/apollo/model/DomainTest.java b/model/src/test/java/com/salesforce/apollo/model/DomainTest.java index 45a6e9e47..3450e04c7 100644 --- a/model/src/test/java/com/salesforce/apollo/model/DomainTest.java +++ b/model/src/test/java/com/salesforce/apollo/model/DomainTest.java @@ -11,14 +11,15 @@ import com.salesforce.apollo.archipelago.ServerConnectionCache; import com.salesforce.apollo.choam.Parameters; import com.salesforce.apollo.choam.Parameters.Builder; -import com.salesforce.apollo.choam.Parameters.ProducerParameters; import com.salesforce.apollo.choam.Parameters.RuntimeParameters; import com.salesforce.apollo.choam.proto.FoundationSeal; +import com.salesforce.apollo.choam.support.ExponentialBackoffPolicy; import com.salesforce.apollo.context.DynamicContextImpl; import com.salesforce.apollo.cryptography.Digest; import com.salesforce.apollo.cryptography.DigestAlgorithm; import com.salesforce.apollo.delphinius.Oracle; import com.salesforce.apollo.delphinius.Oracle.Assertion; +import com.salesforce.apollo.ethereal.Config; import com.salesforce.apollo.membership.stereotomy.ControlledIdentifierMember; import com.salesforce.apollo.stereotomy.StereotomyImpl; import com.salesforce.apollo.stereotomy.mem.MemKERL; @@ -220,11 +221,13 @@ public void before() throws Exception { "jdbc:h2:mem:%s-state;DB_CLOSE_DELAY=-1".formatted( d), checkpointDirBase, Duration.ofMillis(10), 0.00125, Duration.ofMinutes(1), 3, 10, 0.1); - var domain = new ProcessDomain(group, member, pdParams, params, RuntimeParameters.newBuilder() - .setFoundation(sealed) - .setContext(context) - .setCommunications( - localRouter), + var domain = new ProcessDomain(group, member, pdParams, params.clone(), RuntimeParameters.newBuilder() + .setFoundation( + sealed) + .setContext( + context) + .setCommunications( + localRouter), new InetSocketAddress(0), ffParams, null); domains.add(domain); localRouter.start(); @@ -247,18 +250,27 @@ public void smoke() throws Exception { } private Builder params() { - var params = Parameters.newBuilder() - .setGenerateGenesis(true) - .setGenesisViewId(GENESIS_VIEW_ID) - .setGossipDuration(Duration.ofMillis(10)) - .setProducer(ProducerParameters.newBuilder() - .setGossipDuration(Duration.ofMillis(20)) - .setBatchInterval(Duration.ofMillis(100)) - .setMaxBatchByteSize(1024 * 1024) - .setMaxBatchCount(3000) - .build()) - .setCheckpointBlockDelta(200); - params.getProducer().ethereal().setEpochLength(7).setNumberOfEpochs(3); - return params; + var template = Parameters.newBuilder() + .setGenerateGenesis(true) + .setGenesisViewId(GENESIS_VIEW_ID) + .setBootstrap(Parameters.BootstrapParameters.newBuilder() + .setGossipDuration(Duration.ofMillis(50)) + .build()) + .setGenesisViewId(DigestAlgorithm.DEFAULT.getOrigin()) + .setGossipDuration(Duration.ofMillis(50)) + .setProducer(Parameters.ProducerParameters.newBuilder() + .setGossipDuration(Duration.ofMillis(50)) + .setBatchInterval(Duration.ofMillis(50)) + .setMaxBatchByteSize(1024 * 1024) + .setMaxBatchCount(10_000) + .setEthereal(Config.newBuilder() + .setNumberOfEpochs(3) + .setEpochLength(7)) + .build()) + .setCheckpointBlockDelta(200) + .setDrainPolicy(ExponentialBackoffPolicy.newBuilder() + .setInitialBackoff(Duration.ofMillis(1)) + .setMaxBackoff(Duration.ofMillis(1))); + return template; } } diff --git a/model/src/test/java/com/salesforce/apollo/model/FireFliesTest.java b/model/src/test/java/com/salesforce/apollo/model/FireFliesTest.java index 509577801..f492fa0e0 100644 --- a/model/src/test/java/com/salesforce/apollo/model/FireFliesTest.java +++ b/model/src/test/java/com/salesforce/apollo/model/FireFliesTest.java @@ -11,14 +11,15 @@ import com.salesforce.apollo.archipelago.ServerConnectionCache; import com.salesforce.apollo.choam.Parameters; import com.salesforce.apollo.choam.Parameters.Builder; -import com.salesforce.apollo.choam.Parameters.ProducerParameters; import com.salesforce.apollo.choam.Parameters.RuntimeParameters; import com.salesforce.apollo.choam.proto.FoundationSeal; +import com.salesforce.apollo.choam.support.ExponentialBackoffPolicy; import com.salesforce.apollo.context.Context; import com.salesforce.apollo.context.DynamicContextImpl; import com.salesforce.apollo.cryptography.Digest; import com.salesforce.apollo.cryptography.DigestAlgorithm; import com.salesforce.apollo.delphinius.Oracle; +import com.salesforce.apollo.ethereal.Config; import com.salesforce.apollo.fireflies.View.Seed; import com.salesforce.apollo.membership.stereotomy.ControlledIdentifierMember; import com.salesforce.apollo.stereotomy.StereotomyImpl; @@ -89,11 +90,12 @@ public void before() throws Exception { "jdbc:h2:mem:%s-state".formatted(digest), checkpointDirBase, Duration.ofMillis(10), 0.00125, Duration.ofSeconds(5), 3, 10, 0.1); - var node = new ProcessDomain(group, member, pdParams, params, RuntimeParameters.newBuilder() - .setFoundation(sealed) - .setContext(context) - .setCommunications( - localRouter), + var node = new ProcessDomain(group, member, pdParams, params.clone(), RuntimeParameters.newBuilder() + .setFoundation( + sealed) + .setContext(context) + .setCommunications( + localRouter), new InetSocketAddress(0), ffParams, null); domains.add(node); routers.put(node, localRouter); @@ -169,19 +171,27 @@ public void smokin() throws Exception { } private Builder params() { - var params = Parameters.newBuilder() - .setGenerateGenesis(true) - .setGenesisViewId(GENESIS_VIEW_ID) - .setGossipDuration(Duration.ofMillis(50)) - .setProducer(ProducerParameters.newBuilder() - .setGossipDuration(Duration.ofMillis(50)) - .setBatchInterval(Duration.ofMillis(100)) - .setMaxBatchByteSize(1024 * 1024) - .setMaxBatchCount(3000) - .build()) - .setCheckpointBlockDelta(200); - - params.getProducer().ethereal().setEpochLength(7).setNumberOfEpochs(3); - return params; + var template = Parameters.newBuilder() + .setGenerateGenesis(true) + .setGenesisViewId(GENESIS_VIEW_ID) + .setBootstrap(Parameters.BootstrapParameters.newBuilder() + .setGossipDuration(Duration.ofMillis(50)) + .build()) + .setGenesisViewId(DigestAlgorithm.DEFAULT.getOrigin()) + .setGossipDuration(Duration.ofMillis(50)) + .setProducer(Parameters.ProducerParameters.newBuilder() + .setGossipDuration(Duration.ofMillis(50)) + .setBatchInterval(Duration.ofMillis(50)) + .setMaxBatchByteSize(1024 * 1024) + .setMaxBatchCount(10_000) + .setEthereal(Config.newBuilder() + .setNumberOfEpochs(3) + .setEpochLength(7)) + .build()) + .setCheckpointBlockDelta(200) + .setDrainPolicy(ExponentialBackoffPolicy.newBuilder() + .setInitialBackoff(Duration.ofMillis(1)) + .setMaxBackoff(Duration.ofMillis(1))); + return template; } }