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

Release new version of JetBrains plugin #488

Merged
merged 15 commits into from
Oct 31, 2023
Merged
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
chore: re-enable test for remote recording, but only with a new Gradl…
…e target "testWithoutAgent"
jansorg authored and ahtrotta committed Oct 24, 2023
commit af01b764fc16ac995b3a922b54ffb5097f2760bf
35 changes: 28 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -122,7 +122,22 @@ allprojects {
}
}

// Target to execute tests, which are incompatible with the AppMap agent.
// Only tests with category "appland.WithoutAppMapAgent" are executed.
create<Test>("testWithoutAgent") {
useJUnit {
includeCategories("appland.WithoutAppMapAgent")
}
}

named("check") {
dependsOn(named("testWithoutAgent"))
}

withType<Test> {
// all our tests need the jar, even if the agent is disabled
dependsOn(":downloadAppMapAgent")

systemProperty("idea.test.execution.policy", "appland.AppLandTestExecutionPolicy")
systemProperty("appland.testDataPath", rootProject.rootDir.resolve("src/test/data").path)
if (isCI && githubToken != null) {
@@ -135,13 +150,6 @@ allprojects {
// always execute tests, don't skip by Gradle's up-to-date checks in development
outputs.upToDateWhen { false }

// attach AppMap agent, but only if Gradle is online
dependsOn(":downloadAppMapAgent")
jvmArgs("-javaagent:$agentOutputPath",
"-Dappmap.config.file=${rootProject.file("appmap.yml")}",
"-Dappmap.output.directory=${rootProject.file("tmp/appmap")}")
systemProperty("appmap.test.withAgent", "true")

// logging setup
testLogging {
setEvents(listOf(TestLogEvent.FAILED, TestLogEvent.STANDARD_OUT, TestLogEvent.STANDARD_ERROR))
@@ -152,6 +160,19 @@ allprojects {
}
}

// only run the default test target with the AppMap agent
named<Test>("test") {
// attach AppMap agent, but only if Gradle is online
jvmArgs("-javaagent:$agentOutputPath",
"-Dappmap.config.file=${rootProject.file("appmap.yml")}",
"-Dappmap.output.directory=${rootProject.file("tmp/appmap")}")
systemProperty("appmap.test.withAgent", "true")

useJUnit {
excludeCategories("appland.WithoutAppMapAgent")
}
}

withType<RunPluginVerifierTask> {
onlyIf { this.project == rootProject }
ideVersions.set(prop("ideVersionVerifier").split(","))
7 changes: 7 additions & 0 deletions plugin-core/src/test/java/appland/WithoutAppMapAgent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package appland;

/**
* JUnit category to mark tests, which are incompatible with the AppMap agent.
*/
public final class WithoutAppMapAgent {
}
Original file line number Diff line number Diff line change
@@ -1,36 +1,31 @@
package appland.remote;

import appland.AppMapBaseTest;
import appland.WithoutAppMapAgent;
import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.util.ThrowableComputable;
import com.intellij.testFramework.fixtures.TempDirTestFixture;
import com.intellij.testFramework.fixtures.impl.TempDirTestFixtureImpl;
import org.apache.http.HttpStatus;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Objects;

import static appland.remote.DefaultRemoteRecordingService.url;
import static com.github.tomakehurst.wiremock.client.WireMock.*;

@Category(WithoutAppMapAgent.class)
public class DefaultRemoteRecordingServiceTest extends AppMapBaseTest {
@Rule
public final WireMockRule serverRule = new WireMockRule(WireMockConfiguration.options().dynamicPort());

@BeforeClass
public static void compatibility() {
Assume.assumeFalse(Objects.equals(System.getProperty("appmap.test.withAgent"), "true"));
}

@Override
protected TempDirTestFixture createTempDirTestFixture() {
// create temp files on disk