Skip to content

Commit

Permalink
Update testing instructions and bump 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ViViDboarder committed Jan 26, 2023
1 parent f7b7f28 commit 3097469
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "vaultwarden_ldap"
version = "0.6.2"
version = "1.0.0"
authors = ["ViViDboarder <[email protected]>"]
edition = "2018"

Expand Down
18 changes: 16 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,28 @@ test:
itest:
docker-compose -f docker-compose.yml \
-f itest/docker-compose.itest.yml \
up --build
build
docker-compose -f docker-compose.yml \
-f itest/docker-compose.itest.yml \
up -d vaultwarden ldap
docker-compose -f docker-compose.yml \
-f itest/docker-compose.itest.yml \
run ldap_sync
docker-compose stop

# Run bootstrapped integration test using env for config
.PHONY: itest-env
itest-env:
docker-compose -f docker-compose.yml \
-f itest/docker-compose.itest-env.yml \
up --build
build
docker-compose -f docker-compose.yml \
-f itest/docker-compose.itest-env.yml \
up -d vaultwarden ldap
docker-compose -f docker-compose.yml \
-f itest/docker-compose.itest-env.yml \
run ldap_sync
docker-compose stop

.PHONY: clean-itest
clean-itest:
Expand Down
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,18 @@ For those less familiar with `cargo`, you can use the `make` targets that have b

## Testing

All testing is manual right now. First step is to set up Bitwarden and the LDAP server.
There are no unit tests, but there are integration tests that require manual verification.

### Integration tests

Running `make itest` will spin up an ldap server with a test user, a Vaultwarden server, and then run the sync. If successful the log should show an invitation sent to the test user. If you run `make itest` again, it should show no invites sent because the user already has been invited. If you'd like to reset the testing, `make clean-itest` will clear out the Vaultwarden database and start fresh.

It's also possible to test passing configs via enviornment variables by running `make itest-env`. The validation steps are the same.


### Steps for manual testing

The first step is to set up Bitwarden and the LDAP server.

```bash
docker-compose up -d vaultwarden ldap ldap_admin
Expand Down Expand Up @@ -74,8 +85,3 @@ docker-compose up ldap_sync
Alternately, you can bootstrap some of this by running:

docker-compose -f docker-compose.yml -f itest/docker-compose.itest.yml up --build

## Future

* Any kind of proper logging
* Tests
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ services:
ADMIN_TOKEN: admin
SIGNUPS_ALLOWED: 'false'
INVITATIONS_ALLOWED: 'true'
I_REALLY_WANT_VOLATILE_STORAGE: 'true'

ldap:
image: osixia/openldap
Expand Down
2 changes: 1 addition & 1 deletion itest/docker-compose.itest-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
APP_LDAP_BIND_PASSWORD: "admin"
APP_LDAP_SEARCH_BASE_DN: "dc=example,dc=org"
APP_LDAP_SEARCH_FILTER: "(&(objectClass=*)(uid=*))"
APP_LDAP_SYNC_INTERVAL_SECONDS: 10
APP_LDAP_SYNC_LOOP: "false"

vaultwarden:

Expand Down
2 changes: 2 additions & 0 deletions itest/docker-compose.itest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
version: '3'
services:
ldap_sync:
volumes:
- ./itest/config.toml:/config.toml:ro

vaultwarden:

Expand Down

0 comments on commit 3097469

Please sign in to comment.