Skip to content

Commit a5b0746

Browse files
canton-network-daDA Automation
andauthored
[ci] Update Splice from CCI (#424)
Signed-off-by: DA Automation <splice-maintainers@digitalasset.com> Co-authored-by: DA Automation <splice-maintainers@digitalasset.com>
1 parent 4f8d2c3 commit a5b0746

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1649
-28
lines changed

.github/workflows/build.scala_test_for_compose.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
start_canton_options:
66
type: string
77
required: true
8+
with_canton:
9+
type: boolean
10+
required: false
11+
default: true
812
runs_on:
913
type: string
1014
required: true
@@ -94,3 +98,4 @@ jobs:
9498
failure_notifications_invoker_sa: ${{ secrets.FAILURE_NOTIFICATIONS_INVOKER_SA }}
9599
failure_notifications_invoker_url: ${{ secrets.FAILURE_NOTIFICATIONS_INVOKER_URL }}
96100
failure_notifications_slack_channel: ${{ secrets.FAILURE_NOTIFICATIONS_SLACK_CHANNEL }}
101+
with_canton: ${{ inputs.with_canton }}

.github/workflows/build.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,17 @@ jobs:
171171
commit_sha: ${{ inputs.commit_sha }}
172172
secrets: inherit
173173

174+
scala_test_local_net:
175+
uses: ./.github/workflows/build.scala_test_for_compose.yml
176+
with:
177+
runs_on: self-hosted-docker-large
178+
test_names_file: 'test-full-class-names-local-net-based.log'
179+
parallelism: 1
180+
test_name: docker-compose
181+
with_canton: false
182+
start_canton_options: ""
183+
secrets: inherit
184+
174185
scala_test_app_upgrade:
175186
uses: ./.github/workflows/build.scala_test.yml
176187
with:
@@ -232,6 +243,7 @@ jobs:
232243
- scala_test_frontend_wall_clock_time
233244
- scala_test_frontend_simtime
234245
- scala_test_docker_compose
246+
- scala_test_local_net
235247
- scala_test_app_upgrade
236248
- scala_test_without_canton
237249
- ui_tests

.github/workflows/ciupgrade.yml

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,8 @@ on:
66

77
jobs:
88
trigger_ciupgrade:
9-
# TODO(#19109): re-enable ciupgrade
10-
# uses: ./.github/workflows/cluster_tests.yml
11-
# secrets: inherit
12-
# with:
13-
# workflow: deploy_ciupgrade
14-
# sha: ${{ github.sha }}
15-
16-
17-
runs-on: self-hosted-docker-tiny
18-
name: Trigger CIUpgrade deployment
19-
steps:
20-
- name: Trigger CIUpgrade deployment
21-
shell: bash
22-
run: |
23-
echo "CIUpgrade deployments are currently disabled"
24-
exit 0
9+
uses: ./.github/workflows/cluster_tests.yml
10+
secrets: inherit
11+
with:
12+
workflow: deploy_ciupgrade
13+
sha: ${{ github.sha }}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
package org.lfdecentralizedtrust.splice.integration.tests
2+
3+
import org.lfdecentralizedtrust.splice.integration.EnvironmentDefinition
4+
import org.lfdecentralizedtrust.splice.util.{FrontendLoginUtil, WalletFrontendTestUtil}
5+
6+
import scala.concurrent.duration.*
7+
import scala.sys.process.*
8+
9+
class LocalNetFrontendIntegrationTest
10+
extends FrontendIntegrationTest("frontend")
11+
with FrontendLoginUtil
12+
with WalletFrontendTestUtil {
13+
override def environmentDefinition: SpliceEnvironmentDefinition =
14+
EnvironmentDefinition.empty(this.getClass.getSimpleName)
15+
16+
override lazy val resetRequiredTopologyState = false
17+
18+
val partyHint = "localnet-localparty-1"
19+
20+
"docker-compose based localnet work" in { implicit env =>
21+
try {
22+
val ret = Seq("build-tools/splice-localnet-compose.sh", "start").!
23+
if (ret != 0) {
24+
fail("Failed to start docker-compose SV and validator")
25+
}
26+
27+
clue("Test validators") {
28+
List(
29+
("app-user", 2000, "app_user"),
30+
("app-provider", 3000, "app_provider"),
31+
).foreach { case (user, port, partyHintPrefix) =>
32+
clue(s"Test $user validator") {
33+
val host = "wallet.localhost"
34+
val url = s"http://$host:$port"
35+
withFrontEnd("frontend") { implicit webDriver =>
36+
eventuallySucceeds()(go to url)
37+
actAndCheck(timeUntilSuccess = 60.seconds)(
38+
s"Login as $user",
39+
login(port, user, host),
40+
)(
41+
s"$user is already onboarded",
42+
_ =>
43+
seleniumText(find(id("logged-in-user"))) should startWith(
44+
s"${partyHintPrefix}_$partyHint"
45+
),
46+
)
47+
// Wait for some traffic to be bought before proceeding so that we don't hit a "traffic below reserved amount" error
48+
waitForTrafficPurchase()
49+
go to url
50+
actAndCheck(
51+
s"Login as $user",
52+
loginOnCurrentPage(port, user, host),
53+
)(
54+
s"$user is already onboarded",
55+
_ =>
56+
seleniumText(find(id("logged-in-user"))) should startWith(
57+
s"${partyHintPrefix}_$partyHint"
58+
),
59+
)
60+
tapAmulets(345.6)
61+
}
62+
}
63+
}
64+
65+
clue("Basic test of SV UIs") {
66+
withFrontEnd("frontend") { implicit webDriver =>
67+
actAndCheck(
68+
"Open the Scan UI",
69+
go to "scan.localhost:4000",
70+
)(
71+
"Open rounds should be listed",
72+
_ => findAll(className("open-mining-round-row")) should have length 2,
73+
)
74+
75+
actAndCheck(timeUntilSuccess = 60.seconds)(
76+
"Login to the wallet as sv",
77+
login(4000, "sv", "wallet.localhost"),
78+
)(
79+
"sv is already onboarded",
80+
_ => seleniumText(find(id("logged-in-user"))) should startWith("sv.sv.ans"),
81+
)
82+
83+
actAndCheck()(
84+
"Login to the SV app as sv",
85+
login(4000, "sv", "sv.localhost"),
86+
)(
87+
"sv is already onboarded, and the app is working",
88+
_ => {
89+
seleniumText(
90+
find(id("svUser")).value
91+
.childElement(className("general-dso-value-name"))
92+
) should be("ledger-api-user")
93+
},
94+
)
95+
96+
}
97+
}
98+
}
99+
} finally {
100+
Seq("build-tools/splice-localnet-compose.sh", "stop", "-D").!
101+
}
102+
}
103+
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
set -eou pipefail
7+
8+
# Ensure all background jobs are killed when the script exits
9+
trap 'kill $(jobs -p) 2>/dev/null' EXIT
10+
exec > >(tee -a "${SPLICE_ROOT}/log/console.log") 2>&1
11+
12+
# shellcheck disable=SC1091
13+
source "${TOOLS_LIB}/libcli.source"
14+
SCRIPTNAME=${0##*/}
15+
16+
LOCALNET_DIR="${SPLICE_ROOT}/cluster/compose/localnet"
17+
export LOCALNET_DIR
18+
19+
IMAGE_TAG=$("${SPLICE_ROOT}/build-tools/get-snapshot-version")
20+
export IMAGE_TAG
21+
IMAGE_REPO=""
22+
export IMAGE_REPO
23+
24+
# the port will be assigned by docker
25+
TEST_PORT=""
26+
export TEST_PORT
27+
28+
if [[ $# -lt 1 || $# -gt 2 ]]; then
29+
echo "Usage: $SCRIPTNAME <start|stop> [-D]"
30+
exit 1
31+
fi
32+
33+
ACTION=$1
34+
35+
DOCKER_COMPOSE_CMD=( docker compose
36+
--env-file "$LOCALNET_DIR/compose.env"
37+
--env-file "$LOCALNET_DIR/env/common.env"
38+
--env-file "$LOCALNET_DIR/env/local.env"
39+
-f "$LOCALNET_DIR/compose.yaml"
40+
-f "$LOCALNET_DIR/resource-constraints.yaml"
41+
--profile sv
42+
--profile app-provider
43+
--profile app-user
44+
)
45+
46+
case $ACTION in
47+
start)
48+
if [[ $# -ne 1 ]]; then
49+
echo "Usage: $SCRIPTNAME <start|stop> [-D]"
50+
exit 1
51+
fi
52+
services_to_log=( canton splice postgres nginx )
53+
docker events -f type=container \
54+
-f event=start \
55+
-f event=stop \
56+
-f event=restart \
57+
-f event=kill \
58+
-f event=die \
59+
-f event=destroy \
60+
-f event=health_status \
61+
-f event=oom \
62+
--format '{{.ID}} {{.Time}} {{.Actor.Attributes.name}} {{.Status}}' | while read -r cid time service_name status; do
63+
if [[ -n "$service_name" ]]; then
64+
for svc in "${services_to_log[@]}"; do
65+
if [[ "$svc" == "$service_name" ]]; then
66+
echo "$(date -u -d "@$time" +"%Y-%m-%dT%H:%M:%S") $service_name $status"
67+
if [ "$status" = "start" ]; then
68+
echo " capture logs $service_name"
69+
docker logs -f "$cid" >> "${SPLICE_ROOT}/log/compose-localnet-$service_name.clog" 2>&1 &
70+
fi
71+
break
72+
fi
73+
done
74+
fi
75+
done >> "${SPLICE_ROOT}/log/compose.log" 2>&1 &
76+
77+
"${DOCKER_COMPOSE_CMD[@]}" up -d || _error "Failed to start localnet, please check ${SPLICE_ROOT}/log/console.log for details"
78+
;;
79+
stop)
80+
if [[ $# -eq 2 && $2 == "-D" ]]; then
81+
"${DOCKER_COMPOSE_CMD[@]}" down -v
82+
elif [[ $# -eq 1 ]]; then
83+
"${DOCKER_COMPOSE_CMD[@]}" stop
84+
else
85+
echo "Usage: $SCRIPTNAME <start|stop> [-D]"
86+
exit 1
87+
fi
88+
;;
89+
*)
90+
echo "Invalid action: $ACTION. Use 'start' or 'stop'."
91+
exit 1
92+
;;
93+
esac

build.sbt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,6 +1821,8 @@ printTests := {
18211821
name.contains("SvOffboardingIntegrationTest")
18221822
def isDockerComposeBasedTest(name: String): Boolean =
18231823
name contains "DockerCompose"
1824+
def isLocalNetTest(name: String): Boolean =
1825+
name contains "LocalNet"
18241826
def isCometBftTest(name: String): Boolean =
18251827
name contains "CometBft"
18261828
def isRecordTimeToleranceTest(name: String): Boolean =
@@ -1920,6 +1922,11 @@ printTests := {
19201922
"test-full-class-names-resource-intensive.log",
19211923
(t: String) => isResourceIntensiveTest(t),
19221924
),
1925+
(
1926+
"tests for localnet",
1927+
"test-full-class-names-local-net-based.log",
1928+
(t: String) => isLocalNetTest(t),
1929+
),
19231930
(
19241931
"tests using docker images",
19251932
"test-full-class-names-docker-based.log",

0 commit comments

Comments
 (0)