Update testing instructions and bump 1.0

This commit is contained in:
ViViDboarder 2023-01-25 16:42:21 -08:00
parent f7b7f28e77
commit 30974696be
7 changed files with 34 additions and 11 deletions

2
Cargo.lock generated
View File

@ -984,7 +984,7 @@ dependencies = [
[[package]]
name = "vaultwarden_ldap"
version = "0.6.2"
version = "1.0.0"
dependencies = [
"anyhow",
"envy",

View File

@ -1,6 +1,6 @@
[package]
name = "vaultwarden_ldap"
version = "0.6.2"
version = "1.0.0"
authors = ["ViViDboarder <vividboarder@gmail.com>"]
edition = "2018"

View File

@ -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:

View File

@ -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
@ -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

View File

@ -24,6 +24,7 @@ services:
ADMIN_TOKEN: admin
SIGNUPS_ALLOWED: 'false'
INVITATIONS_ALLOWED: 'true'
I_REALLY_WANT_VOLATILE_STORAGE: 'true'
ldap:
image: osixia/openldap

View File

@ -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:

View File

@ -2,6 +2,8 @@
version: '3'
services:
ldap_sync:
volumes:
- ./itest/config.toml:/config.toml:ro
vaultwarden: