-
Notifications
You must be signed in to change notification settings - Fork 21
feat: Added in-memory storage for testing purposes #59
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| name: In-Memory VSS Server CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| pull_request: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| test-in-memory: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 6 | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Create in-memory config | ||
| run: | | ||
| mkdir -p rust/server | ||
| cat > rust/server/vss-server-config.toml <<EOF | ||
| [server_config] | ||
| bind_address = "127.0.0.1:8080" | ||
| store_type = "in-memory" | ||
| EOF | ||
|
|
||
| - name: Build server | ||
| working-directory: rust | ||
| run: RUSTFLAGS="--cfg noop_authorizer" cargo build --release --no-default-features --bin vss-server | ||
|
|
||
| - name: Start VSS server | ||
| working-directory: rust | ||
| run: | | ||
| ./target/release/vss-server ./server/vss-server-config.toml > server.log 2>&1 & | ||
| echo "Server PID: $!" | ||
|
|
||
| - name: Wait for server | ||
| run: | | ||
| for i in {1..15}; do | ||
| if curl -s http://127.0.0.1:8080/vss > /dev/null; then | ||
| echo "Server is up!" | ||
| exit 0 | ||
| fi | ||
| sleep 1 | ||
| done | ||
| echo "Server failed. Dumping log:" | ||
| cat rust/server.log | ||
| exit 1 | ||
|
|
||
| - name: HTTP Smoke Test | ||
| run: | | ||
| sudo apt-get update && sudo apt-get install -y xxd | ||
|
|
||
| curl -f \ | ||
| -H "Authorization: Bearer test_user" \ | ||
| --data-binary @<(echo "0A04746573741A150A026B3110FFFFFFFFFFFFFFFFFF011A046B317631" | xxd -r -p) \ | ||
| http://127.0.0.1:8080/vss/putObjects | ||
|
|
||
| RESPONSE=$(curl -f \ | ||
| -H "Authorization: Bearer test_user" \ | ||
| --data-binary @<(echo "0A047465737412026B31" | xxd -r -p) \ | ||
| http://127.0.0.1:8080/vss/getObject) | ||
|
|
||
| - name: Run In-Memory unit tests | ||
| working-directory: rust | ||
| run: cargo test --package impls --lib -- in_memory_store::tests --nocapture | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,19 +7,14 @@ concurrency: | |
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build-and-test: | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| platform: [ ubuntu-latest ] | ||
| toolchain: [ stable, 1.85.0 ] # 1.85.0 is the MSRV | ||
| runs-on: ${{ matrix.platform }} | ||
| test-postgres: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
|
|
||
| services: | ||
| postgres: | ||
| image: postgres:latest | ||
| ports: | ||
| - 5432:5432 | ||
| ports: [5432:5432] | ||
| env: | ||
| POSTGRES_DB: postgres | ||
| POSTGRES_USER: postgres | ||
|
|
@@ -35,20 +30,104 @@ jobs: | |
| 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: Build and Deploy VSS Server | ||
Harshdev098 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - name: Create Postgres config | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's not make any edits to the CI of the postgres backend in this PR. We'll use a |
||
| run: | | ||
| mkdir -p vss-server/rust/server | ||
| cat > vss-server/rust/server/vss-server-config.toml <<EOF | ||
| [server_config] | ||
| bind_address = "127.0.0.1:8080" | ||
| store_type = "postgres" | ||
|
|
||
| [postgresql_config] | ||
| username = "postgres" | ||
| password = "postgres" | ||
| address = "localhost:5432" | ||
| default_database = "postgres" | ||
| vss_database = "vss" | ||
| EOF | ||
|
|
||
| - name: Build & Start VSS Server | ||
| working-directory: vss-server/rust | ||
| run: | | ||
| cd vss-server/rust | ||
| RUSTFLAGS="--cfg noop_authorizer" cargo build --no-default-features | ||
| ./target/debug/vss-server server/vss-server-config.toml& | ||
| RUSTFLAGS="--cfg noop_authorizer" cargo build --release --no-default-features --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/server.log | ||
| exit 1 | ||
|
|
||
| - name: Run LDK Node Integration tests | ||
| working-directory: ldk-node | ||
| run: | | ||
| cd ldk-node | ||
| export TEST_VSS_BASE_URL="http://localhost:8080/vss" | ||
| export TEST_VSS_BASE_URL="http://127.0.0.1:8080/vss" | ||
| RUSTFLAGS="--cfg vss_test" cargo test io::vss_store -- --test-threads=1 | ||
| RUSTFLAGS="--cfg vss_test" cargo test --test integration_tests_vss -- --test-threads=1 | ||
|
|
||
| test-in-memory: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
|
|
||
| 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] | ||
| bind_address = "127.0.0.1:8080" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please keep all your changes for the CI of the in-memory server to a single commit. |
||
| store_type = "in-memory" | ||
| EOF | ||
|
|
||
| - name: Build & Start VSS Server | ||
| working-directory: vss-server/rust | ||
| run: | | ||
| RUSTFLAGS="--cfg noop_authorizer" cargo build --release --no-default-features --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 1 | ||
| done | ||
| echo "VSS failed:" | ||
| cat vss-server/rust/server.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 -- --test-threads=1 | ||
| RUSTFLAGS="--cfg vss_test" cargo test --test integration_tests_vss -- --test-threads=1 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,11 @@ cargo build --release | |
| ``` | ||
| cargo run server/vss-server-config.toml | ||
| ``` | ||
|
|
||
| **Note:** For testing purposes, you can pass `--in-memory` to use in-memory instead of PostgreSQL | ||
| ``` | ||
| cargo run -- server/vss-server-config.toml --in-memory | ||
|
Comment on lines
+30
to
+32
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'll have to update this to use |
||
| ``` | ||
| 4. VSS endpoint should be reachable at `http://localhost:8080/vss`. | ||
|
|
||
| ### Configuration | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make all the changes in this file in a single commit.