Skip to content
This repository has been archived by the owner on Dec 2, 2022. It is now read-only.

Unit/Integration Testing #39

Closed
OneCricketeer opened this issue Feb 27, 2020 · 11 comments
Closed

Unit/Integration Testing #39

OneCricketeer opened this issue Feb 27, 2020 · 11 comments

Comments

@OneCricketeer
Copy link
Contributor

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 on localhost:4646 ?

cc @chrismikehogan

@cgbaker
Copy link
Contributor

cgbaker commented Mar 5, 2020

That's neat, but I don't see us having the bandwidth to do that any time soon.

@OneCricketeer
Copy link
Contributor Author

That's fine, so what is the supported way to run proper integration testing with this repo rather than mocking all the classes?

@cgbaker
Copy link
Contributor

cgbaker commented Mar 6, 2020 via email

@OneCricketeer
Copy link
Contributor Author

OneCricketeer commented Mar 6, 2020

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

@cgbaker
Copy link
Contributor

cgbaker commented Mar 6, 2020 via email

@cgbaker
Copy link
Contributor

cgbaker commented Mar 6, 2020

this stuff lives in the nomad-testkit library:
https://mvnrepository.com/artifact/com.hashicorp.nomad/nomad-testkit

@OneCricketeer
Copy link
Contributor Author

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?

@cgbaker
Copy link
Contributor

cgbaker commented Mar 6, 2020 via email

@OneCricketeer
Copy link
Contributor Author

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?

@cgbaker
Copy link
Contributor

cgbaker commented Mar 7, 2020 via email

@OneCricketeer
Copy link
Contributor Author

Done! Thanks for the responses!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants