Skip to content

Commit

Permalink
Arrange for the Gradle integration test to run in the install phase.
Browse files Browse the repository at this point in the history
I am not sure how this test worked before. I think it happened to work as a side effect of other integration tests installing the `HEAD-SNAPSHOT` artifacts, which we stopped doing in #1451. It happens that we noticed the breakage with a Dependabot [PR](#1452) to update `gradle-test-kit`, but I think the CI was already broken.

Anyway, the Gradle test assumes it can depend on the artifacts for the current AutoValue version, and those are only available in the `install` phase.

By following the Maven convention whereby regular unit tests are called `FooTest` and integration tests are called `FooIT`, we get the right tests run in the right phases without having to specify `<include>` and the like.

RELNOTES=n/a
PiperOrigin-RevId: 511051082
  • Loading branch information
eamonnmcmanus authored and Google Java Core Libraries committed Feb 20, 2023
1 parent 56764c4 commit 4e122c1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
run: mvn -B dependency:go-offline test clean -U --quiet --fail-never -DskipTests=true -f build-pom.xml
- name: 'Test'
shell: bash
run: mvn -B verify -U --fail-at-end -Dsource.skip=true -Dmaven.javadoc.skip=true -f build-pom.xml
run: mvn -B verify install -U --fail-at-end -Dsource.skip=true -Dmaven.javadoc.skip=true -f build-pom.xml

publish_snapshot:
name: 'Publish snapshot'
Expand Down
16 changes: 15 additions & 1 deletion value/src/it/functional/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,26 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<systemPropertyVariables>
<autoValueVersion>${project.version}</autoValueVersion>
</systemPropertyVariables>
</configuration>
</plugin>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static void setSourceRoot() {
"AutoValueNotEclipseTest.java",
"CompileWithEclipseTest.java",
"CustomFieldSerializerTest.java",
"GradleTest.java",
"GradleIT.java",

// AutoBuilder sometimes needs to generate a .class file for Kotlin that is used in the
// rest of compilation, and Eclipse doesn't seem to handle that well. Presumably not many
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import org.junit.runners.JUnit4;

@RunWith(JUnit4.class)
public class GradleTest {
public class GradleIT {
@Rule public TemporaryFolder fakeProject = new TemporaryFolder();

private static final String BUILD_GRADLE_TEXT =
Expand Down Expand Up @@ -76,6 +76,7 @@ public class GradleTest {

@Test
public void basic() throws IOException {
assertThat(true).isFalse();
String autoValueVersion = System.getProperty("autoValueVersion");
assertThat(autoValueVersion).isNotNull();
String localRepository = System.getProperty("localRepository");
Expand Down

0 comments on commit 4e122c1

Please sign in to comment.