You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ch...@apache.org on 2019/05/28 17:05:23 UTC

[flink] 01/02: [FLINK-12636][rest] Fail stability test on compatible modifications

This is an automated email from the ASF dual-hosted git repository.

chesnay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 4fe936dc8f65d57645eea908337653c76d83f400
Author: Chesnay Schepler <ch...@apache.org>
AuthorDate: Mon May 27 14:59:18 2019 +0200

    [FLINK-12636][rest] Fail stability test on compatible modifications
---
 .../rest/compatibility/RestAPIStabilityTest.java   | 12 ++++++++
 .../src/test/resources/rest_api_v1.snapshot        | 34 ++++++++++++++++++++++
 2 files changed, 46 insertions(+)

diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/rest/compatibility/RestAPIStabilityTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/rest/compatibility/RestAPIStabilityTest.java
index a388b49..be47449 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/rest/compatibility/RestAPIStabilityTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/rest/compatibility/RestAPIStabilityTest.java
@@ -131,6 +131,18 @@ public final class RestAPIStabilityTest extends TestLogger {
 					"To update the snapshot, re-run this test with -D" + REGENERATE_SNAPSHOT_PROPERTY + " being set.");
 			}
 		}
+
+		// check for entirely new calls, for which the snapshot should be updated
+		for (final JsonNode curCall : cur.calls) {
+			final List<Tuple2<JsonNode, CompatibilityCheckResult>> compatibilityCheckResults = old.calls.stream()
+				.map(oldCall -> Tuple2.of(curCall, checkCompatibility(oldCall, curCall)))
+				.collect(Collectors.toList());
+
+			if (compatibilityCheckResults.stream().noneMatch(result -> result.f1.getBackwardCompatibility() == Compatibility.IDENTICAL)) {
+				Assert.fail("The API was modified in a compatible way, but the snapshot was not updated. " +
+					"To update the snapshot, re-run this test with -D" + REGENERATE_SNAPSHOT_PROPERTY + " being set.");
+			}
+		}
 	}
 
 	private static void fail(final JsonNode oldCall, final List<Tuple2<JsonNode, CompatibilityCheckResult>> compatibilityCheckResults) {
diff --git a/flink-runtime/src/test/resources/rest_api_v1.snapshot b/flink-runtime/src/test/resources/rest_api_v1.snapshot
index 7a11004..a4a7b47 100644
--- a/flink-runtime/src/test/resources/rest_api_v1.snapshot
+++ b/flink-runtime/src/test/resources/rest_api_v1.snapshot
@@ -1269,6 +1269,40 @@
       }
     }
   }, {
+    "url" : "/jobs/:jobid/stop-with-savepoint",
+    "method" : "POST",
+    "status-code" : "202 Accepted",
+    "file-upload" : false,
+    "path-parameters" : {
+      "pathParameters" : [ {
+        "key" : "jobid"
+      } ]
+    },
+    "query-parameters" : {
+      "queryParameters" : [ ]
+    },
+    "request" : {
+      "type" : "object",
+      "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:job:savepoints:stop:StopWithSavepointRequestBody",
+      "properties" : {
+        "targetDirectory" : {
+          "type" : "string"
+        },
+        "endOfEventTime" : {
+          "type" : "boolean"
+        }
+      }
+    },
+    "response" : {
+      "type" : "object",
+      "id" : "urn:jsonschema:org:apache:flink:runtime:rest:handler:async:TriggerResponse",
+      "properties" : {
+        "request-id" : {
+          "type" : "any"
+        }
+      }
+    }
+  }, {
     "url" : "/jobs/:jobid/vertices/:vertexid",
     "method" : "GET",
     "status-code" : "200 OK",