NLnetLabs / krill

RPKI Certificate Authority and Publication Server written in Rust
https://nlnetlabs.nl/projects/routing/krill/
Mozilla Public License 2.0
292 stars 40 forks source link

Extract the OpenID Connect mock to its own crate or use something else instead #418

Open ximon18 opened 3 years ago

ximon18 commented 3 years ago

We're increasingly finding it would be useful to be able to run the mock as a standalone binary, and as we improve the mock we risk adding more and more Cargo dependencies just for the mock. As the mock is not part of Krill at all, and could be beneficial outside the Krill project to others, it would be good to extract the mock to its own crate on crates.io and to use it as a dev dependency from Krill. We could do that as a first very rough effort, but for it to be useful to others the hard-coded configuration (e.g. various users with special properties) should perhaps be removed and made possible to configure on the fly by giving the mock its own HTTP API to be used by tests.

Alternatively, explore existing options out there for testing OpenID Connect instead of rolling our own.

ximon18 commented 3 years ago

@ramosbugs: What do you use for testing the openid-connect Rust crate?

ramosbugs commented 3 years ago

most of the openidconnect crate's tests are related to serialization and deserialization. there was a test suite that used the public OpenID Connect conformance tests previously, but that testing system got decommissioned in favor of a newer one, and I haven't had time to rewrite the tests to use it.

in terms of mocking HTTP requests and responses, the oauth2 crate does most of that work, e.g.: https://github.com/ramosbugs/oauth2-rs/blob/30eaa50c2310614fa075e2e61c07533855715f92/src/tests.rs#L292-L310. that's probably too low level for testing applications that consume the crate though.

ximon18 commented 3 years ago

Thanks @ramosbugs !