-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for enabled in config (#262)
* Add support for enabled in config Signed-off-by: Pavol Loffay <p.loffay@gmail.com> * smoke test Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
- Loading branch information
1 parent
99b0082
commit 35897aa
Showing
8 changed files
with
99 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
...e-tests/src/test/java/org/hypertrace/agent/smoketest/SpringBootDiabledAgentSmokeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Copyright The Hypertrace Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.hypertrace.agent.smoketest; | ||
|
||
import java.io.IOException; | ||
import okhttp3.Request; | ||
import okhttp3.Response; | ||
import org.awaitility.core.ConditionTimeoutException; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.testcontainers.containers.GenericContainer; | ||
import org.testcontainers.utility.MountableFile; | ||
|
||
public class SpringBootDiabledAgentSmokeTest extends AbstractSmokeTest { | ||
|
||
@Override | ||
protected String getTargetImage(int jdk) { | ||
return "ghcr.io/open-telemetry/java-test-containers:smoke-springboot-jdk" | ||
+ jdk | ||
+ "-20210209.550405798"; | ||
} | ||
|
||
private GenericContainer app; | ||
|
||
@BeforeEach | ||
void beforeEach() { | ||
app = createAppUnderTest(8); | ||
app.addEnv("HT_ENABLED", "false"); | ||
app.withCopyFileToContainer( | ||
MountableFile.forClasspathResource("/ht-config-all-disabled.yaml"), | ||
"/etc/ht-config-all-disabled.yaml"); | ||
app.withEnv("HT_CONFIG_FILE", "/etc/ht-config-all-disabled.yaml"); | ||
app.start(); | ||
} | ||
|
||
@AfterEach | ||
void afterEach() { | ||
if (app != null) { | ||
app.stop(); | ||
} | ||
} | ||
|
||
@Test() | ||
public void get() throws IOException { | ||
// TODO test with multiple JDK (11, 14) | ||
String url = String.format("http://localhost:%d/greeting", app.getMappedPort(8080)); | ||
Request request = new Request.Builder().url(url).get().build(); | ||
|
||
try (Response response = client.newCall(request).execute()) { | ||
Assertions.assertEquals(response.body().string(), "Hi!"); | ||
} | ||
|
||
Assertions.assertThrows( | ||
ConditionTimeoutException.class, | ||
() -> { | ||
waitForTraces(); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters