Skip to content

Commit f9fe8df

Browse files
authored
Add new example for testing cupis on Decodable (#38)
* add example for testing custom flink jobs * add new example entry to main repo README * fix link to blog article
1 parent e580762 commit f9fe8df

23 files changed

+1483
-8
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ config.*
2525
*.properties
2626

2727
output
28-
*test*
28+
# unclear why this rule has been added initially, it would ignore
29+
# e.g. any test classes by default or complete examples which contain
30+
# the term 'test' in their name...
31+
#*test*
2932
.env
3033
api-key*
3134
*.properties

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,14 @@ _Learn more [here](https://decodable.co), and [sign up for a free trial](https:/
3535

3636
### Data Pipelines
3737

38-
| Example | Description |
39-
|---------------------------------------------------------|---------------------------------------------------------------------|
40-
| [Opinionated Data Pipelines](opinionated-pipelines) | Building data pipelines with schema on write streams. |
41-
| [Postman](postman) | Building data pipelines with Postman. |
42-
| [Postgres to Snowflake](postgres-to-snowflake-with-cdc) | Getting data from Postgres to Snowflake using Decodable. |
43-
| [Flink CDC](flink-cdc) | Trying out Flink CDC and comparing it to Flink SQL. |
44-
| [Flink SQL and Custom Pipelines](sql-cupi-hybrid) | Bridging Flink SQL and Custom Java Pipelines with the Decodable SDK |
38+
| Example | Description |
39+
|---------------------------------------------------------|----------------------------------------------------------------------------------------|
40+
| [Opinionated Data Pipelines](opinionated-pipelines) | Building data pipelines with schema on write streams. |
41+
| [Postman](postman) | Building data pipelines with Postman. |
42+
| [Postgres to Snowflake](postgres-to-snowflake-with-cdc) | Getting data from Postgres to Snowflake using Decodable. |
43+
| [Flink CDC](flink-cdc) | Trying out Flink CDC and comparing it to Flink SQL. |
44+
| [Flink SQL and Custom Pipelines](sql-cupi-hybrid) | Bridging Flink SQL and Custom Java Pipelines with the Decodable SDK. |
45+
| [Testing Custom Pipelines on Decodable](testing-cupi) | How to write more modular Flink jobs with pluggable components to improve testability. |
4546

4647

4748
### PyFlink

testing-cupi/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
!maven-wrapper.properties
61.1 KB
Binary file not shown.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
18+
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar

testing-cupi/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Testing Custom Flink Jobs on Decodable
2+
3+
Testing Flink jobs can be challenging for a number of reasons, one of them being the fact that there are typically external data systems or services involved.
4+
5+
![high-level-example-overview](./docs/images/01_flink-job-high-level-showing-external-service-dependencies.webp)
6+
7+
This example is the result of refactoring an [existing Flink job](https://github.com/decodableco/examples/blob/main/sql-cupi-hybrid/cupi/src/main/java/co/decodable/examples/FruitEnricherJob.java) to improve its testability. This alternative implementation is more modular by defining job-specific interfaces for the actual processing logic and by making the source and sink components which talk to external data systems pluggable. Doing so allows to not only unit test certain job components in isolation, but instead test the full processing logic of said jobs without the stringent necessity to always have access to any external services our Flink jobs almost certainly depend on.
8+
9+
The accompanying blog post can be found [here](https://www.decodable.co/blog/testing-custom-flink-jobs-on-decodable). Find its outline below.
10+
11+
## Outline
12+
13+
* Quick Recap of the Flink Job
14+
* Assessing the Testability of the Existing Job
15+
* Refactoring for Better Job Testability
16+
- Adapt Job Processing Logic
17+
- Test New Job Processing Logic
18+
- Adapt Job Setup
19+
- Test New Job Setup
20+
- Integration Testing the Job
153 KB
Loading

testing-cupi/mvnw

Lines changed: 308 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)