Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,20 @@ public Optional<Integer> getMinorVersion() {
/**
* Determines if the provided Data Prepper Version is compatible with this.
*
* The initial implementation is a basic implementation that enforces equivalent versions, any shorthand format version
* compared with full format with equivalent major versions and equivalent major version but the comparing minor version
* is less than this minor version are compatible.
* The initial implementation is a basic implementation that will return true only when the comparing version is
* less than or equal to this version.
*
* @param o - the other DataPrepperVersion to compare with
* @return return true if the versions are compatible, otherwise false
* @since 2.1
*/
public boolean compatibleWith(DataPrepperVersion o) {

if (this.majorVersion != o.getMajorVersion()) {
if (this.majorVersion < o.getMajorVersion()) {
return false;
}

if (this.minorVersion != null && o.getMinorVersion().isPresent()) {
if ((this.majorVersion == o.majorVersion) && (this.minorVersion != null && o.getMinorVersion().isPresent())) {
if (!this.minorVersion.equals(o.getMinorVersion().get())) {
return this.minorVersion > o.getMinorVersion().get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.jupiter.api.Assertions.assertThrows;
Expand Down Expand Up @@ -62,7 +61,11 @@ private static Stream<Arguments> compatibleDataPrepperVersions() {
Arguments.of("1.4", "1.2"),
Arguments.of("342.0", "342.0"),
Arguments.of("342.8", "342.8"),
Arguments.of("13", "13")
Arguments.of("13", "13"),
Arguments.of("13", "2.0"),
Arguments.of("7.0", "5"),
Arguments.of("42.0", "34.0"),
Arguments.of("13", "11")
);
}

Expand All @@ -83,11 +86,7 @@ private static Stream<Arguments> nonCompatibleDataPrepperVersions() {
Arguments.of("2.0", "5"),
Arguments.of("42.0", "343.0"),
Arguments.of("42.0", "42.1"),
Arguments.of("13", "15"),
Arguments.of("13", "2.0"),
Arguments.of("7.0", "5"),
Arguments.of("42.0", "34.0"),
Arguments.of("13", "11")
Arguments.of("13", "15")
);
}

Expand Down
2 changes: 1 addition & 1 deletion data-prepper-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dependencies {
implementation('org.springframework:spring-context:5.3.23') {
exclude group: 'commons-logging', module: 'commons-logging'
}
implementation 'software.amazon.cloudwatchlogs:aws-embedded-metrics:2.0.0-beta-1'
implementation 'software.amazon.cloudwatchlogs:aws-embedded-metrics:4.1.0'
testImplementation 'org.springframework:spring-test:5.3.25'
implementation libs.armeria.core
implementation libs.armeria.grpc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ void parseConfiguration_with_incompatible_version_should_throw() {

final RuntimeException actualException = assertThrows(RuntimeException.class, pipelineParser::parseConfiguration);
assertThat(actualException.getMessage(),
equalTo(String.format("The version: 1.0 is not compatible with the current version: %s", DataPrepperVersion.getCurrentVersion())));
equalTo(String.format("The version: 3005.0 is not compatible with the current version: %s", DataPrepperVersion.getCurrentVersion())));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

version: "1.0" #outdated version since the compatibility check was introduced.
version: "3005.0" #far out future version.
test-pipeline-1:
source:
stdin:
Expand Down
9 changes: 4 additions & 5 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,9 @@ This sample pipeline creates a source to receive trace data and outputs transfor

The pipeline configuration file now supports an optional `version` attribute. This can help users ensure the pipeline configuration
used is compatible with the running data prepper version. Data Prepper now compares the version supplied in the confirmation at start
time and will throw an exception if the version in the pipeline is not compatible with the running Data Prepper version.
time and will throw an exception if the version in the pipeline is greater than the running Data Prepper version.
This attribute can be specified with a shorthand format with only the major version (i.e. `2`) or major and minor version
(i.e. `2.1`). Data prepper will conclude equivalent versions, any shorthand format version with equivalent major version,
and an equivalent major version with a previously released minor version are compatible.
(i.e. `2.1`).

#### Version Compatibility Matrix

Expand All @@ -88,8 +87,8 @@ and an equivalent major version with a previously released minor version are com
| 2.1 | 2.1 | true |
| 2.1 | 2.0 | true |
| 2.1 | null | true |
| 2.1 | 1.5 | false |
| 2.1 | 1 | false |
| 2.1 | 1.5 | true |
| 2.1 | 1 | true |
| 2.1 | 3.0 | false |
| 2.1 | 3 | false |

Expand Down