Skip to content

feat: Added in-memory storage for testing purposes #40

feat: Added in-memory storage for testing purposes

feat: Added in-memory storage for testing purposes #40

name: LDK Node Integration Tests
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test-postgres:
runs-on: ubuntu-latest
timeout-minutes: 20
services:
postgres:
image: postgres:latest
ports: [5432:5432]
env:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
path: vss-server
- name: Checkout LDK Node
uses: actions/checkout@v3
with:
repository: lightningdevkit/ldk-node
path: ldk-node
- name: Create Postgres config
run: |
mkdir -p vss-server/rust/server
cat > vss-server/rust/server/vss-server-config.toml <<EOF
[server_config]
host = "127.0.0.1"
port = 8080
store_type = "postgres"
[postgresql_config]
host = "localhost"
port = 5432
database = "postgres"
username = "postgres"
password = "postgres"
EOF
- name: Build & Start VSS Server
working-directory: vss-server/rust
run: |
cargo build --release --bin vss-server
./target/release/vss-server ./server/vss-server-config.toml > server.log 2>&1 &
echo "Server PID: $!"
- name: Wait for VSS
run: |
for i in {1..30}; do
if curl -s http://127.0.0.1:8080/vss > /dev/null; then
echo "VSS ready"
exit 0
fi
sleep 2
done
echo "VSS failed:"
cat vss-server/rust/vss.log
exit 1
- name: Run LDK Node Integration tests
working-directory: ldk-node
run: |
export TEST_VSS_BASE_URL="http://127.0.0.1:8080/vss"
RUSTFLAGS="--cfg vss_test" cargo test io::vss_store
RUSTFLAGS="--cfg vss_test" cargo test --test integration_tests_vss
test-in-memory:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
path: vss-server
- name: Checkout LDK Node
uses: actions/checkout@v3
with:
repository: lightningdevkit/ldk-node
path: ldk-node
- name: Create In-Memory config
run: |
mkdir -p vss-server/rust/server
cat > vss-server/rust/server/vss-server-config.toml <<EOF
[server_config]
host = "127.0.0.1"
port = 8080
store_type = "in_memory"
EOF
- name: Build & Start VSS Server
working-directory: vss-server/rust
run: |
cargo build --release --bin server
./target/release/server ./server/vss-server-config.toml --in-memory > vss.log 2>&1 &
echo "PID: $!"
- name: Wait for VSS
run: |
for i in {1..30}; do
if curl -s http://127.0.0.1:8080/vss > /dev/null; then
echo "VSS ready"
exit 0
fi
sleep 1
done
echo "VSS failed:"
cat vss-server/rust/vss.log
exit 1
- name: Run LDK Node Integration tests
working-directory: ldk-node
run: |
export TEST_VSS_BASE_URL="http://127.0.0.1:8080/vss"
RUSTFLAGS="--cfg vss_test" cargo test io::vss_store
RUSTFLAGS="--cfg vss_test" cargo test --test integration_tests_vss