Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

empty #489

Closed
wants to merge 21 commits into from
Closed

empty #489

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
98d961b
empty
scottopell Oct 19, 2023
1a25d3d
Sets DEBUG for testcontainers image build
scottopell Oct 19, 2023
9897510
Set debug for entire build
scottopell Oct 19, 2023
48c4efc
enables more testcontainers logs
scottopell Oct 19, 2023
9dfe1b7
Test if its quoting problem
scottopell Oct 19, 2023
2422342
Reverts quote and adds attempt to get extra logs
scottopell Oct 19, 2023
795cbd7
Lowers log level (maybe?) and adds check that DEBUG is set properly
scottopell Oct 19, 2023
f2bb0c9
Adds more debugg flags, give me my logs!
scottopell Oct 19, 2023
6815d08
Removes surefire debug args and re-adds them to mvn runs, touches git…
scottopell Oct 19, 2023
5ef4c16
Adds testcontainers debug var for gitlab
scottopell Oct 19, 2023
40a4e1c
Set gitlab to run automatically during testing, attempt to capture mo…
scottopell Oct 19, 2023
799073d
Adds when for artifacts
scottopell Oct 19, 2023
aa772c5
Removes incorrect logging config file and adds unit test output to ar…
scottopell Oct 19, 2023
d2580ba
ADds wildcard since log files have numbered suffix
scottopell Oct 19, 2023
9e44d1d
Attempts to move test logs to current (project) directory
scottopell Oct 19, 2023
c06f0ca
Sets up logger for TestReconnectContainer in case BeforeClass doesn't…
scottopell Oct 19, 2023
18c7a57
Updates testcontainers
scottopell Oct 19, 2023
974bf82
Simplifies maven build
scottopell Oct 19, 2023
c17e1a2
Attempt number 10000 to get logs
scottopell Oct 19, 2023
02d14a0
New run
scottopell Oct 23, 2023
a7444b2
Test more quoting, it really seems like its a quote issue
scottopell Oct 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ lint_steps: &lint_steps
- checkout
- run: ./mvnw verify -B -Dhttps.protocols=TLSv1.2 -DskipTests
build_steps: &build_steps
environment:
DEBUG: testcontainers*
steps:
- checkout
- setup_remote_docker
- run: ./mvnw test -B -Dhttps.protocols=TLSv1.2 -Dcheckstyle.skip=true -Dtests.log_level=info -Djdk.attach.allowAttachSelf=true
- run: echo $DEBUG && ./mvnw -X test -B -Dhttps.protocols=TLSv1.2 -Dcheckstyle.skip=true -Dtests.log_level=debug -Djdk.attach.allowAttachSelf=true -Dtest=TestReconnectContainer
- run:
when: on_fail
command: for log in target/surefire-reports/*.txt; do echo "$log ========================" ; cat $log ; done
Expand Down Expand Up @@ -42,9 +44,4 @@ workflows:
version: 2
workflow:
jobs:
- lint_openjdk8
- test_openjdk8
- test_openjdk11
- test_openjdk15
- test_openjdk17
- test_openjdk19
9 changes: 6 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ variables:
# ryuk is a privileged container started by testcontainers which cleans up containers at the end of testing
# It is not necessary for our gitlab CI env as #ci-cd infra tears everything down at the end of a gitlab run
TESTCONTAINERS_RYUK_DISABLED: "true"
DEBUG: testcontainers*


# Testing is handled by circleCI for PRs, but we also run maven tests as part of the deploy process
Expand All @@ -16,7 +17,7 @@ run_unit_tests:
stage: run_unit_tests

rules:
- when: manual
- when: always
allow_failure: true

tags:
Expand All @@ -25,12 +26,14 @@ run_unit_tests:
image: eclipse-temurin:8u382-b05-jdk

script:
- ./mvnw -Dhttps.protocols=TLSv1.2 -Dcheckstyle.skip=true -Dtests.log_level=info -Djdk.attach.allowAttachSelf=true -B test
- ./mvnw -Dhttps.protocols=TLSv1.2 -Dcheckstyle.skip=true -Dtests.log_level=ALL -Dtest=TestReconnectContainer#testJMXDirectReconnect -Djdk.attach.allowAttachSelf=true -B test

artifacts:
expire_in: 1 mos
when: always
paths:
- ./target/surefire-reports/*.txt
- target/surefire-reports/*.txt
- target/jmxfetch_test.log*


# From the tagged repo, push the release artifact
Expand Down
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>1.18.0</version>
<version>1.19.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -225,6 +225,7 @@
<!-- allowAttachSelf required for tests in jdk9+ ref https://bugs.openjdk.org/browse/JDK-8180425 -->
<!-- rmi.server.hostname required for tests in some MacOS configurations -->
<argLine>-Djdk.attach.allowAttachSelf=true -Djava.rmi.server.hostname=localhost</argLine>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
</configuration>
</plugin>
<plugin>
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/org/datadog/jmxfetch/TestCommon.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static void init() throws Exception {
if (level == null) {
level = "ALL";
}
CustomLogger.setup(LogLevel.ALL, "/tmp/jmxfetch_test.log", false);
CustomLogger.setup(LogLevel.ALL, "./target/jmxfetch_test.log", false);
}

/**
Expand Down Expand Up @@ -168,7 +168,7 @@ protected void initApplication(String yamlFileName) throws FileNotFoundException
}

/*
* Init JMXFetch with the given YAML configuration template
* Init JMXFetch with the given YAML configuration template
* The configuration can be specified as a yaml literal with each arg
* representing one line of the Yaml file
* Does not support any SD/AD features.
Expand All @@ -180,7 +180,7 @@ protected void initApplicationWithYamlLines(String... yamlLines)

String confdDirectory = tempFile.getParent().toString();
String yamlFileName = tempFile.getFileName().toString();

List<String> params = new ArrayList<String>();
params.add("--reporter");
params.add("console");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import javax.management.remote.JMXServiceURL;

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestRule;
Expand All @@ -28,6 +29,8 @@
import java.nio.file.Paths;

import org.datadog.jmxfetch.reporter.ConsoleReporter;
import org.datadog.jmxfetch.util.CustomLogger;
import org.datadog.jmxfetch.util.LogLevel;


@Slf4j
Expand All @@ -54,6 +57,11 @@ private static boolean isDomainPresent(String domain, MBeanServerConnection mbs)
return found;
}

@BeforeClass
public static void init() throws Exception {
CustomLogger.setup(LogLevel.ALL, "./target/jmxfetch_test.log", false);
}

private static ImageFromDockerfile img = new ImageFromDockerfile()
.withFileFromPath(".", Paths.get("./tools/misbehaving-jmx-server/"));

Expand Down
4 changes: 2 additions & 2 deletions tools/misbehaving-jmx-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ RUN mvn dependency:resolve

# Copy the source code and build the JAR file
COPY src/ /app/src/
RUN mvn clean package assembly:single
RUN ["mvn", "compile", "assembly:single"]

RUN ls /app/target

Expand All @@ -24,4 +24,4 @@ WORKDIR /app
COPY --from=build /app/target/misbehavingjmxserver-1.0-SNAPSHOT-jar-with-dependencies.jar .

# Run the supervisor class from the jar
CMD ["java", "-cp", "misbehavingjmxserver-1.0-SNAPSHOT-jar-with-dependencies.jar", "org.datadog.supervisor.App"]
CMD ["java", "-cp", "misbehavingjmxserver-1.0-SNAPSHOT-jar-with-dependencies.jar", "org.datadog.supervisor.App"]
Binary file added tools/misbehaving-jmx-server/dd-java-agent.jar
Binary file not shown.
Loading