-
Notifications
You must be signed in to change notification settings - Fork 29
Unit/Integration Testing #39
Comments
That's neat, but I don't see us having the bandwidth to do that any time soon. |
That's fine, so what is the supported way to run proper integration testing with this repo rather than mocking all the classes? |
The test suite currently runs a Nomad binary, no mocking.
…On Thu, Mar 5, 2020, 17:41 Jordan Moore ***@***.***> wrote:
That's fine, so what is the supported way to run proper integration
testing with this repo rather than mocking all the classes?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#39?email_source=notifications&email_token=AAMY6T4G32RKEIRZLXQ2K43RGA2EHA5CNFSM4K5CVAIKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEN7JZWY#issuecomment-595500251>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMY6TZTYWKP7MLVWVW6DR3RGA2EHANCNFSM4K5CVAIA>
.
|
I mean for those of us actually using the Java SDK for other work. How do you suggest running Unit or Integration Tests? Also run the binary? That is effectively what the Embedded Consul project I linked to does, just within the JVM rather than manually spun up from the CLI ahead of time. + #41 |
I don't manually spin up the nomad agent using the CLI. The test utils
package in the SDK project does this, for each test.
Here's the code to manage this:
https://github.com/hashicorp/nomad-java-sdk/blob/master/testkit/src/main/java/com/hashicorp/nomad/testutils/NomadAgentProcess.java
Here's an example using it:
https://github.com/hashicorp/nomad-java-sdk/blob/master/testkit/src/test/java/com/hashicorp/nomad/javasdk/JobsApiTest.java#L120
…On Thu, Mar 5, 2020, 19:50 Jordan Moore ***@***.***> wrote:
I mean for those of us actually using the Java SDK for other work. How do
you suggest running Unit or Integration Tests? Also run the binary? That is
effectively what the Embedded Consul project I linked to does, just within
the JVM rather than manually spun up from the CLI ahead of time.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#39?email_source=notifications&email_token=AAMY6T2WBPXDSBQY6G7PLCLRGBJH5A5CNFSM4K5CVAIKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEN7XT7I#issuecomment-595556861>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMY6T4U2GNAMYY2OHZ6MB3RGBJH5ANCNFSM4K5CVAIA>
.
|
this stuff lives in the nomad-testkit library: |
Okay, this is what I was looking for However, that still requires building Nomad with the |
Our test suite requires Nomad built with that flag, to enable mock_driver.
It would be possible to distribute that driver separately (because we
support plugins now). Also, if your integration testing uses one of the
built-in drivers, then you can use a factory Nomad binary.
…On Fri, Mar 6, 2020, 13:50 Jordan Moore ***@***.***> wrote:
Okay, this is what I was looking for
https://github.com/hashicorp/nomad-java-sdk/blob/master/testkit/src/main/java/com/hashicorp/nomad/testutils/AugmentedProcess.java#L25
However, that still requires building Nomad with the nomad_test flag? Or
is that binary available to download somewhere?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#39?email_source=notifications&email_token=AAMY6TYM3ZEQ5QQKEZL5SODRGFHXJA5CNFSM4K5CVAIKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOCUJ4Q#issuecomment-595936498>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMY6TYDXXQ6DWPQEKODGI3RGFHXJANCNFSM4K5CVAIA>
.
|
Yeah, think I'd stick with the mock driver since I just want to verify the API calls are working as expected, not actually starting any services. Should I make a separate ticket that requests the Nomad build process outputs&uploads the test artifact somewhere? |
You can make that request against the Nomad repo.
…On Fri, Mar 6, 2020, 18:31 Jordan Moore ***@***.***> wrote:
Yeah, think I'd stick with the mock driver since I just want to verify the
API calls are working as expected, not actually starting any services.
Should I make a separate ticket that requests the Nomad build process
outputs&uploads the test artifact somewhere?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#39?email_source=notifications&email_token=AAMY6T5HEIFKHNCAYBRF4JTRGGIW3A5CNFSM4K5CVAIKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEODIW3Y#issuecomment-596020079>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMY6T6WZ54XAQOBJ4WAB4LRGGIW3ANCNFSM4K5CVAIA>
.
|
Done! Thanks for the responses! |
I see there is a community offered Embedded Consul
Could we get an Embedded Nomad that runs
nomad agent -dev
and can be addressed as a JUnit Rule onlocalhost:4646
?cc @chrismikehogan
The text was updated successfully, but these errors were encountered: