Skip to content

Commit

Permalink
services/horizon/internal/integration: Add load test which generates …
Browse files Browse the repository at this point in the history
…ledgers loaded with soroban Tx Meta (stellar#5556)
  • Loading branch information
tamirms authored Jan 8, 2025
1 parent 2999e29 commit bd9fa3f
Show file tree
Hide file tree
Showing 27 changed files with 938 additions and 466 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/horizon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,9 @@ jobs:
HORIZON_INTEGRATION_TESTS_ENABLED: true
HORIZON_INTEGRATION_TESTS_CORE_MAX_SUPPORTED_PROTOCOL: ${{ matrix.protocol-version }}
HORIZON_INTEGRATION_TESTS_CAPTIVE_CORE_USE_DB: true
PROTOCOL_21_CORE_DEBIAN_PKG_VERSION: 21.3.1-2007.4ede19620.focal
PROTOCOL_21_CORE_DOCKER_IMG: stellar/stellar-core:21.3.1-2007.4ede19620.focal
PROTOCOL_21_SOROBAN_RPC_DOCKER_IMG: stellar/soroban-rpc:21.5.1
PROTOCOL_22_CORE_DEBIAN_PKG_VERSION: 22.1.0-2194.0241e79f7.focal
PROTOCOL_22_CORE_DOCKER_IMG: stellar/stellar-core:22.1.0-2194.0241e79f7.focal
PROTOCOL_22_SOROBAN_RPC_DOCKER_IMG: stellar/soroban-rpc:22.0.0-rc3-101
PROTOCOL_22_STELLAR_RPC_DOCKER_IMG: stellar/stellar-rpc:22.1.1
PGHOST: localhost
PGPORT: 5432
PGUSER: postgres
Expand Down Expand Up @@ -73,11 +70,11 @@ jobs:
docker pull "$PROTOCOL_${{ matrix.protocol-version }}_CORE_DOCKER_IMG"
echo HORIZON_INTEGRATION_TESTS_DOCKER_IMG="$PROTOCOL_${{ matrix.protocol-version }}_CORE_DOCKER_IMG" >> $GITHUB_ENV
- name: Pull and set Soroban RPC image
- name: Pull and set Stellar RPC image
shell: bash
run: |
docker pull "$PROTOCOL_${{ matrix.protocol-version }}_SOROBAN_RPC_DOCKER_IMG"
echo HORIZON_INTEGRATION_TESTS_SOROBAN_RPC_DOCKER_IMG="$PROTOCOL_${{ matrix.protocol-version }}_SOROBAN_RPC_DOCKER_IMG" >> $GITHUB_ENV
docker pull "$PROTOCOL_${{ matrix.protocol-version }}_STELLAR_RPC_DOCKER_IMG"
echo HORIZON_INTEGRATION_TESTS_STELLAR_RPC_DOCKER_IMG="$PROTOCOL_${{ matrix.protocol-version }}_STELLAR_RPC_DOCKER_IMG" >> $GITHUB_ENV
- name: Install core
run: |
Expand Down
4 changes: 2 additions & 2 deletions ingest/change.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (c Change) String() string {
)
}

func (c Change) ledgerKey() (xdr.LedgerKey, error) {
func (c Change) LedgerKey() (xdr.LedgerKey, error) {
if c.Pre != nil {
return c.Pre.LedgerKey()
}
Expand Down Expand Up @@ -182,7 +182,7 @@ type sortableChanges struct {
func newSortableChanges(changes []Change) sortableChanges {
ledgerKeys := make([][]byte, len(changes))
for i, c := range changes {
lk, err := c.ledgerKey()
lk, err := c.LedgerKey()
if err != nil {
panic(err)
}
Expand Down
19 changes: 0 additions & 19 deletions services/horizon/docker/captive-core-integration-tests.cfg

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

29 changes: 16 additions & 13 deletions services/horizon/docker/docker-compose.integration-tests.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
version: '3'
services:
core-postgres:
image: postgres:9.6.17-alpine
restart: on-failure
environment:
- POSTGRES_PASSWORD=mysecretpassword
- POSTGRES_DB=stellar
ports:
- "5641:5641"
command: ["-p", "5641"]
core:
platform: linux/amd64
# Note: Please keep the image pinned to an immutable tag matching the Captive Core version.
# This avoid implicit updates which break compatibility between
# the Core container and captive core.
image: ${CORE_IMAGE:-stellar/stellar-core:19.13.1-1481.3acf6dd26.focal}

depends_on:
- core-postgres
restart: on-failure
environment:
- TRACY_NO_INVARIANT_CHECK=1
Expand All @@ -29,5 +17,20 @@ services:
entrypoint: /usr/bin/env
command: /start standalone
volumes:
- ./${CORE_CONFIG_FILE:-stellar-core-integration-tests.cfg}:/stellar-core.cfg
- ${CORE_CONFIG_FILE}:/stellar-core.cfg
- ./core-start.sh:/start
stellar-rpc:
platform: linux/amd64
image: ${STELLAR_RPC_IMAGE:-stellar/stellar-rpc}
restart: on-failure
ports:
- "8080:8080"
environment:
- ENDPOINT=:8080
- NETWORK_PASSPHRASE=Standalone Network ; February 2017
- CAPTIVE_CORE_CONFIG_PATH=/captive-core.cfg
- HISTORY_ARCHIVE_URLS=http://core:1570
- CHECKPOINT_FREQUENCY=8
- LOG_LEVEL=debug
volumes:
- ${CAPTIVE_CORE_CONFIG_FILE}:/captive-core.cfg
25 changes: 0 additions & 25 deletions services/horizon/docker/stellar-core-classic-integration-tests.cfg

This file was deleted.

30 changes: 0 additions & 30 deletions services/horizon/docker/stellar-core-integration-tests.cfg

This file was deleted.

16 changes: 9 additions & 7 deletions services/horizon/internal/integration/change_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,27 @@ package integration

import (
"context"
"io"
"sort"
"testing"
"time"

"github.com/stretchr/testify/assert"

"github.com/stellar/go/ingest"
"github.com/stellar/go/ingest/ledgerbackend"
"github.com/stellar/go/keypair"
"github.com/stellar/go/services/horizon/internal/test/integration"
"github.com/stellar/go/txnbuild"
"github.com/stellar/go/xdr"
"github.com/stretchr/testify/assert"
"io"
"sort"
"testing"
"time"
)

func TestProtocolUpgradeChanges(t *testing.T) {
tt := assert.New(t)
itest := integration.NewTest(t, integration.Config{SkipHorizonStart: true})

upgradedLedgerAppx, _ := itest.GetUpgradedLedgerSeqAppx()
waitForLedgerInArchive(t, 15*time.Second, upgradedLedgerAppx)
waitForLedgerInArchive(t, 6*time.Minute, upgradedLedgerAppx)

ledgerSeqToLedgers := getLedgers(itest, 2, upgradedLedgerAppx)

Expand Down Expand Up @@ -61,7 +63,7 @@ func TestOneTxOneOperationChanges(t *testing.T) {
tt.NoError(err)

ledgerSeq := uint32(txResp.Ledger)
waitForLedgerInArchive(t, 15*time.Second, ledgerSeq)
waitForLedgerInArchive(t, 6*time.Minute, ledgerSeq)

ledger := getLedgers(itest, ledgerSeq, ledgerSeq)[ledgerSeq]
changes := getChangesFromLedger(itest, ledger)
Expand Down
Loading

0 comments on commit bd9fa3f

Please sign in to comment.