Skip to content

Conversation

@cgardens
Copy link
Contributor

@cgardens cgardens commented May 18, 2021

What

How

  • Create a "test" source and destination. These allow us to just define really test specific functionality freely. This is good for testing important edge cases.
  • In this case we use ExceptionAfterNSource and LoggingDestination so that we could write an acceptance test for checkpointing. The strategy is that the source emits N records and then throws an exception. Then we verify that the state afterwards is still retained.
  • This required exposing the state somehow. I chose to throw it in the API, since that seems to be something that we're going to do soon anyway and was pretty straight forward.

Pre-merge Checklist

Recommended reading order

  1. E2ETestSource.java
  2. E2ETestDestination.java
  3. config.yaml
  4. the rest

┆Issue is synchronized with this Asana task by Unito

Copy link
Contributor

@michel-tricot michel-tricot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Terrific! Great idea to encode behaviors in testing sources & destinations

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class E2ETestDestination extends BaseConnector implements Destination {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for the name, this is brilliant!

What about End2EndTestDestination or TestingDestination?

}
]
}
} No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: newline

/**
* This source is designed to be a switch statement for our suite of highly-specific test sourcess.
*/
public class E2ETestSource extends BaseConnector implements Source {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TestingSources

@cgardens cgardens force-pushed the cgardens/checkpointing_testing2 branch from b2c9fb8 to c822c7b Compare May 21, 2021 05:36
@cgardens cgardens force-pushed the cgardens/checkpointing_testing2 branch from c822c7b to 4de1bc7 Compare May 21, 2021 05:36
@cgardens cgardens force-pushed the cgardens/checkpointing_respect_destination_state branch from dba87c8 to ae161d7 Compare May 21, 2021 05:36
Copy link
Contributor

@davinchia davinchia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Feel free to merge after dealing with the names.

One clarification: the unused test source & destination are checked in for convenience right? (I'm just making sure I didn't miss any other tests that were using them)

description: Connection not found
"422":
$ref: "#/components/responses/InvalidInput"
/v1/connections/get_state:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good idea - people have been asking for this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think they asked about /v1/connections/set_state: or /v1/connections/update_state: too, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

definitely! i'm looking for directionally correct here. I know this doesn't fully hit the edit state use case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shoudln't it be:
/v1/connections/state/get
or
/v1/state/get


RUN tar xf ${APPLICATION}.tar --strip-components=1

LABEL io.airbyte.version=0.3.1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: 0.1.0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call. what if we go with dev here actually? not planning to publish this one.


integrationTestJavaImplementation "org.testcontainers:postgresql:1.15.1"

implementation files(project(':airbyte-integrations:bases:base-java').airbyteDocker.outputs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: move this out of the test dependencies

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why? the dockerfile still depends on that base image, no?


integrationTestJavaImplementation project(':airbyte-integrations:bases:standard-source-test')

implementation files(project(':airbyte-integrations:bases:base-java').airbyteDocker.outputs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: move this out of test dependencies.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same.

* SOFTWARE.
*/

package io.airbyte.integrations.source.e2e_test;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha I wrote the same version in Python!

assertEquals(getRecordMessage(8L).getRecord().getData(), read.next().getRecord().getData());
assertEquals(getRecordMessage(9L).getRecord().getData(), read.next().getRecord().getData());
assertEquals(getRecordMessage(10L).getRecord().getData(), read.next().getRecord().getData());
assertEquals(getStateMessage(10L).getState().getData(), read.next().getState().getData());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it worth checking for an exception here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. good call!

description: Connection not found
"422":
$ref: "#/components/responses/InvalidInput"
/v1/connections/get_state:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shoudln't it be:
/v1/connections/state/get
or
/v1/state/get

@cgardens cgardens force-pushed the cgardens/checkpointing_respect_destination_state branch from aa941af to 81cce57 Compare May 22, 2021 20:58
@cgardens cgardens merged commit 16937ec into cgardens/checkpointing_respect_destination_state May 25, 2021
@cgardens cgardens deleted the cgardens/checkpointing_testing2 branch May 25, 2021 20:44
cgardens added a commit that referenced this pull request May 25, 2021
cgardens added a commit that referenced this pull request May 25, 2021
…3290) * Migrate BufferedStreamConsumer users (e.g. all JDBC destinations, MeiliSearch) (#3473) * Add checkpointing test cases in Acceptance Tests (#3473) * Add testing for emitting state in Destination Standard Test (#3546) * Migrate BQ to support checkpointing (#3546) * Migrate copy destinations support checkpointing (#3547) * Checkpointing: Migrate CSV and JSON destinations (#3551)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

6 participants