Skip to content

Commit 4fc9d0f

Browse files
Harsh Dev PathakHarshdev098
authored andcommitted
feat: Added CI for in_memory_testing
1 parent 51adba8 commit 4fc9d0f

4 files changed

Lines changed: 57 additions & 11 deletions

File tree

.github/workflows/ldk-node-integration.yml

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@ concurrency:
77
cancel-in-progress: true
88

99
jobs:
10-
build-and-test:
10+
test-postgres:
1111
runs-on: ubuntu-latest
12-
12+
timeout-minutes: 30
1313
services:
1414
postgres:
1515
image: postgres:latest
16-
ports:
17-
- 5432:5432
16+
ports: [5432:5432]
1817
env:
1918
POSTGRES_DB: postgres
2019
POSTGRES_USER: postgres
@@ -30,21 +29,56 @@ jobs:
3029
uses: actions/checkout@v3
3130
with:
3231
path: vss-server
32+
3333
- name: Checkout LDK Node
3434
uses: actions/checkout@v3
3535
with:
3636
repository: lightningdevkit/ldk-node
3737
path: ldk-node
3838

39-
- name: Build and Deploy VSS Server
39+
- name: Create Postgres config
4040
run: |
41+
mkdir -p vss-server/rust/server
42+
cat > vss-server/rust/server/vss-server-config.toml <<EOF
43+
[server_config]
44+
host = "127.0.0.1"
45+
port = 8080
46+
store_type = "postgres"
47+
[postgresql_config]
48+
host = "localhost"
49+
port = 5432
50+
database = "postgres"
51+
username = "postgres"
52+
password = "postgres"
53+
EOF
54+
55+
- name: Build & Start VSS Server
56+
working-directory: vss-server/rust
57+
run: |
58+
cargo build --release --bin vss-server
59+
./target/release/vss-server ./server/vss-server-config.toml > server.log 2>&1 &
60+
echo "Server PID: $!"
61+
62+
- name: Wait for VSS
63+
run: |
64+
for i in {1..30}; do
65+
if curl -s http://127.0.0.1:8080/vss > /dev/null; then
66+
echo "VSS ready"
67+
exit 0
68+
fi
69+
sleep 2
70+
done
71+
echo "VSS failed:"
72+
cat vss-server/rust/server.log
73+
exit 1
74+
4175
cd vss-server/rust
4276
cargo build
4377
cargo run --no-default-features server/vss-server-config.toml&
4478
- name: Run LDK Node Integration tests
79+
working-directory: ldk-node
4580
run: |
46-
cd ldk-node
47-
export TEST_VSS_BASE_URL="http://localhost:8080/vss"
81+
export TEST_VSS_BASE_URL="http://127.0.0.1:8080/vss"
4882
RUSTFLAGS="--cfg vss_test" cargo test io::vss_store
4983
RUSTFLAGS="--cfg vss_test" cargo test --test integration_tests_vss
5084
@@ -91,7 +125,7 @@ jobs:
91125
sleep 1
92126
done
93127
echo "VSS failed:"
94-
cat vss-server/rust/vss.log
128+
cat vss-server/rust/server.log
95129
exit 1
96130
97131
- name: Run LDK Node Integration tests

rust/server/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ prost = { version = "0.11.6", default-features = false, features = ["std"] }
2121
bytes = "1.4.0"
2222
serde = { version = "1.0.203", default-features = false, features = ["derive"] }
2323
toml = { version = "0.8.9", default-features = false, features = ["parse"] }
24+
25+
[[bin]]
26+
name = "vss-server"
27+
path = "src/main.rs"

rust/server/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,4 +167,4 @@ fn main() {
167167
}
168168
}
169169
});
170-
}
170+
}

rust/server/src/util/config.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,5 +168,13 @@ pub(crate) fn load_configuration(config_file_path: Option<&str>) -> Result<Confi
168168

169169
let postgresql_prefix = format!("postgresql://{}:{}@{}", username, password, address);
170170

171-
Ok(Configuration { bind_address, rsa_pem, postgresql_prefix, default_db, vss_db, tls_config, store_type })
172-
}
171+
Ok(Configuration {
172+
bind_address,
173+
rsa_pem,
174+
postgresql_prefix,
175+
default_db,
176+
vss_db,
177+
tls_config,
178+
store_type,
179+
})
180+
}

0 commit comments

Comments
 (0)