From e49d49c509734fc765efa00d20fa7aa056a6a530 Mon Sep 17 00:00:00 2001 From: Abdullah Yildirim Date: Tue, 9 Apr 2024 12:31:05 -0400 Subject: [PATCH] chore: add minimum client version to server info class (#109) Signed-off-by: a3hadi --- src/main/java/io/numaproj/numaflow/info/ServerInfo.java | 3 +++ src/main/java/io/numaproj/numaflow/shared/GrpcServerUtils.java | 1 + .../io/numaproj/numaflow/info/ServerInfoAccessorImplTest.java | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/main/java/io/numaproj/numaflow/info/ServerInfo.java b/src/main/java/io/numaproj/numaflow/info/ServerInfo.java index 7788941b..65f35eb0 100644 --- a/src/main/java/io/numaproj/numaflow/info/ServerInfo.java +++ b/src/main/java/io/numaproj/numaflow/info/ServerInfo.java @@ -20,10 +20,13 @@ @NoArgsConstructor @AllArgsConstructor public class ServerInfo { + public static final String MINIMUM_CLIENT_VERSION = ">= 1.2.0-0"; @JsonProperty("protocol") private Protocol protocol; @JsonProperty("language") private Language language; + @JsonProperty("minimum_client_version") + private String minimum_client_version; @JsonProperty("version") private String version; @JsonProperty("metadata") diff --git a/src/main/java/io/numaproj/numaflow/shared/GrpcServerUtils.java b/src/main/java/io/numaproj/numaflow/shared/GrpcServerUtils.java index d1e1ba4f..7ddfbbe7 100644 --- a/src/main/java/io/numaproj/numaflow/shared/GrpcServerUtils.java +++ b/src/main/java/io/numaproj/numaflow/shared/GrpcServerUtils.java @@ -93,6 +93,7 @@ public static void writeServerInfo( ServerInfo serverInfo = new ServerInfo( Protocol.UDS_PROTOCOL, Language.JAVA, + ServerInfo.MINIMUM_CLIENT_VERSION, serverInfoAccessor.getSDKVersion(), new HashMap<>()); log.info("Writing server info {} to {}", serverInfo, infoFilePath); diff --git a/src/test/java/io/numaproj/numaflow/info/ServerInfoAccessorImplTest.java b/src/test/java/io/numaproj/numaflow/info/ServerInfoAccessorImplTest.java index c2408488..2dc085e5 100644 --- a/src/test/java/io/numaproj/numaflow/info/ServerInfoAccessorImplTest.java +++ b/src/test/java/io/numaproj/numaflow/info/ServerInfoAccessorImplTest.java @@ -26,6 +26,7 @@ public void given_writeServerInfo_when_read_then_returnExactSame() { ServerInfo testServerInfo = new ServerInfo( Protocol.TCP_PROTOCOL, Language.JAVA, + ServerInfo.MINIMUM_CLIENT_VERSION, "0.4.3", new HashMap<>() {{ put("key1", "value1"); @@ -38,6 +39,7 @@ public void given_writeServerInfo_when_read_then_returnExactSame() { ServerInfo got = this.underTest.read(testFilePath); assertEquals(testServerInfo.getLanguage(), got.getLanguage()); assertEquals(testServerInfo.getProtocol(), got.getProtocol()); + assertEquals(testServerInfo.getMinimum_client_version(), got.getMinimum_client_version()); assertEquals(testServerInfo.getVersion(), got.getVersion()); assertEquals(testServerInfo.getMetadata(), got.getMetadata()); } catch (Exception e) {