11package org .lfdecentralizedtrust .splice .integration .tests
22
3- import better .files .File
43import org .apache .pekko .http .scaladsl .model .Uri
5- import org .lfdecentralizedtrust .splice .config .ConfigTransforms
64import org .lfdecentralizedtrust .splice .integration .EnvironmentDefinition
75import org .lfdecentralizedtrust .splice .integration .tests .SpliceTests .IntegrationTest
8- import org .lfdecentralizedtrust .splice .util .{ProcessTestUtil , WalletTestUtil }
6+ import org .lfdecentralizedtrust .splice .util .{ProcessTestUtil , StandaloneCanton , WalletTestUtil }
97import org .lfdecentralizedtrust .splice .unit .http .{
108 SystemProperties ,
119 SystemPropertiesSupport ,
1210 TinyProxySupport ,
1311}
1412
15- import scala .concurrent .duration .*
16-
1713class ValidatorProxyIntegrationTest
1814 extends IntegrationTest
1915 with WalletTestUtil
2016 with ProcessTestUtil
17+ with StandaloneCanton
2118 with TinyProxySupport
2219 with SystemPropertiesSupport {
20+
21+ override def dbsSuffix = " validator_proxy"
22+ val dbName = s " participant_alice_validator_ ${dbsSuffix}"
23+ override def usesDbs = Seq (dbName) ++ super .usesDbs
24+
25+ // Can sometimes be unhappy when doing funky `withCanton` things; disabling them for simplicity
2326 override protected def runTokenStandardCliSanityCheck : Boolean = false
2427 override protected def runUpdateHistorySanityCheck : Boolean = false
2528
29+ override def environmentDefinition : SpliceEnvironmentDefinition = {
30+ EnvironmentDefinition .simpleTopology1SvWithLocalValidator(this .getClass.getSimpleName)
31+ }
32+
2633 " validator should start and tap, using http forward proxy" in { implicit env =>
2734 val host = " 127.0.0.1"
2835 initDsoWithSv1Only()
@@ -37,22 +44,19 @@ class ValidatorProxyIntegrationTest
3744 .set(" https.nonProxyHosts" , " " )
3845 withProperties(props) {
3946 withCanton(
40- cantonArgs,
41- cantonExtraConfig,
47+ Seq (
48+ testResourcesPath / " standalone-participant-extra.conf"
49+ ),
50+ Seq .empty,
4251 " validator-proxy-test" ,
52+ " EXTRA_PARTICIPANT_ADMIN_USER" -> aliceValidatorLocalBackend.config.ledgerApiUser,
53+ " EXTRA_PARTICIPANT_DB" -> dbName,
4354 " JAVA_TOOL_OPTIONS" -> props.toJvmOptionString,
4455 ) {
45- aliceValidatorBackend.start()
46- clue(" Wait for validator initialization" ) {
47- // Need to wait for the participant node to startup for the user allocation to go through
48- eventuallySucceeds(timeUntilSuccess = 120 .seconds) {
49- EnvironmentDefinition .withAllocatedValidatorUser(aliceValidatorBackend)
50- }
51- aliceValidatorBackend.waitForInitialization()
52- }
56+ aliceValidatorLocalBackend.startSync()
5357 actAndCheck(
5458 " Onboard wallet user" ,
55- onboardWalletUser(aliceWalletClient, aliceValidatorBackend ),
59+ onboardWalletUser(aliceWalletClient, aliceValidatorLocalBackend ),
5660 )(
5761 " We can tap and list" ,
5862 _ => {
@@ -75,12 +79,12 @@ class ValidatorProxyIntegrationTest
7579 ) shouldBe true
7680 proxy.proxiedConnectRequest(
7781 host,
78- aliceValidatorBackend .config.clientAdminApi.port.unwrap,
82+ aliceValidatorLocalBackend .config.clientAdminApi.port.unwrap,
7983 ) shouldBe true
8084
8185 proxy.proxiedConnectRequest(
8286 host,
83- aliceValidatorBackend .participantClient.config.ledgerApi.port.unwrap,
87+ aliceValidatorLocalBackend .participantClient.config.ledgerApi.port.unwrap,
8488 ) shouldBe true
8589
8690 val sequencerPort = Uri (
@@ -99,36 +103,4 @@ class ValidatorProxyIntegrationTest
99103 }
100104 }
101105 }
102-
103- val includeTestResourcesPath : File = testResourcesPath / " include"
104-
105- val cantonArgs : Seq [File ] = Seq (
106- includeTestResourcesPath / " validator-participant.conf" ,
107- includeTestResourcesPath / " self-hosted-validator-disable-json-api.conf" ,
108- includeTestResourcesPath / " self-hosted-validator-participant-postgres-storage.conf" ,
109- includeTestResourcesPath / " storage-postgres.conf" ,
110- )
111- val cantonExtraConfig : Seq [String ] =
112- Seq (
113- " canton.participants.validatorParticipant.ledger-api.port=7501" ,
114- " canton.participants.validatorParticipant.admin-api.port=7502" ,
115- )
116- val ParticipantLedgerPort = 7501
117- val ParticipantAdminPort = 7502
118- override protected def extraPortsToWaitFor : Seq [(String , Int )] = Seq (
119- (" ParticipantLedgerApi" , ParticipantLedgerPort ),
120- (" ParticipantAdminApi" , ParticipantAdminPort ),
121- )
122-
123- override def environmentDefinition : SpliceEnvironmentDefinition = {
124- EnvironmentDefinition
125- .simpleTopology1Sv(this .getClass.getSimpleName)
126- .withPreSetup(_ => ())
127- .addConfigTransforms((_, conf) =>
128- ConfigTransforms .bumpSelfHostedParticipantPortsBy(2000 )(conf)
129- )
130- // Do not allocate validator users here, as we deal with all of them manually
131- .withAllocatedUsers(extraIgnoredValidatorPrefixes = Seq (" " ))
132- .withManualStart
133- }
134106}
0 commit comments