Skip to content

Commit

Permalink
Allow specifying Presto server version to be tested via env
Browse files Browse the repository at this point in the history
  • Loading branch information
losipiuk committed Sep 14, 2020
1 parent 31f570b commit 7896b52
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/
package io.prestosql;

import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;
import io.prestosql.jdbc.BaseTestJdbcResultSet;
import io.prestosql.jdbc.PrestoDriver;
Expand Down Expand Up @@ -42,6 +43,7 @@ public class TestJdbcResultSetCompatibilityOldServer
{
private static final int NUMBER_OF_TESTED_VERSIONS = 5;
private static final int TESTED_VERSIONS_GRANULARITY = 3;
private static final String TESTED_VERSIONS_ENV_KEY = "TESTED_PRESTO_SERVER_VERSIONS";

/**
* Empty means that we could not obtain current Presto version and tests defined here will be marked as failed.
Expand All @@ -59,6 +61,14 @@ public TestJdbcResultSetCompatibilityOldServer(Optional<String> testedPrestoVers
public static Object[][] testedPrestoVersions()
{
try {
if (System.getenv(TESTED_VERSIONS_ENV_KEY) != null) {
// This is currently needed so that the test is runnable from IDE
// TODO use filtered resource to provide current version instead.
return Splitter.on(",").trimResults().splitToList(System.getenv(TESTED_VERSIONS_ENV_KEY)).stream()
.map(Optional::of)
.collect(TestngUtils.toDataProvider());
}

String currentVersionString = requireNonNull(PrestoDriver.class.getPackage().getImplementationVersion());
// this should match git-describe output which is used as version stored in metadata
Matcher matcher = Pattern.compile("(\\d+)(?:-\\d+-[a-z0-9]+)?").matcher(currentVersionString);
Expand Down

0 comments on commit 7896b52

Please sign in to comment.