Skip to content

Commit

Permalink
Add new build publish props test
Browse files Browse the repository at this point in the history
  • Loading branch information
talarian1 committed Dec 7, 2021
1 parent 900aeb2 commit a95a381
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public void publicationsTest(String gradleVersion) throws IOException {
BuildResult buildResult = runGradle(gradleVersion, envVars, false);
// Check results
checkBuildResults(artifactoryManager, buildResult, VersionNumber.parse(gradleVersion).getMajor() >= 6, localRepo1);
checkBuildInfoProps(artifactoryManager, buildResult);
// Cleanup
Pair<String, String> buildDetails = getBuildDetails(buildResult);
cleanTestBuilds(buildDetails.getLeft(), buildDetails.getRight(), null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.gradle.testkit.runner.BuildResult;
import org.gradle.testkit.runner.BuildTask;
import org.gradle.testkit.runner.GradleRunner;
import org.jfrog.build.api.Artifact;
import org.jfrog.build.api.Build;
import org.jfrog.build.api.Dependency;
import org.jfrog.build.api.Module;
Expand Down Expand Up @@ -243,6 +244,26 @@ private static void checkBuildInfoModules(Build buildInfo, int expectedModules,
}
}

/**
* Check expected build info properties is found on each published artifacts.
*
* @param artifactoryManager - ArtifactoryManager client
* @param buildResult - The build results
*/
static void checkBuildInfoProps(ArtifactoryManager artifactoryManager, BuildResult buildResult) throws IOException {
Build buildInfo = getBuildInfo(artifactoryManager, buildResult);
for (Module module : buildInfo.getModules()) {
for (Artifact artifact : module.getArtifacts()) {
Properties properties = artifact.getProperties();
assertNotNull(properties);
assertEquals(properties.getProperty("qa.level"), "basic");
assertEquals(properties.getProperty("q.os"), "win32");
assertEquals(properties.getProperty("q.os"), "deb");
assertEquals(properties.getProperty("q.os"), "osx");
}
}
}

/**
* Assert build success for task.
*
Expand Down

0 comments on commit a95a381

Please sign in to comment.