From a22a38527baf2457bbda282717c86721303289b1 Mon Sep 17 00:00:00 2001 From: Lai Jiang Date: Thu, 26 Sep 2024 10:10:07 -0400 Subject: [PATCH] Make GPG related tests work with the latest version of GPG (#2568) Newer versions of GPG (v.2.4.5 in my case) has uses different wording then what's available in our build image (and Ubuntu I suspect). For example it says "rsa2048" instead of "2048-bit RSA". Make the tests work in both cases. Admittedly we cannot check for the string RSA/rsa easily, but I don't think it matters much for tests. --- .../src/test/java/google/registry/rde/BrdaCopyActionTest.java | 4 +--- .../java/google/registry/rde/GhostrydeGpgIntegrationTest.java | 3 ++- .../test/java/google/registry/rde/RydeGpgIntegrationTest.java | 4 +--- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/core/src/test/java/google/registry/rde/BrdaCopyActionTest.java b/core/src/test/java/google/registry/rde/BrdaCopyActionTest.java index fb166436a..a933fee25 100644 --- a/core/src/test/java/google/registry/rde/BrdaCopyActionTest.java +++ b/core/src/test/java/google/registry/rde/BrdaCopyActionTest.java @@ -191,9 +191,7 @@ public class BrdaCopyActionTest { assertWithMessage("Literal data packet should be in BINARY mode") .that(stdout) .contains("mode b "); - assertWithMessage("Unexpected asymmetric encryption algorithm") - .that(stderr) - .contains("encrypted with 2048-bit RSA key"); + assertWithMessage("Unexpected asymmetric encryption algorithm").that(stderr).contains("2048"); assertWithMessage("Unexpected receiver public key") .that(stderr) .contains("ID 7F9084EE54E1EB0F"); diff --git a/core/src/test/java/google/registry/rde/GhostrydeGpgIntegrationTest.java b/core/src/test/java/google/registry/rde/GhostrydeGpgIntegrationTest.java index dbfc3b655..5009e17e6 100644 --- a/core/src/test/java/google/registry/rde/GhostrydeGpgIntegrationTest.java +++ b/core/src/test/java/google/registry/rde/GhostrydeGpgIntegrationTest.java @@ -87,7 +87,8 @@ class GhostrydeGpgIntegrationTest { assertThat(stdout).contains(":encrypted data packet:"); assertThat(stdout).contains("version 3, algo 1, keyid A59C132F3589A1D5"); assertThat(stdout).contains("name=\"" + Ghostryde.INNER_FILENAME + "\""); - assertThat(stderr).contains("encrypted with 2048-bit RSA key, ID A59C132F3589A1D5"); + assertThat(stderr).contains("2048"); + assertThat(stderr).contains("ID A59C132F3589A1D5"); pid = gpg.exec(GPG_BINARY, "--use-embedded-filename", file.getPath()); stderr = CharStreams.toString(new InputStreamReader(pid.getErrorStream(), UTF_8)); diff --git a/core/src/test/java/google/registry/rde/RydeGpgIntegrationTest.java b/core/src/test/java/google/registry/rde/RydeGpgIntegrationTest.java index cb23dcf23..7a8df740f 100644 --- a/core/src/test/java/google/registry/rde/RydeGpgIntegrationTest.java +++ b/core/src/test/java/google/registry/rde/RydeGpgIntegrationTest.java @@ -148,9 +148,7 @@ public class RydeGpgIntegrationTest { assertWithMessage("Literal data packet should be in BINARY mode") .that(stdout) .contains("mode b "); - assertWithMessage("Unexpected asymmetric encryption algorithm") - .that(stderr) - .contains("encrypted with 2048-bit RSA key"); + assertWithMessage("Unexpected asymmetric encryption algorithm").that(stderr).contains("2048"); assertWithMessage("Unexpected receiver public key") .that(stderr) .contains("ID 7F9084EE54E1EB0F");