Skip to content

Commit

Permalink
Conan 2 battery tests (#1012)
Browse files Browse the repository at this point in the history
* Conan 2 lockfile battery test

* Moving test files around

* More conan 2 battery tests
  • Loading branch information
andrian-sevastyanov authored Dec 4, 2023
1 parent d96b68d commit 7622651
Show file tree
Hide file tree
Showing 10 changed files with 3,947 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
@Tag("battery")
public class ConanCliBattery {
private static final String CONAN1_VERSION_OUTPUT_RESOURCE = "../conan1-version.xout";
private static final String CONAN2_VERSION_OUTPUT_RESOURCE = "../conan2-version.xout";

@Test
void conanMinimal() {
Expand Down Expand Up @@ -64,6 +65,28 @@ void conanPkgRevOnly() {
test.run();
}

@Test
void conan2Minimal() {
DetectorBatteryTestRunner test = new DetectorBatteryTestRunner("conan2-minimal", "conan-cli/conan2minimal");
setTestExecutableOutputForConan2(test, "conan-graph-info-minimal.xout");
test.sourceDirectoryNamed("md5");
test.sourceFileNamed("conanfile.txt");
test.property("detect.conan.attempt.package.revision.match", "false");
test.expectBdioResources();
test.run();
}

@Test
void conan2RevisionMatch() {
DetectorBatteryTestRunner test = new DetectorBatteryTestRunner("conan2-revisionmatch", "conan-cli/conan2revisionmatch");
setTestExecutableOutputForConan2(test, "conan-graph-info-minimal.xout");
test.sourceDirectoryNamed("md5");
test.sourceFileNamed("conanfile.txt");
test.property("detect.conan.attempt.package.revision.match", "true");
test.expectBdioResources();
test.run();
}

private void setTestExecutableOutputForConan1(DetectorBatteryTestRunner test, String resource) {
test.executableFromResourceFiles(
DetectProperties.DETECT_CONAN_PATH,
Expand All @@ -72,4 +95,12 @@ private void setTestExecutableOutputForConan1(DetectorBatteryTestRunner test, St
resource
);
}

private void setTestExecutableOutputForConan2(DetectorBatteryTestRunner test, String resource) {
test.executableFromResourceFiles(
DetectProperties.DETECT_CONAN_PATH,
CONAN2_VERSION_OUTPUT_RESOURCE,
resource
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,27 @@ void conanLockLongFormExternalId() {
test.expectBdioResources();
test.run();
}

@Test
void conan2LockPackageRevisionMatchFalse() {
DetectorBatteryTestRunner test = new DetectorBatteryTestRunner("conan2-lock-simple", "conan2-lock/simple");
test.sourceDirectoryNamed("conan2-lock");
test.sourceFileFromResource("conan.lock");
test.property("detect.conan.attempt.package.revision.match", "false");
test.expectBdioResources();
test.run();
}

@Test
void conan2LockPackageRevisionMatchTrue() {
DetectorBatteryTestRunner test = new DetectorBatteryTestRunner("conan2-lock-simple", "conan2-lock/simple");
test.sourceDirectoryNamed("conan2-lock");
test.sourceFileFromResource("conan.lock");

// in this test case this setting should make not difference in the output as lock files in Conan 2 do not contain package revisions
test.property("detect.conan.attempt.package.revision.match", "true");

test.expectBdioResources();
test.run();
}
}
1 change: 1 addition & 0 deletions src/test/resources/battery/conan-cli/conan2-version.xout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Conan version 2.0.14
Binary file not shown.
Loading

0 comments on commit 7622651

Please sign in to comment.