vukzeka commented on PR #222: URL: https://github.com/apache/mina-sshd/pull/222#issuecomment-1124693099
> @vukzeka I just pushed a commit [alex-sherwin@f5966b4](https://github.com/alex-sherwin/mina-sshd/commit/f5966b48e3ac2ab375269aae553c765cf62488cf) > > It shows how to use testcontainers to build an image w/ ssh-keygen and: > > 1. How you can use **ssh-keygen** to parse/view a OpenSSH Certificate file and check the exit code > 2. How you can use **ssh-keygen** to generate data and copy the contents back to Java > > This test is _not_ using the testcontainers JUnit automatic test lifecycle stuff (where you define the `GenericContainer` as a class-level property or static prop with `@ClassRule` annotations to manage the container lifecycle, but, testcontainers will still auto cleanup/reap the container and images after JVM exit automagically). > > This is because all that stuff is geared towards long-running daemon services, etc. > > Instead, the unit test itself is defining the docker image + container, starting it, and using a custom wait strategy (which checks for exit, but does not assert the exit code itself), so that the unit test function can inspect the container exit code and logs and apply junit assertions to them. > > If you do add a test using this kind of technique, you should probably set it up to be a parameterized test like **GenerateOpenSSHClientCertificateTest** with all the cert type variations Great, thanks @alex-sherwin [This](https://github.com/alex-sherwin/mina-sshd/commit/f5966b48e3ac2ab375269aae553c765cf62488cf#diff-87ff30dcfbfe5636d9eb3413bb6530396eeea5409eae18163ac9561951bcedf2R113) and [this](https://github.com/alex-sherwin/mina-sshd/commit/f5966b48e3ac2ab375269aae553c765cf62488cf#diff-87ff30dcfbfe5636d9eb3413bb6530396eeea5409eae18163ac9561951bcedf2R137-R144) is exactly what i was looking for. Something like that would help to not store pre-generated certs on the repo already test can - generate keys using ssh-keygen - generate certs using ssh-keygen - parse them using code - generate certs from code - and validate certs back with ssh-keygen and more important will be usable also for some other tests not related to this functionality. I will create some example later this week but will be separate from this PR. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For additional commands, e-mail: dev-h...@mina.apache.org