-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Create a test container for running Airbyte with docker-compose #4970
Conversation
@@ -1,86 +0,0 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved this into AirbyteTestContainer
DockerComposeContainer dockerComposeContainer = new DockerComposeContainer(secondRun) | ||
.withLogConsumer("server", logConsumerForServer(logsToExpect)) | ||
.withEnv(environmentVariables); | ||
final AirbyteTestContainer airbyteTestContainer = new AirbyteTestContainer.Builder(new File(Resources.getResource("docker-compose.yaml").toURI())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer to run using the current compose file as opposed to a frozen.
airbyte-tests/src/main/java/io/airbyte/test/airbyte_test_container/AirbyteTestContainer.java
Outdated
Show resolved
Hide resolved
@SuppressWarnings({"unchecked", "rawtypes"}) | ||
public void start() throws IOException, InterruptedException { | ||
final File cleanedDockerComposeFile = prepareDockerComposeFile(dockerComposeFile); | ||
dockerComposeContainer = new DockerComposeContainer(cleanedDockerComposeFile).withEnv(env); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's pretty awesome!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah. credit goes to @subodh1810 for figuring this out originally. i'm just putting a new coat of paint on it.
|
||
@SuppressWarnings("BusyWait") | ||
private static void waitForAirbyte() throws InterruptedException { | ||
// todo (cgardens) - assumes port 8001 which is misleading since we can start airbyte on other |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: create follow up issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 #4992
.setPort(8001) | ||
.setBasePath("/api")); | ||
|
||
final HealthApi healthApi = apiClient.getHealthApi(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is pretty clever haha
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks! we had been using timeouts and then i realized we have an endpoint that handles this exact purpose. 🤣
private void stopRetainVolumesInternal() throws InvocationTargetException, IllegalAccessException, NoSuchMethodException, NoSuchFieldException { | ||
final Class<? extends DockerComposeContainer> dockerComposeContainerClass = dockerComposeContainer.getClass(); | ||
try { | ||
final Field ambassadorContainerField = dockerComposeContainerClass.getDeclaredField("ambassadorContainer"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the ambassadorContainerField
and what is the SocatContainer
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the reflection stuff that subodh figured out so that we could spin down a docker compose test container without deleting volumes. i'm just moving the code. i'd have to dig a bit deeper to remember how this works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I like it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
…iner/AirbyteTestContainer.java Co-authored-by: Davin Chia <davinchia@gmail.com>
What
MigrationAcceptanceTest.java
.AcceptanceTests
How
AirbyteTestContainer
MigrationAcceptanceTest.java
so that it uses the current docker compose file on the "second" run so that there is less risk of drift (it had already started).Recommended reading order
AcceptanceTests.java
AirbyteTestContainer.java
MigrationAcceptanceTest.java