Commit f917e9f8 authored by Greg Messner's avatar Greg Messner
Browse files

Now skips session tests if version is >= 10.2

parent dce1deb9
......@@ -5,6 +5,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assume.assumeTrue;
import org.gitlab4j.api.GitLabApi.ApiVersion;
import org.gitlab4j.api.models.Version;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
......@@ -60,6 +61,27 @@ public class TestGitLabSession {
problems += "TEST_PRIVATE_TOKEN cannot be empty\n";
}
if (problems.isEmpty()) {
String savedVersion = null;
try {
GitLabApi gitLabApi = new GitLabApi(ApiVersion.V4, TEST_HOST_URL, TEST_PRIVATE_TOKEN);
Version version = gitLabApi.getVersion();
savedVersion = version.getVersion();
String[] parts = version.getVersion().split(".", -1);
if (parts.length == 3) {
if (Integer.parseInt(parts[0]) < 10 ||
(Integer.parseInt(parts[0]) == 10 && Integer.parseInt(parts[1]) < 2)) {
savedVersion = null;
}
}
} catch (Exception e) {
}
if (savedVersion != null) {
problems += "GitLab version " + savedVersion + " does not support sessions\n";
}
}
if (!problems.isEmpty()) {
System.err.print(problems);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment