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

Some code start tests test the version which is not compatible with releases #15142

Closed
gsmet opened this issue Feb 17, 2021 · 4 comments · Fixed by #15146
Closed

Some code start tests test the version which is not compatible with releases #15142

gsmet opened this issue Feb 17, 2021 · 4 comments · Fixed by #15146
Assignees
Labels
area/jbang Issues related to when using jbang.dev with Quarkus kind/bug Something isn't working
Milestone

Comments

@gsmet
Copy link
Member

gsmet commented Feb 17, 2021

Got these errors while releasing:

[ERROR] Failures: 
[ERROR]   QuarkusJBangCodestartGenerationTest.generatePicocliProject:55 [check snapshot for: QuarkusJBangCodestartGenerationTest/generatePicocliProject/src_GreetingCommand.java] 
Path:
  target/jbang-codestart-gen-test/picocli/src/GreetingCommand.java
read with charset UTF-8 does not have the expected content:

Changed content at line 2:
expecting:
  ["//DEPS io.quarkus:quarkus-bom:999-SNAPSHOT@pom"]
but was:
  ["//DEPS io.quarkus:quarkus-bom:1.12.0.Final@pom"]

[ERROR]   QuarkusCodestartGenerationTest.generateDefault:90 [check snapshot for: QuarkusCodestartGenerationTest/generateDefault/pom.xml] 
Path:
  target/quarkus-codestart-gen-test/default/pom.xml
read with charset UTF-8 does not have the expected content:

Changed content at line 15:
expecting:
  ["    <quarkus-plugin.version>999-SNAPSHOT</quarkus-plugin.version>"]
but was:
  ["    <quarkus-plugin.version>1.12.0.Final</quarkus-plugin.version>"]

Changed content at line 18:
expecting:
  ["    <quarkus.platform.version>999-SNAPSHOT</quarkus.platform.version>"]
but was:
  ["    <quarkus.platform.version>1.12.0.Final</quarkus.platform.version>"]

[ERROR]   QuarkusCodestartGenerationTest.generateMavenWithCustomDep:200 [check snapshot for: QuarkusCodestartGenerationTest/generateMavenWithCustomDep/pom.xml] 
Path:
  target/quarkus-codestart-gen-test/maven-custom-dep/pom.xml
read with charset UTF-8 does not have the expected content:

Changed content at line 15:
expecting:
  ["    <quarkus-plugin.version>999-SNAPSHOT</quarkus-plugin.version>"]
but was:
  ["    <quarkus-plugin.version>1.12.0.Final</quarkus-plugin.version>"]

Changed content at line 18:
expecting:
  ["    <quarkus.platform.version>999-SNAPSHOT</quarkus.platform.version>"]
but was:
  ["    <quarkus.platform.version>1.12.0.Final</quarkus.platform.version>"]

[ERROR]   QuarkusCodestartGenerationTest.generateRESTEasyJavaCustom:152 [check snapshot for: QuarkusCodestartGenerationTest/generateRESTEasyJavaCustom/src_main_resources_META-INF_resources_index.html] 
Path:
  target/quarkus-codestart-gen-test/resteasy-java-custom/src/main/resources/META-INF/resources/index.html
read with charset UTF-8 does not have the expected content:

Changed content at line 149:
expecting:
  ["                <li>Quarkus Version: <code>999-SNAPSHOT</code></li>"]
but was:
  ["                <li>Quarkus Version: <code>1.12.0.Final</code></li>"]

[ERROR]   QuarkusCodestartGenerationTest.generateRESTEasySpringWeb:181 [check snapshot for: QuarkusCodestartGenerationTest/generateRESTEasySpringWeb/src_main_resources_META-INF_resources_index.html] 
Path:
  target/quarkus-codestart-gen-test/resteasy-springweb/src/main/resources/META-INF/resources/index.html
read with charset UTF-8 does not have the expected content:

Changed content at line 155:
expecting:
  ["                <li>Quarkus Version: <code>999-SNAPSHOT</code></li>"]
but was:
  ["                <li>Quarkus Version: <code>1.12.0.Final</code></li>"]

[INFO] 
[ERROR] Tests run: 106, Failures: 5, Errors: 0, Skipped: 0

We can't count on the version to always be 999-SNAPSHOT, we shouldn't test that.

@gsmet gsmet added the kind/bug Something isn't working label Feb 17, 2021
@quarkus-bot quarkus-bot bot added the area/jbang Issues related to when using jbang.dev with Quarkus label Feb 17, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Feb 17, 2021

/cc @maxandersen, @quarkusio/devtools

@ia3andy
Copy link
Contributor

ia3andy commented Feb 17, 2021

Ok I will look for all snapshots containing versions and fix it..

@gsmet
Copy link
Member Author

gsmet commented Feb 17, 2021

Yeah, I don't think we can test this easily so I would rather drop the test on the version.

Otherwise, you need a reliable way to get the current version, not sure if we have that.

@ia3andy
Copy link
Contributor

ia3andy commented Feb 17, 2021

void generatePicocliProject(TestInfo testInfo) throws Throwable {
        final QuarkusPlatformDescriptor platformDescriptor = getPlatformDescriptor();
        final QuarkusJBangCodestartProjectInput input = QuarkusJBangCodestartProjectInput.builder()
                .addCodestart("jbang-picocli-code")
>>>                .putData(QUARKUS_BOM_GROUP_ID, platformDescriptor.getBomGroupId())
>>>                .putData(QUARKUS_BOM_ARTIFACT_ID, platformDescriptor.getBomArtifactId())
>>>                .putData(QUARKUS_BOM_VERSION, platformDescriptor.getBomVersion())
                .build();
        final Path projectDir = testDirPath.resolve("picocli");
        getCatalog().createProject(input).generate(projectDir);
        assertThatDirectoryTreeMatchSnapshots(testInfo, projectDir);
        assertThatMatchSnapshot(testInfo, projectDir, "src/GreetingCommand.java");
    }

@gsmet the problem is that we use snapshot testing to test that the code generation is valid. Having dynamic version is not relevant here and should be mocked for the test to run properly everywhere.

@quarkus-bot quarkus-bot bot added this to the 1.13 - master milestone Feb 18, 2021
@gsmet gsmet modified the milestones: 1.13 - master, 1.12.2.Final Mar 8, 2021
This was referenced Mar 12, 2021
This was referenced Mar 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/jbang Issues related to when using jbang.dev with Quarkus kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants