New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Have tests for kcctl #44
Comments
I setup the container resources class took help from debezium facing few issues, but we will do it |
The picocli documentation provide some helpful insights into writing tests @QuarkusTest
class PauseConnectorCommandTest {
final PrintStream originalOut = System.out;
final PrintStream originalErr = System.err;
final ByteArrayOutputStream out = new ByteArrayOutputStream();
final ByteArrayOutputStream err = new ByteArrayOutputStream();
@Inject
CommandLine commandLine;
@BeforeEach
public void setUpStreams() {
out.reset();
err.reset();
System.setOut(new PrintStream(out));
System.setErr(new PrintStream(err));
}
@AfterEach
public void restoreStreams() {
System.setOut(originalOut);
System.setErr(originalErr);
}
@Test
void run() {
String[] args = "pause connector connector-1".split(" ");
commandLine.execute(args);
assertEquals("", out.toString());
assertEquals("", err.toString());
}
} |
Thanks, @karim-elngr, so essentially we'd just do assertions on the output stream we've set before. Makes sense. We can throw AssertJ into the mix for more expressive assertions. @SiddiqueAhmad, ok, excellent. Seems the way forward to having some first integration tests is pretty clear then. |
I think this is worth mentioning that SDK man uses a very interesting BDD approach for testing, I wonder if there is a common approach to test cli tools |
Hey @karim-elngr, out curiosity, did you have any chance to make some progress here? |
Hi @gunnarmorling I was taking some time off before starting my new role, I will try to get some progress going next week! |
hi @karim-elngr I tried the code snippet above but I am losing context when command is being executed, #85 have more detail |
- Add helper method for registering a test connector using Debezium Container - Add lifecycle hook for injecting a command context into subclasses containing the desired command instance to reduce boilerplate - Add Quarkus Test Profile
- Add helper method for registering a test connector using Debezium Container - Add lifecycle hook for injecting a command context into subclasses containing the desired command instance to reduce boilerplate - Add Quarkus Test Profile
That's done now thanks to a heroic effort by @iabudiab 🎉 . |
Docker isn't available in that environment.
Docker isn't available in that environment.
Currently, no tests exist for kcctl at all. We should add tests for the different commands, so to avoid regressions down the road. As part of this task, we need to
The text was updated successfully, but these errors were encountered: