mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
refactor: remove unused code (#1303)
* refactor: remove unused imports and dead references * chore: remove unused suppress warnings and cleanup formatting
This commit is contained in:
1 parent
e6748862b1
commit
ee341003bf
37 files changed
+78
-142
No files matched your search
+25
-28
@@ -17,13 +17,11 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
/**
|
||||
* Unit tests for metadata loading and comparison in TlsConfigSource.
|
||||
*
|
||||
* Tests the hostnameConfigChanged() method to verify:
|
||||
* - Returns true when metadata file doesn't exist
|
||||
* - Returns true when hostnames have changed
|
||||
* - Returns false when hostnames are the same (order-independent)
|
||||
* - Handles read/parse failures gracefully (returns true)
|
||||
* - Proper logging for different scenarios
|
||||
*
|
||||
* Tests the hostnameConfigChanged() method to verify: - Returns true when metadata file doesn't
|
||||
* exist - Returns true when hostnames have changed - Returns false when hostnames are the same
|
||||
* (order-independent) - Handles read/parse failures gracefully (returns true) - Proper logging for
|
||||
* different scenarios
|
||||
*/
|
||||
class TlsConfigSourceMetadataComparisonTest {
|
||||
|
||||
@@ -67,11 +65,11 @@ class TlsConfigSourceMetadataComparisonTest {
|
||||
// Arrange
|
||||
Path tlsDir = tempDir.resolve("tls");
|
||||
Files.createDirectories(tlsDir);
|
||||
|
||||
|
||||
// Create metadata with old hostnames
|
||||
List<String> oldHostnames = List.of("localhost", "127.0.0.1", "oldhost");
|
||||
createMetadataFile(tlsDir, oldHostnames);
|
||||
|
||||
|
||||
// Current hostnames are different
|
||||
List<String> currentHostnames = List.of("localhost", "127.0.0.1", "newhost");
|
||||
|
||||
@@ -87,11 +85,11 @@ class TlsConfigSourceMetadataComparisonTest {
|
||||
// Arrange
|
||||
Path tlsDir = tempDir.resolve("tls");
|
||||
Files.createDirectories(tlsDir);
|
||||
|
||||
|
||||
// Create metadata with hostnames
|
||||
List<String> hostnames = List.of("localhost", "127.0.0.1", "myhost");
|
||||
createMetadataFile(tlsDir, hostnames);
|
||||
|
||||
|
||||
// Current hostnames are the same
|
||||
List<String> currentHostnames = List.of("localhost", "127.0.0.1", "myhost");
|
||||
|
||||
@@ -107,11 +105,11 @@ class TlsConfigSourceMetadataComparisonTest {
|
||||
// Arrange
|
||||
Path tlsDir = tempDir.resolve("tls");
|
||||
Files.createDirectories(tlsDir);
|
||||
|
||||
|
||||
// Create metadata with hostnames in one order
|
||||
List<String> hostnames = List.of("localhost", "myhost", "127.0.0.1");
|
||||
createMetadataFile(tlsDir, hostnames);
|
||||
|
||||
|
||||
// Current hostnames in different order
|
||||
List<String> currentHostnames = List.of("127.0.0.1", "localhost", "myhost");
|
||||
|
||||
@@ -127,11 +125,11 @@ class TlsConfigSourceMetadataComparisonTest {
|
||||
// Arrange
|
||||
Path tlsDir = tempDir.resolve("tls");
|
||||
Files.createDirectories(tlsDir);
|
||||
|
||||
|
||||
// Create metadata with fewer hostnames
|
||||
List<String> oldHostnames = List.of("localhost", "127.0.0.1");
|
||||
createMetadataFile(tlsDir, oldHostnames);
|
||||
|
||||
|
||||
// Current hostnames include an additional hostname
|
||||
List<String> currentHostnames = List.of("localhost", "127.0.0.1", "newhost");
|
||||
|
||||
@@ -147,11 +145,11 @@ class TlsConfigSourceMetadataComparisonTest {
|
||||
// Arrange
|
||||
Path tlsDir = tempDir.resolve("tls");
|
||||
Files.createDirectories(tlsDir);
|
||||
|
||||
|
||||
// Create metadata with more hostnames
|
||||
List<String> oldHostnames = List.of("localhost", "127.0.0.1", "oldhost");
|
||||
createMetadataFile(tlsDir, oldHostnames);
|
||||
|
||||
|
||||
// Current hostnames have one removed
|
||||
List<String> currentHostnames = List.of("localhost", "127.0.0.1");
|
||||
|
||||
@@ -167,11 +165,11 @@ class TlsConfigSourceMetadataComparisonTest {
|
||||
// Arrange
|
||||
Path tlsDir = tempDir.resolve("tls");
|
||||
Files.createDirectories(tlsDir);
|
||||
|
||||
|
||||
// Create malformed metadata file
|
||||
Path metadataFile = tlsDir.resolve("floci-selfsigned.metadata.json");
|
||||
Files.writeString(metadataFile, "{ invalid json }");
|
||||
|
||||
|
||||
List<String> currentHostnames = List.of("localhost", "127.0.0.1");
|
||||
|
||||
// Act
|
||||
@@ -186,12 +184,12 @@ class TlsConfigSourceMetadataComparisonTest {
|
||||
// Arrange
|
||||
Path tlsDir = tempDir.resolve("tls");
|
||||
Files.createDirectories(tlsDir);
|
||||
|
||||
|
||||
// Create metadata with null hostnames field
|
||||
Path metadataFile = tlsDir.resolve("floci-selfsigned.metadata.json");
|
||||
String json = "{\"generatedAt\":\"" + Instant.now().toString() + "\",\"flociVersion\":\"dev\"}";
|
||||
Files.writeString(metadataFile, json);
|
||||
|
||||
|
||||
List<String> currentHostnames = List.of("localhost", "127.0.0.1");
|
||||
|
||||
// Act
|
||||
@@ -206,11 +204,11 @@ class TlsConfigSourceMetadataComparisonTest {
|
||||
// Arrange
|
||||
Path tlsDir = tempDir.resolve("tls");
|
||||
Files.createDirectories(tlsDir);
|
||||
|
||||
|
||||
// Create metadata with empty hostnames list
|
||||
List<String> emptyHostnames = List.of();
|
||||
createMetadataFile(tlsDir, emptyHostnames);
|
||||
|
||||
|
||||
// Current hostnames are also empty
|
||||
List<String> currentHostnames = List.of();
|
||||
|
||||
@@ -227,22 +225,21 @@ class TlsConfigSourceMetadataComparisonTest {
|
||||
private void createMetadataFile(Path tlsDir, List<String> hostnames) throws IOException {
|
||||
Path metadataFile = tlsDir.resolve("floci-selfsigned.metadata.json");
|
||||
CertificateMetadata metadata = CertificateMetadata.create(hostnames, "dev");
|
||||
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
String json = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(metadata);
|
||||
Files.writeString(metadataFile, json);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to invoke the private hostnameConfigChanged() method via reflection.
|
||||
* We need to disable TLS temporarily to avoid certificate generation in the constructor.
|
||||
* Helper method to invoke the private hostnameConfigChanged() method via reflection. We need to
|
||||
* disable TLS temporarily to avoid certificate generation in the constructor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private boolean invokeHostnameConfigChanged(Path tlsDir, List<String> currentHostnames) throws Exception {
|
||||
// Temporarily disable TLS to avoid certificate generation in constructor
|
||||
String originalTlsEnabled = System.getProperty("floci.tls.enabled");
|
||||
System.setProperty("floci.tls.enabled", "false");
|
||||
|
||||
|
||||
try {
|
||||
TlsConfigSource configSource = new TlsConfigSource();
|
||||
Method method = TlsConfigSource.class.getDeclaredMethod("hostnameConfigChanged", Path.class, List.class);
|
||||
|
||||
+26
-27
@@ -9,13 +9,12 @@ import org.junit.jupiter.api.io.TempDir;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
/**
|
||||
* Unit tests for metadata persistence in TlsConfigSource.
|
||||
*
|
||||
*
|
||||
* Tests that metadata is correctly persisted after certificate generation:
|
||||
* - Metadata file is created
|
||||
* - Metadata contains correct hostnames
|
||||
@@ -55,7 +54,7 @@ class TlsConfigSourceMetadataPersistenceTest {
|
||||
|
||||
// Assert
|
||||
Path metadataFile = tempDir.resolve("tls/floci-selfsigned.metadata.json");
|
||||
assertTrue(Files.exists(metadataFile),
|
||||
assertTrue(Files.exists(metadataFile),
|
||||
"Metadata file should be created after certificate generation");
|
||||
}
|
||||
|
||||
@@ -70,19 +69,19 @@ class TlsConfigSourceMetadataPersistenceTest {
|
||||
// Assert
|
||||
Path metadataFile = tempDir.resolve("tls/floci-selfsigned.metadata.json");
|
||||
CertificateMetadata metadata = readMetadata(metadataFile);
|
||||
|
||||
|
||||
assertNotNull(metadata.getHostnames(), "Hostnames should not be null");
|
||||
assertTrue(metadata.getHostnames().contains("localhost"),
|
||||
assertTrue(metadata.getHostnames().contains("localhost"),
|
||||
"Metadata should contain 'localhost'");
|
||||
assertTrue(metadata.getHostnames().contains("127.0.0.1"),
|
||||
assertTrue(metadata.getHostnames().contains("127.0.0.1"),
|
||||
"Metadata should contain '127.0.0.1'");
|
||||
assertTrue(metadata.getHostnames().contains("0.0.0.0"),
|
||||
assertTrue(metadata.getHostnames().contains("0.0.0.0"),
|
||||
"Metadata should contain '0.0.0.0'");
|
||||
assertTrue(metadata.getHostnames().contains("*.localhost"),
|
||||
assertTrue(metadata.getHostnames().contains("*.localhost"),
|
||||
"Metadata should contain '*.localhost'");
|
||||
assertTrue(metadata.getHostnames().contains("localhost.floci.io"),
|
||||
assertTrue(metadata.getHostnames().contains("localhost.floci.io"),
|
||||
"Metadata should contain 'localhost.floci.io'");
|
||||
assertTrue(metadata.getHostnames().contains("*.localhost.floci.io"),
|
||||
assertTrue(metadata.getHostnames().contains("*.localhost.floci.io"),
|
||||
"Metadata should contain '*.localhost.floci.io'");
|
||||
}
|
||||
|
||||
@@ -100,8 +99,8 @@ class TlsConfigSourceMetadataPersistenceTest {
|
||||
// Assert
|
||||
Path metadataFile = tempDir.resolve("tls/floci-selfsigned.metadata.json");
|
||||
CertificateMetadata metadata = readMetadata(metadataFile);
|
||||
|
||||
assertTrue(metadata.getHostnames().contains("floci"),
|
||||
|
||||
assertTrue(metadata.getHostnames().contains("floci"),
|
||||
"Metadata should contain custom hostname 'floci'");
|
||||
}
|
||||
|
||||
@@ -119,8 +118,8 @@ class TlsConfigSourceMetadataPersistenceTest {
|
||||
// Assert
|
||||
Path metadataFile = tempDir.resolve("tls/floci-selfsigned.metadata.json");
|
||||
CertificateMetadata metadata = readMetadata(metadataFile);
|
||||
|
||||
assertTrue(metadata.getHostnames().contains("myhost"),
|
||||
|
||||
assertTrue(metadata.getHostnames().contains("myhost"),
|
||||
"Metadata should contain hostname 'myhost' from base URL");
|
||||
}
|
||||
|
||||
@@ -139,10 +138,10 @@ class TlsConfigSourceMetadataPersistenceTest {
|
||||
// Assert
|
||||
Path metadataFile = tempDir.resolve("tls/floci-selfsigned.metadata.json");
|
||||
CertificateMetadata metadata = readMetadata(metadataFile);
|
||||
|
||||
assertTrue(metadata.getHostnames().contains("newhost"),
|
||||
|
||||
assertTrue(metadata.getHostnames().contains("newhost"),
|
||||
"Metadata should contain 'newhost' from FLOCI_HOSTNAME");
|
||||
assertTrue(metadata.getHostnames().contains("oldhost"),
|
||||
assertTrue(metadata.getHostnames().contains("oldhost"),
|
||||
"Metadata should contain 'oldhost' from FLOCI_BASE_URL");
|
||||
}
|
||||
|
||||
@@ -157,10 +156,10 @@ class TlsConfigSourceMetadataPersistenceTest {
|
||||
// Assert
|
||||
Path metadataFile = tempDir.resolve("tls/floci-selfsigned.metadata.json");
|
||||
CertificateMetadata metadata = readMetadata(metadataFile);
|
||||
|
||||
assertNotNull(metadata.getGeneratedAt(),
|
||||
|
||||
assertNotNull(metadata.getGeneratedAt(),
|
||||
"Metadata should contain generatedAt timestamp");
|
||||
assertFalse(metadata.getGeneratedAt().isBlank(),
|
||||
assertFalse(metadata.getGeneratedAt().isBlank(),
|
||||
"Timestamp should not be blank");
|
||||
}
|
||||
|
||||
@@ -175,10 +174,10 @@ class TlsConfigSourceMetadataPersistenceTest {
|
||||
// Assert
|
||||
Path metadataFile = tempDir.resolve("tls/floci-selfsigned.metadata.json");
|
||||
CertificateMetadata metadata = readMetadata(metadataFile);
|
||||
|
||||
assertNotNull(metadata.getFlociVersion(),
|
||||
|
||||
assertNotNull(metadata.getFlociVersion(),
|
||||
"Metadata should contain flociVersion");
|
||||
assertEquals("dev", metadata.getFlociVersion(),
|
||||
assertEquals("dev", metadata.getFlociVersion(),
|
||||
"Version should default to 'dev' when FLOCI_VERSION not set");
|
||||
}
|
||||
|
||||
@@ -190,15 +189,15 @@ class TlsConfigSourceMetadataPersistenceTest {
|
||||
// Arrange
|
||||
// Note: We can't set environment variables in Java, so we'll test the default behavior
|
||||
// The actual environment variable handling is tested in integration tests
|
||||
|
||||
|
||||
// Act
|
||||
new TlsConfigSource();
|
||||
|
||||
// Assert
|
||||
Path metadataFile = tempDir.resolve("tls/floci-selfsigned.metadata.json");
|
||||
CertificateMetadata metadata = readMetadata(metadataFile);
|
||||
|
||||
assertNotNull(metadata.getFlociVersion(),
|
||||
|
||||
assertNotNull(metadata.getFlociVersion(),
|
||||
"Metadata should contain flociVersion");
|
||||
}
|
||||
|
||||
@@ -213,7 +212,7 @@ class TlsConfigSourceMetadataPersistenceTest {
|
||||
// Assert
|
||||
Path metadataFile = tempDir.resolve("tls/floci-selfsigned.metadata.json");
|
||||
String json = Files.readString(metadataFile);
|
||||
|
||||
|
||||
assertFalse(json.isBlank(), "Metadata file should not be empty");
|
||||
assertTrue(json.contains("hostnames"), "JSON should contain 'hostnames' field");
|
||||
assertTrue(json.contains("generatedAt"), "JSON should contain 'generatedAt' field");
|
||||
|
||||
@@ -3,7 +3,6 @@ package io.github.hectorvent.floci.core.common.docker;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
-3
@@ -1,7 +1,6 @@
|
||||
package io.github.hectorvent.floci.services.apigatewayv2.proxy;
|
||||
|
||||
import com.sun.net.httpserver.Headers;
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
import com.sun.net.httpserver.HttpServer;
|
||||
import io.github.hectorvent.floci.services.apigatewayv2.model.Integration;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
@@ -11,9 +10,7 @@ import org.junit.jupiter.api.Test;
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
|
||||
+1
-3
@@ -8,13 +8,11 @@ import io.github.hectorvent.floci.core.common.AwsException;
|
||||
import io.github.hectorvent.floci.core.common.ReservedTags;
|
||||
import io.github.hectorvent.floci.core.common.RegionResolver;
|
||||
import io.github.hectorvent.floci.core.storage.InMemoryStorage;
|
||||
import io.github.hectorvent.floci.services.cognito.model.UserPool;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Spliterators;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -95,7 +93,7 @@ class CognitoJsonHandlerTest {
|
||||
assertEquals("test-pool", pool.get("Name").asText());
|
||||
assertTrue(pool.get("Arn").asText().contains("arn:aws:cognito-idp:us-east-1:000000000000:userpool/"));
|
||||
assertEquals("Enabled", pool.get("Status").asText());
|
||||
|
||||
|
||||
// Check mandatory blocks for Terraform
|
||||
assertNotNull(pool.get("SchemaAttributes"));
|
||||
assertEquals(20, pool.get("SchemaAttributes").size(),
|
||||
|
||||
@@ -680,7 +680,6 @@ class CognitoServiceTest {
|
||||
// =========================================================================
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
void adminSetUserPasswordPermanentFalseChangesPassword() {
|
||||
UserPool pool = createPoolAndUser(); // alice has permanent "Perm1234!"
|
||||
UserPoolClient client = service.createUserPoolClient(pool.getId(), "c", false, false, List.of(), List.of());
|
||||
@@ -1097,7 +1096,6 @@ class CognitoServiceTest {
|
||||
String session2 = (String) retryResult.get("Session");
|
||||
|
||||
// Eventually correct answer issues tokens
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> tokenResult = service.respondToAuthChallenge(
|
||||
client.getClientId(), "CUSTOM_CHALLENGE", session2,
|
||||
Map.of("USERNAME", "alice", "ANSWER", "secret-otp"));
|
||||
|
||||
-1
@@ -2,7 +2,6 @@ package io.github.hectorvent.floci.services.cognito;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
-1
@@ -10,7 +10,6 @@ import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.BufferedReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
import static io.restassured.RestAssured.given;
|
||||
|
||||
+2
-6
@@ -1,19 +1,15 @@
|
||||
package io.github.hectorvent.floci.services.dynamodb;
|
||||
|
||||
import io.github.hectorvent.floci.core.common.AwsException;
|
||||
import io.github.hectorvent.floci.core.storage.InMemoryStorage;
|
||||
import io.github.hectorvent.floci.core.storage.StorageBackend;
|
||||
import io.github.hectorvent.floci.services.dynamodb.model.AttributeDefinition;
|
||||
import io.github.hectorvent.floci.services.dynamodb.model.KeySchemaElement;
|
||||
import io.github.hectorvent.floci.services.dynamodb.model.StreamDescription;
|
||||
import io.github.hectorvent.floci.services.dynamodb.model.TableDefinition;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
@@ -34,8 +30,8 @@ class DynamoDbStreamServiceTest {
|
||||
}
|
||||
|
||||
private TableDefinition createTestTableWithStream() {
|
||||
var tableDef = new TableDefinition("TestTable",
|
||||
List.of(new KeySchemaElement("userId", "HASH")),
|
||||
var tableDef = new TableDefinition("TestTable",
|
||||
List.of(new KeySchemaElement("userId", "HASH")),
|
||||
List.of(new AttributeDefinition("userId", "S")),
|
||||
"us-east-1", "000000000000");
|
||||
tableDef.setStreamEnabled(true);
|
||||
|
||||
@@ -90,7 +90,6 @@ class KinesisServiceTest {
|
||||
"TRIM_HORIZON", null, REGION);
|
||||
Map<String, Object> result = kinesisService.getRecords(iterator, 10, REGION);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
var records = (List<?>) result.get("Records");
|
||||
assertEquals(1, records.size());
|
||||
}
|
||||
@@ -104,7 +103,6 @@ class KinesisServiceTest {
|
||||
String iterator = kinesisService.getShardIterator("my-stream", shardId, "LATEST", null, REGION);
|
||||
Map<String, Object> result = kinesisService.getRecords(iterator, 10, REGION);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
var records = (List<?>) result.get("Records");
|
||||
assertTrue(records.isEmpty());
|
||||
assertEquals(0L, ((Number) result.get("MillisBehindLatest")).longValue());
|
||||
@@ -132,7 +130,6 @@ class KinesisServiceTest {
|
||||
|
||||
Map<String, Object> result = kinesisService.getRecords(iterator, 10, REGION);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
var records = (List<?>) result.get("Records");
|
||||
assertEquals(2, records.size());
|
||||
assertEquals(0L, ((Number) result.get("MillisBehindLatest")).longValue());
|
||||
@@ -157,7 +154,6 @@ class KinesisServiceTest {
|
||||
|
||||
Map<String, Object> result = kinesisService.getRecords(iterator, 2, REGION);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
var returned = (List<?>) result.get("Records");
|
||||
assertEquals(2, returned.size());
|
||||
// Last returned = records[1] at +1500ms, tip = records[2] at +4000ms, delta = 2500ms
|
||||
@@ -404,4 +400,4 @@ class KinesisServiceTest {
|
||||
.get("Records");
|
||||
assertEquals(1, got.size(), "AT_TIMESTAMP boundary is >= (inclusive)");
|
||||
}
|
||||
}
|
||||
}
|
||||
-1
@@ -7,7 +7,6 @@ import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestMethodOrder;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.Base64;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
|
||||
@@ -3,9 +3,6 @@ package io.github.hectorvent.floci.services.sns;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
|
||||
@@ -16,7 +13,7 @@ class SnsLambdaIntegrationTest {
|
||||
void publish_toLambdaSubscriber() {
|
||||
// 1. Create a Lambda function using the REST API (skipping code to bypass validation)
|
||||
String functionName = "sns-subscriber-fn";
|
||||
|
||||
|
||||
String lambdaRequest = String.format(
|
||||
"{\"FunctionName\":\"%s\",\"Runtime\":\"nodejs18.x\",\"Handler\":\"index.handler\",\"Role\":\"arn:aws:iam::000000000000:role/lambda-role\"}",
|
||||
functionName
|
||||
@@ -68,7 +65,7 @@ class SnsLambdaIntegrationTest {
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body(containsString("<MessageId>"));
|
||||
|
||||
|
||||
// Note: Actual invocation check would require mocking the Docker/Executor,
|
||||
// but here we just want to see if it reaches the delivery logic without crashing.
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ public final class IamServiceTestHelper {
|
||||
private IamServiceTestHelper() {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static IamService iamServiceWithAccessKey(String accessKeyId, String secretAccessKey) {
|
||||
try {
|
||||
Constructor<IamService> constructor = IamService.class.getDeclaredConstructor(
|
||||
|
||||
Reference in new issue
Block a user