chore: Added capability of running ITs on maven (#38354)
This commit is contained in:
parent
a8cb8aac44
commit
2dfa24ee91
|
|
@ -25,6 +25,7 @@ public class GitContext implements TestTemplateInvocationContext, ParameterResol
|
||||||
ExtensionContext.Store contextStore = extensionContext.getStore(ExtensionContext.Namespace.create(ArtifactBuilderExtension.class));
|
ExtensionContext.Store contextStore = extensionContext.getStore(ExtensionContext.Namespace.create(ArtifactBuilderExtension.class));
|
||||||
contextStore.put(ArtifactExchangeJson.class, artifactExchangeJsonType);
|
contextStore.put(ArtifactExchangeJson.class, artifactExchangeJsonType);
|
||||||
contextStore.put("filePath", fileName);
|
contextStore.put("filePath", fileName);
|
||||||
|
contextStore.put("artifactType", artifactType);
|
||||||
this.fileName = fileName;
|
this.fileName = fileName;
|
||||||
this.artifactExchangeJsonType = artifactExchangeJsonType;
|
this.artifactExchangeJsonType = artifactExchangeJsonType;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
package com.appsmith.server.git;
|
package com.appsmith.server.git;
|
||||||
|
|
||||||
import com.appsmith.git.configurations.GitServiceConfig;
|
import com.appsmith.git.configurations.GitServiceConfig;
|
||||||
import com.appsmith.server.applications.base.ApplicationService;
|
import com.appsmith.server.artifacts.base.ArtifactService;
|
||||||
|
import com.appsmith.server.constants.ArtifactType;
|
||||||
import com.appsmith.server.constants.FieldName;
|
import com.appsmith.server.constants.FieldName;
|
||||||
import com.appsmith.server.domains.GitAuth;
|
import com.appsmith.server.domains.GitAuth;
|
||||||
import com.appsmith.server.dtos.ArtifactExchangeJson;
|
import com.appsmith.server.dtos.ArtifactExchangeJson;
|
||||||
import com.appsmith.server.git.common.CommonGitService;
|
|
||||||
import org.assertj.core.api.Assertions;
|
|
||||||
import org.junit.jupiter.api.extension.AfterAllCallback;
|
import org.junit.jupiter.api.extension.AfterAllCallback;
|
||||||
import org.junit.jupiter.api.extension.AfterEachCallback;
|
import org.junit.jupiter.api.extension.AfterEachCallback;
|
||||||
import org.junit.jupiter.api.extension.BeforeAllCallback;
|
import org.junit.jupiter.api.extension.BeforeAllCallback;
|
||||||
|
|
@ -19,8 +18,6 @@ import org.springframework.util.FileSystemUtils;
|
||||||
import org.springframework.web.reactive.function.client.WebClient;
|
import org.springframework.web.reactive.function.client.WebClient;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
|
@ -40,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||||
public class GitServerInitializerExtension implements BeforeAllCallback, BeforeEachCallback, AfterEachCallback, AfterAllCallback {
|
public class GitServerInitializerExtension implements BeforeAllCallback, BeforeEachCallback, AfterEachCallback, AfterAllCallback {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
ApplicationService applicationService;
|
ArtifactService artifactService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
GitServiceConfig gitServiceConfig;
|
GitServiceConfig gitServiceConfig;
|
||||||
|
|
@ -59,8 +56,7 @@ public class GitServerInitializerExtension implements BeforeAllCallback, BeforeE
|
||||||
@Override
|
@Override
|
||||||
public void beforeEach(ExtensionContext extensionContext) {
|
public void beforeEach(ExtensionContext extensionContext) {
|
||||||
ExtensionContext.Store parentContextStore = extensionContext.getParent().get().getStore(ExtensionContext.Namespace.create(ArtifactBuilderExtension.class));
|
ExtensionContext.Store parentContextStore = extensionContext.getParent().get().getStore(ExtensionContext.Namespace.create(ArtifactBuilderExtension.class));
|
||||||
Class<? extends ArtifactExchangeJson> aClass = parentContextStore.get(ArtifactExchangeJson.class, Class.class);
|
ArtifactType artifactType = parentContextStore.get("artifactType", ArtifactType.class);
|
||||||
String filePath = parentContextStore.get("filePath", String.class);
|
|
||||||
ExtensionContext.Store contextStore = extensionContext.getStore(ExtensionContext.Namespace.create(ArtifactBuilderExtension.class));
|
ExtensionContext.Store contextStore = extensionContext.getStore(ExtensionContext.Namespace.create(ArtifactBuilderExtension.class));
|
||||||
|
|
||||||
String artifactId = contextStore.get(FieldName.ARTIFACT_ID, String.class);
|
String artifactId = contextStore.get(FieldName.ARTIFACT_ID, String.class);
|
||||||
|
|
@ -68,7 +64,7 @@ public class GitServerInitializerExtension implements BeforeAllCallback, BeforeE
|
||||||
|
|
||||||
// TODO : Move this to artifact service to enable packages
|
// TODO : Move this to artifact service to enable packages
|
||||||
// Generate RSA public key for the given artifact
|
// Generate RSA public key for the given artifact
|
||||||
Mono<GitAuth> gitAuthMono = applicationService.createOrUpdateSshKeyPair(artifactId, "RSA");
|
Mono<GitAuth> gitAuthMono = artifactService.createOrUpdateSshKeyPair(artifactType, artifactId, "RSA");
|
||||||
|
|
||||||
String tedGitApiPath = "http://" + gitContainer.getHost() + ":" + gitContainer.getMappedPort(4200) + "/api/v1/git/";
|
String tedGitApiPath = "http://" + gitContainer.getHost() + ":" + gitContainer.getMappedPort(4200) + "/api/v1/git/";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,9 @@
|
||||||
<reactor-test.version>3.5.1</reactor-test.version>
|
<reactor-test.version>3.5.1</reactor-test.version>
|
||||||
<!-- By default skip the dockerization step. Only activate if necessary -->
|
<!-- By default skip the dockerization step. Only activate if necessary -->
|
||||||
<skipDockerBuild>true</skipDockerBuild>
|
<skipDockerBuild>true</skipDockerBuild>
|
||||||
|
<skipITs>${skipTests}</skipITs>
|
||||||
|
<skipTests>false</skipTests>
|
||||||
|
<skipUTs>${skipTests}</skipUTs>
|
||||||
<!-- We're forcing this version temporarily to fix CVE-2022-1471-->
|
<!-- We're forcing this version temporarily to fix CVE-2022-1471-->
|
||||||
<snakeyaml.version>2.0</snakeyaml.version>
|
<snakeyaml.version>2.0</snakeyaml.version>
|
||||||
<source.disabled>true</source.disabled>
|
<source.disabled>true</source.disabled>
|
||||||
|
|
@ -74,6 +77,30 @@
|
||||||
<artifactId>maven-dependency-plugin</artifactId>
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
<version>3.4.0</version>
|
<version>3.4.0</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>build-helper-maven-plugin</artifactId>
|
||||||
|
<version>3.3.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>add-test-source</id>
|
||||||
|
<goals>
|
||||||
|
<goal>add-test-source</goal>
|
||||||
|
</goals>
|
||||||
|
<phase>generate-test-sources</phase>
|
||||||
|
<configuration>
|
||||||
|
<sources>
|
||||||
|
<source>src/test/java</source>
|
||||||
|
<!-- Default test directory -->
|
||||||
|
<source>src/test/it</source>
|
||||||
|
<!-- Additional test directory -->
|
||||||
|
<source>src/test/utils</source>
|
||||||
|
<!-- Another additional directory -->
|
||||||
|
</sources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
|
@ -84,6 +111,41 @@
|
||||||
<argLine>--add-opens java.base/java.lang=ALL-UNNAMED
|
<argLine>--add-opens java.base/java.lang=ALL-UNNAMED
|
||||||
--add-opens java.base/java.time=ALL-UNNAMED
|
--add-opens java.base/java.time=ALL-UNNAMED
|
||||||
--add-opens java.base/java.util=ALL-UNNAMED</argLine>
|
--add-opens java.base/java.util=ALL-UNNAMED</argLine>
|
||||||
|
<testSourceDirectory>src/test/java</testSourceDirectory>
|
||||||
|
<skipTests>${skipUTs}</skipTests>
|
||||||
|
</configuration>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
|
<version>5.6.2</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.junit.platform</groupId>
|
||||||
|
<artifactId>junit-platform-commons</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-failsafe-plugin</artifactId>
|
||||||
|
<version>3.0.0-M5</version>
|
||||||
|
<configuration>
|
||||||
|
<printSummary>true</printSummary>
|
||||||
|
<!-- Allow JUnit to access the test classes -->
|
||||||
|
<argLine>-ea
|
||||||
|
--add-opens java.base/java.lang=ALL-UNNAMED
|
||||||
|
--add-opens java.base/java.time=ALL-UNNAMED
|
||||||
|
--add-opens java.base/java.util=ALL-UNNAMED</argLine>
|
||||||
|
<systemPropertyVariables>
|
||||||
|
<pf4j.pluginsDir>../dist/plugins</pf4j.pluginsDir>
|
||||||
|
<!-- Specify plugin directory -->
|
||||||
|
</systemPropertyVariables>
|
||||||
|
<testSourceDirectory>src/test/it</testSourceDirectory>
|
||||||
|
<skipITs>${skipITs}</skipITs>
|
||||||
|
<!-- Property for skipping integration tests -->
|
||||||
</configuration>
|
</configuration>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user