diff --git a/adot-testbed/README.md b/adot-testbed/README.md index 9958dc895..eef107458 100644 --- a/adot-testbed/README.md +++ b/adot-testbed/README.md @@ -1,6 +1,6 @@ # Introduction -The tests require that AWS credentias are sent to the container under test. Please follow this procedure. +The tests require that AWS credentials are sent to the container under test. Please follow this procedure. ``` @@ -9,4 +9,4 @@ export AWS_ACCESS_KEY_ID= export AWS_SECRET_ACCESS_KEY= export AWS_SESSION_TOKEN= ./gradlew test --rerun-tasks --info -``` \ No newline at end of file +``` diff --git a/adot-testbed/app/src/test/java/software/amazon/adot/testbed/LogsTests.java b/adot-testbed/app/src/test/java/software/amazon/adot/testbed/LogsTests.java index 6238011a2..ee7866b76 100644 --- a/adot-testbed/app/src/test/java/software/amazon/adot/testbed/LogsTests.java +++ b/adot-testbed/app/src/test/java/software/amazon/adot/testbed/LogsTests.java @@ -1,14 +1,19 @@ package software.amazon.adot.testbed; -import java.io.FileWriter; -/* - * This Java source file was generated by the Gradle 'init' task. - */ + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.HashMap; +import java.util.HashSet; import java.util.Map; +import java.util.UUID; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + import com.github.rholder.retry.RetryerBuilder; import com.github.rholder.retry.StopStrategies; import com.github.rholder.retry.WaitStrategies; -import net.bytebuddy.asm.Advice; -import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; import org.slf4j.Logger; @@ -16,33 +21,23 @@ import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.output.Slf4jLogConsumer; import org.testcontainers.containers.wait.strategy.Wait; -import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; import org.testcontainers.utility.MountableFile; import software.amazon.awssdk.services.cloudwatchlogs.CloudWatchLogsClient; import software.amazon.awssdk.services.cloudwatchlogs.model.GetLogEventsRequest; + import java.io.BufferedReader; import java.io.File; -import java.io.FileReader; -import java.io.InputStreamReader; -import java.io.InputStream; - import java.io.FileWriter; -import java.io.IOException; import java.time.Duration; import java.time.Instant; -import java.util.ArrayList; import java.util.HashSet; -import java.util.HashMap; import java.util.UUID; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; -import java.util.stream.IntStream; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.*; - @Testcontainers(disabledWithoutDocker = true) @TestInstance(TestInstance.Lifecycle.PER_CLASS) class LogsTests { @@ -60,9 +55,10 @@ class LogsTests { private GenericContainer createAndStartCollector(String configFilePath, String logFilePath, String uniqueLogStreamName) throws IOException { -// Create an environment variable map + // Create an environment variable map Map envVariables = new HashMap<>(); envVariables.put("LOG_STREAM_NAME", uniqueLogStreamName); + var collector = new GenericContainer<>(TEST_IMAGE) .withExposedPorts(4317) .withCopyFileToContainer(MountableFile.forClasspathResource(configFilePath), "/etc/collector/config.yaml")