Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix e2e tests after soroban-rpc -> stellar-rpc rename #333

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
# the soroban CLI & RPC source code to compile and run from system test
# refers to checked out source of current git hub ref context
SYSTEM_TEST_SOROBAN_CLI_REF: https://github.com/stellar/soroban-cli.git\#main
SYSTEM_TEST_SOROBAN_RPC_REF: ${{ github.workspace }}/stellar-rpc
SYSTEM_TEST_STELLAR_RPC_REF: ${{ github.workspace }}/stellar-rpc

# core git ref should be latest commit for stable soroban functionality
# the core bin can either be compiled in-line here as part of ci,
Expand Down Expand Up @@ -54,8 +54,7 @@ jobs:

# system test will build quickstart image internally to use for running the service stack
# configured in standalone network mode(core, rpc)
SYSTEM_TEST_QUICKSTART_GIT_REF: https://github.com/stellar/quickstart.git#ae7fdb07283a0af836d4cd51ff09b02db93fb12c

SYSTEM_TEST_QUICKSTART_GIT_REF: https://github.com/stellar/quickstart.git#1a831b2350dd3928b60eb745d0862ee19dd2aaaa
# triggers system test to log out details from quickstart's logs and test steps
SYSTEM_TEST_VERBOSE_OUTPUT: "true"

Expand Down Expand Up @@ -104,7 +103,7 @@ jobs:
CORE_COMPILE_CONFIGURE_FLAGS="$SYSTEM_TEST_CORE_COMPILE_CONFIGURE_FLAGS" \
CORE_IMAGE=$SYSTEM_TEST_CORE_IMAGE \
CORE_IMAGE_BIN_PATH=$SYSTEM_TEST_CORE_IMAGE_BIN_PATH \
SOROBAN_RPC_GIT_REF=$SYSTEM_TEST_SOROBAN_RPC_REF \
STELLAR_RPC_GIT_REF=$SYSTEM_TEST_STELLAR_RPC_REF \
SOROBAN_CLI_GIT_REF=$SYSTEM_TEST_SOROBAN_CLI_REF \
RUST_TOOLCHAIN_VERSION=$SYSTEM_TEST_RUST_TOOLCHAIN_VERSION \
RS_XDR_GIT_REF=$SYSTEM_TEST_RS_XDR_GIT_REF \
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/stellar-rpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ jobs:
protocol-version: [ 21, 22 ]
runs-on: ${{ matrix.os }}
env:
SOROBAN_RPC_INTEGRATION_TESTS_ENABLED: true
SOROBAN_RPC_INTEGRATION_TESTS_CORE_MAX_SUPPORTED_PROTOCOL: ${{ matrix.protocol-version }}
SOROBAN_RPC_INTEGRATION_TESTS_CAPTIVE_CORE_BIN: /usr/bin/stellar-core
STELLAR_RPC_INTEGRATION_TESTS_ENABLED: true
STELLAR_RPC_INTEGRATION_TESTS_CORE_MAX_SUPPORTED_PROTOCOL: ${{ matrix.protocol-version }}
STELLAR_RPC_INTEGRATION_TESTS_CAPTIVE_CORE_BIN: /usr/bin/stellar-core
PROTOCOL_21_CORE_DEBIAN_PKG_VERSION: 22.0.0-2138.721fd0a65.focal
PROTOCOL_21_CORE_DOCKER_IMG: stellar/stellar-core:22.0.0-2138.721fd0a65.focal
PROTOCOL_22_CORE_DEBIAN_PKG_VERSION: 22.0.0-2138.721fd0a65.focal
Expand All @@ -124,7 +124,7 @@ jobs:
shell: bash
run: |
docker pull "$PROTOCOL_${{ matrix.protocol-version }}_CORE_DOCKER_IMG"
echo SOROBAN_RPC_INTEGRATION_TESTS_DOCKER_IMG="$PROTOCOL_${{ matrix.protocol-version }}_CORE_DOCKER_IMG" >> $GITHUB_ENV
echo STELLAR_RPC_INTEGRATION_TESTS_DOCKER_IMG="$PROTOCOL_${{ matrix.protocol-version }}_CORE_DOCKER_IMG" >> $GITHUB_ENV

- name: Install Captive Core
shell: bash
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ endif
# (libpreflight.a is put at target/release-with-panic-unwind/ when not cross compiling)
CARGO_BUILD_TARGET ?= $(shell rustc -vV | sed -n 's|host: ||p')

SOROBAN_RPC_BINARY := stellar-rpc
STELLAR_RPC_BINARY := stellar-rpc
STELLAR_RPC_BINARY := stellar-rpc


Expand Down Expand Up @@ -86,7 +86,7 @@ clean:
# https://github.com/stellar/pipelines/blob/master/stellar-rpc/Jenkinsfile-stellar-rpc-package-builder
# as part of the package building.
build-stellar-rpc: build-libs
go build -ldflags="${GOLDFLAGS}" ${MACOS_MIN_VER} -o ${SOROBAN_RPC_BINARY} -trimpath -v ./cmd/stellar-rpc
go build -ldflags="${GOLDFLAGS}" ${MACOS_MIN_VER} -o ${STELLAR_RPC_BINARY} -trimpath -v ./cmd/stellar-rpc

# the build-stellar-rpc build target is an optimized build target used by
# https://github.com/stellar/pipelines/blob/master/stellar-rpc/Jenkinsfile-stellar-rpc-package-builder
Expand Down
6 changes: 3 additions & 3 deletions cmd/stellar-rpc/docker/Dockerfile.release
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM ubuntu:22.04
ARG STELLAR_CORE_VERSION
ENV STELLAR_CORE_VERSION=${STELLAR_CORE_VERSION:-*}
ARG SOROBAN_RPC_VERSION
ENV SOROBAN_RPC_VERSION=${SOROBAN_RPC_VERSION:-*}
ARG STELLAR_RPC_VERSION
ENV STELLAR_RPC_VERSION=${STELLAR_RPC_VERSION:-*}

ENV STELLAR_CORE_BINARY_PATH /usr/bin/stellar-core
ENV DEBIAN_FRONTEND=noninteractive
Expand All @@ -14,7 +14,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates
echo "deb https://apt.stellar.org focal testing" >/etc/apt/sources.list.d/SDF-testing.list && \
echo "deb https://apt.stellar.org focal unstable" >/etc/apt/sources.list.d/SDF-unstable.list && \
apt-get update && \
apt-get install -y stellar-core=${STELLAR_CORE_VERSION} stellar-stellar-rpc=${SOROBAN_RPC_VERSION} && \
apt-get install -y stellar-core=${STELLAR_CORE_VERSION} stellar-stellar-rpc=${STELLAR_RPC_VERSION} && \
apt-get clean

ENTRYPOINT ["/usr/bin/stellar-stellar-rpc"]
20 changes: 10 additions & 10 deletions cmd/stellar-rpc/docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ SUDO := $(shell docker version >/dev/null 2>&1 || echo "sudo")
BUILD_DATE := $(shell date -u +%FT%TZ)

# Extract latest release semver from GitHub
SOROBAN_RPC_LATEST_RELEASE := $(shell curl -sS https://api.github.com/repos/stellar/stellar-rpc/releases/latest|jq -r ".tag_name"| tr -d "v" )
STELLAR_RPC_LATEST_RELEASE := $(shell curl -sS https://api.github.com/repos/stellar/stellar-rpc/releases/latest|jq -r ".tag_name"| tr -d "v" )

# If deb version was provided via the SOROBAN_RPC_VERSION variable use it.
# If deb version was provided via the STELLAR_RPC_VERSION variable use it.
# If not get latest deb build matching release from GitHub
ifndef SOROBAN_RPC_VERSION
SOROBAN_RPC_VERSION_PACKAGE_VERSION := $(shell curl -sS https://apt.stellar.org/dists/focal/unstable/binary-amd64/Packages|grep -A 18 stellar-stellar-rpc|grep Version|grep $(SOROBAN_RPC_LATEST_RELEASE)|head -1|cut -d' ' -f2 )
ifndef STELLAR_RPC_VERSION
STELLAR_RPC_VERSION_PACKAGE_VERSION := $(shell curl -sS https://apt.stellar.org/dists/focal/unstable/binary-amd64/Packages|grep -A 18 stellar-stellar-rpc|grep Version|grep $(STELLAR_RPC_LATEST_RELEASE)|head -1|cut -d' ' -f2 )
else
SOROBAN_RPC_VERSION_PACKAGE_VERSION := $(SOROBAN_RPC_VERSION)
STELLAR_RPC_VERSION_PACKAGE_VERSION := $(STELLAR_RPC_VERSION)
endif

ifndef SOROBAN_RPC_VERSION_PACKAGE_VERSION
$(error Couldn't establish deb build from version $(SOROBAN_RPC_LATEST_RELEASE). Has the package been built?)
ifndef STELLAR_RPC_VERSION_PACKAGE_VERSION
$(error Couldn't establish deb build from version $(STELLAR_RPC_LATEST_RELEASE). Has the package been built?)
endif

ifndef STELLAR_CORE_VERSION
Expand All @@ -28,17 +28,17 @@ BINARY_NAME ?= stellar-rpc
ifndef TAG
# Set the TAG based on the value of BINARY_NAME
ifeq ($(BINARY_NAME),stellar-rpc)
TAG := stellar/stellar-rpc:$(SOROBAN_RPC_VERSION_PACKAGE_VERSION)
TAG := stellar/stellar-rpc:$(STELLAR_RPC_VERSION_PACKAGE_VERSION)
else
TAG := stellar/stellar-stellar-rpc:$(SOROBAN_RPC_VERSION_PACKAGE_VERSION)
TAG := stellar/stellar-stellar-rpc:$(STELLAR_RPC_VERSION_PACKAGE_VERSION)
endif
endif # TAG


docker-build:
$(SUDO) docker build --pull --platform linux/amd64 $(DOCKER_OPTS) \
--label org.opencontainers.image.created="$(BUILD_DATE)" \
--build-arg STELLAR_CORE_VERSION=$(STELLAR_CORE_VERSION) --build-arg SOROBAN_RPC_VERSION=$(SOROBAN_RPC_VERSION_PACKAGE_VERSION) \
--build-arg STELLAR_CORE_VERSION=$(STELLAR_CORE_VERSION) --build-arg STELLAR_RPC_VERSION=$(STELLAR_RPC_VERSION_PACKAGE_VERSION) \
--build-arg BINARY_NAME=$(BINARY_NAME) \
-t $(TAG) -f Dockerfile.release .

Expand Down
13 changes: 8 additions & 5 deletions cmd/stellar-rpc/internal/config/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ func (cfg *Config) options() Options {
defaultStellarCoreBinaryPath, _ := exec.LookPath("stellar-core")
cfg.optionsCache = &Options{
{
Name: "config-path",
Name: "config-path",
// TODO: deprecate and rename to STELLAR_RPC_
EnvVar: "SOROBAN_RPC_CONFIG_PATH",
TomlKey: "-",
Usage: "File path to the toml configuration file",
ConfigKey: &cfg.ConfigPath,
},
{
Name: "config-strict",
Name: "config-strict",
// TODO: deprecate and rename to STELLAR_RPC_
EnvVar: "SOROBAN_RPC_CONFIG_STRICT",
TomlKey: "STRICT",
Usage: "Enable strict toml configuration file parsing. This will prevent unknown fields in the config toml from being parsed.",
Expand Down Expand Up @@ -197,9 +199,10 @@ func (cfg *Config) options() Options {
Validate: required,
},
{
Name: "db-path",
Usage: "SQLite DB path",
ConfigKey: &cfg.SQLiteDBPath,
Name: "db-path",
Usage: "SQLite DB path",
ConfigKey: &cfg.SQLiteDBPath,
// TODO: deprecate and rename to stellar_rpc.sqlite
DefaultValue: "soroban_rpc.sqlite",
},
{
Expand Down
5 changes: 3 additions & 2 deletions cmd/stellar-rpc/internal/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (

"github.com/stellar/stellar-rpc/cmd/stellar-rpc/internal"
"github.com/stellar/stellar-rpc/cmd/stellar-rpc/internal/config"
"github.com/stellar/stellar-rpc/cmd/stellar-rpc/internal/daemon/interfaces"
"github.com/stellar/stellar-rpc/cmd/stellar-rpc/internal/db"
"github.com/stellar/stellar-rpc/cmd/stellar-rpc/internal/feewindow"
"github.com/stellar/stellar-rpc/cmd/stellar-rpc/internal/ingest"
Expand All @@ -35,7 +36,6 @@ import (
)

const (
prometheusNamespace = "soroban_rpc"
maxLedgerEntryWriteBatchSize = 150
defaultReadTimeout = 5 * time.Second
defaultShutdownGracePeriod = 10 * time.Second
Expand Down Expand Up @@ -220,7 +220,8 @@ func mustCreateHistoryArchive(cfg *config.Config, logger *supportlog.Entry) *his
}

func mustOpenDatabase(cfg *config.Config, logger *supportlog.Entry, metricsRegistry *prometheus.Registry) *db.DB {
dbConn, err := db.OpenSQLiteDBWithPrometheusMetrics(cfg.SQLiteDBPath, prometheusNamespace, "db", metricsRegistry)
dbConn, err := db.OpenSQLiteDBWithPrometheusMetrics(
cfg.SQLiteDBPath, interfaces.PrometheusNamespace, "db", metricsRegistry)
if err != nil {
logger.WithError(err).Fatal("could not open database")
}
Expand Down
5 changes: 4 additions & 1 deletion cmd/stellar-rpc/internal/daemon/interfaces/noOpDaemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import (
proto "github.com/stellar/go/protocols/stellarcore"
)

// TODO: deprecate and rename to stellar_rpc
const PrometheusNamespace = "soroban_rpc"

// NoOpDaemon The noOpDeamon is a dummy daemon implementation, supporting the Daemon interface.
// Used only in testing.
type NoOpDaemon struct {
Expand All @@ -21,7 +24,7 @@ type NoOpDaemon struct {
func MakeNoOpDeamon() *NoOpDaemon {
return &NoOpDaemon{
metricsRegistry: prometheus.NewRegistry(),
metricsNamespace: "soroban_rpc",
metricsNamespace: PrometheusNamespace,
coreClient: noOpCoreClient{},
}
}
Expand Down
10 changes: 5 additions & 5 deletions cmd/stellar-rpc/internal/daemon/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ import (

func (d *Daemon) registerMetrics() {
// LogMetricsHook is a metric which counts log lines emitted by stellar rpc
logMetricsHook := logmetrics.New(prometheusNamespace)
logMetricsHook := logmetrics.New(interfaces.PrometheusNamespace)
d.logger.AddHook(logMetricsHook)
for _, counter := range logMetricsHook {
d.metricsRegistry.MustRegister(counter)
}

buildInfoGauge := prometheus.NewGaugeVec(
prometheus.GaugeOpts{Namespace: prometheusNamespace, Subsystem: "build", Name: "info"},
prometheus.GaugeOpts{Namespace: interfaces.PrometheusNamespace, Subsystem: "build", Name: "info"},
[]string{"version", "goversion", "commit", "branch", "build_timestamp"},
)
buildInfoGauge.With(prometheus.Labels{
Expand All @@ -49,7 +49,7 @@ func (d *Daemon) MetricsRegistry() *prometheus.Registry {
}

func (d *Daemon) MetricsNamespace() string {
return prometheusNamespace
return interfaces.PrometheusNamespace
}

type CoreClientWithMetrics struct {
Expand All @@ -60,12 +60,12 @@ type CoreClientWithMetrics struct {

func newCoreClientWithMetrics(client stellarcore.Client, registry *prometheus.Registry) *CoreClientWithMetrics {
submitMetric := prometheus.NewSummaryVec(prometheus.SummaryOpts{
Namespace: prometheusNamespace, Subsystem: "txsub", Name: "submission_duration_seconds",
Namespace: interfaces.PrometheusNamespace, Subsystem: "txsub", Name: "submission_duration_seconds",
Help: "submission durations to Stellar-Core, sliding window = 10m",
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, //nolint:mnd
}, []string{"status"})
opCountMetric := prometheus.NewSummaryVec(prometheus.SummaryOpts{
Namespace: prometheusNamespace, Subsystem: "txsub", Name: "operation_count",
Namespace: interfaces.PrometheusNamespace, Subsystem: "txsub", Name: "operation_count",
Help: "number of operations included in a transaction, sliding window = 10m",
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, //nolint:mnd
}, []string{"status"})
Expand Down
14 changes: 7 additions & 7 deletions cmd/stellar-rpc/internal/integrationtest/infrastructure/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ type Test struct {
}

func NewTest(t *testing.T, cfg *TestConfig) *Test {
if os.Getenv("SOROBAN_RPC_INTEGRATION_TESTS_ENABLED") == "" {
t.Skip("skipping integration test: SOROBAN_RPC_INTEGRATION_TESTS_ENABLED not set")
if os.Getenv("STELLAR_RPC_INTEGRATION_TESTS_ENABLED") == "" {
t.Skip("skipping integration test: STELLAR_RPC_INTEGRATION_TESTS_ENABLED not set")
}
i := &Test{t: t}

Expand All @@ -137,7 +137,7 @@ func NewTest(t *testing.T, cfg *TestConfig) *Test {
}

if i.sqlitePath == "" {
i.sqlitePath = path.Join(i.t.TempDir(), "soroban_rpc.sqlite")
i.sqlitePath = path.Join(i.t.TempDir(), "stellar_rpc.sqlite")
}

if parallel {
Expand Down Expand Up @@ -276,9 +276,9 @@ func (i *Test) getRPConfigForContainer() rpcConfig {
}

func (i *Test) getRPConfigForDaemon() rpcConfig {
coreBinaryPath := os.Getenv("SOROBAN_RPC_INTEGRATION_TESTS_CAPTIVE_CORE_BIN")
coreBinaryPath := os.Getenv("STELLAR_RPC_INTEGRATION_TESTS_CAPTIVE_CORE_BIN")
if coreBinaryPath == "" {
i.t.Fatal("missing SOROBAN_RPC_INTEGRATION_TESTS_CAPTIVE_CORE_BIN")
i.t.Fatal("missing STELLAR_RPC_INTEGRATION_TESTS_CAPTIVE_CORE_BIN")
}
return rpcConfig{
// Allocate port dynamically and then figure out what the port is
Expand Down Expand Up @@ -479,7 +479,7 @@ func (i *Test) getComposeCommand(args ...string) *exec.Cmd {
cmd = exec.Command("docker", cmdline...)
}

if img := os.Getenv("SOROBAN_RPC_INTEGRATION_TESTS_DOCKER_IMG"); img != "" {
if img := os.Getenv("STELLAR_RPC_INTEGRATION_TESTS_DOCKER_IMG"); img != "" {
cmd.Env = append(
cmd.Env,
"CORE_IMAGE="+img,
Expand Down Expand Up @@ -722,7 +722,7 @@ func (i *Test) fillContainerPorts() {
}

func GetCoreMaxSupportedProtocol() uint32 {
str := os.Getenv("SOROBAN_RPC_INTEGRATION_TESTS_CORE_MAX_SUPPORTED_PROTOCOL")
str := os.Getenv("STELLAR_RPC_INTEGRATION_TESTS_CORE_MAX_SUPPORTED_PROTOCOL")
if str == "" {
return MaxSupportedProtocolVersion
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/stellar-rpc/internal/preflight/preflight_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ func createLedger(ledgerSequence uint32) xdr.LedgerCloseMeta {
}

func getDB(t testing.TB, restartDB bool) *db.DB {
dbPath := path.Join(t.TempDir(), "soroban_rpc.sqlite")
dbPath := path.Join(t.TempDir(), "stellar_rpc.sqlite")
dbInstance, err := db.OpenSQLiteDB(dbPath)
require.NoError(t, err)

Expand Down
Loading