Skip to content

Commit d2c7617

Browse files
committed
CI: change the endpoint from localhost to the IP of the running samba service
1 parent ee95150 commit d2c7617

File tree

4 files changed

+34
-13
lines changed

4 files changed

+34
-13
lines changed
Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Rust
1+
name: Build
22

33
on:
44
push:
@@ -12,9 +12,12 @@ env:
1212
CARGO_TERM_COLOR: always
1313

1414
jobs:
15-
build_and_test:
15+
test:
1616

1717
runs-on: ubuntu-latest
18+
container:
19+
image: rust:latest
20+
1821
strategy:
1922
matrix:
2023
compile_features: [ async, multi_threaded, single_threaded ]
@@ -34,7 +37,15 @@ jobs:
3437

3538
steps:
3639
- uses: actions/checkout@v4
40+
- name: check
41+
run: |
42+
apt install -y iputils-ping net-tools
43+
ping -c 4 samba
44+
docker ps -a
45+
docker container inspect samba
3746
- name: Build/${{ matrix.compile_features }}
3847
run: cargo build --verbose --no-default-features --features "${{ matrix.compile_features }},sign,encrypt,compress"
3948
- name: Tests/${{ matrix.compile_features }}
40-
run: cargo test --verbose --no-default-features --features "${{ matrix.compile_features }},sign,encrypt,compress"
49+
run: |
50+
export SMB_RUST_TESTS_SERVER=samba:445
51+
cargo test --verbose --no-default-features --features "${{ matrix.compile_features }},sign,encrypt,compress"

smb/tests/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Integration tests
2+
## Running the tests
3+
The tests below are intended to test the library's integration with the SMB protocol, by starting up a samba container and running the tests against it.
4+
To start the container, run the following command:
5+
```bash
6+
docker compose up [-d]
7+
```
8+
9+
Then, you can run the tests as usual, using `cargo test`.
10+
11+
> [!IMPORTANT]
12+
> The tests bind to port 445 by default, so make sure it is available on your machine.
13+
> On many windows machines, this port is already in use by the system; Modify docker-compose.yml to use a different port if necessary,
14+
> and use the `SMB_RUST_TESTS_SERVER=HOST:PORT` environment variable to specify the new port. The same goes for the IP address, if necessary.
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@ pub async fn test_smb_integration_basic() -> Result<(), Box<dyn std::error::Erro
1313

1414
let mut smb = Connection::new();
1515
// Default to localhost, LocalAdmin, 123456
16-
let server = var("SMB_SERVER").unwrap_or("127.0.0.1:445".to_string());
17-
let user = var("SMB_USER").unwrap_or("LocalAdmin".to_string());
18-
let password = var("SMB_PASSWORD").unwrap_or("123456".to_string());
16+
let server = var("SMB_RUST_TESTS_SERVER").unwrap_or("127.0.0.1:445".to_string());
17+
let user = var("SMB_RUST_TESTS_USER_NAME").unwrap_or("LocalAdmin".to_string());
18+
let password = var("SMB_RUST_TESTS_PASSWORD").unwrap_or("123456".to_string());
19+
20+
println!("Connecting to {} as {}", server, user);
21+
1922
// Connect & Authenticate
2023
smb.connect(&server).await?;
2124
let mut session = smb.authenticate(&user, password).await?;

smb/tests/start.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)