use of jetbrains.buildServer.util.TestFor in project teamcity-rest by JetBrains.
the class AgentFinderTest method testLocatorCompatibleBuildSpecific.
@Test
@TestFor(issues = { "TW-49934" })
public void testLocatorCompatibleBuildSpecific() throws Exception {
ProjectEx project10 = createProject("project10", "project 10");
BuildTypeEx bt10 = project10.createBuildType("bt10", "bt 10");
bt10.addParameter(new SimpleParameter("a", "%b%"));
checkAgents(null, myAgent1, myAgent2);
checkAgents("compatible:(buildType:(id:" + bt10.getExternalId() + "))");
{
SQueuedBuild queuedBuild = build().in(bt10).addToQueue();
checkAgents("compatible:(build:(id:" + queuedBuild.getItemId() + "))");
queuedBuild.removeFromQueue(null, null);
}
{
SQueuedBuild queuedBuild = build().in(bt10).parameter("b", "value").addToQueue();
checkAgents("compatible:(build:(id:" + queuedBuild.getItemId() + "))", myAgent1);
}
}
use of jetbrains.buildServer.util.TestFor in project teamcity-git by JetBrains.
the class ServerPluginConfigTest method test_modern_proxy_settings.
@TestFor(issues = "TW-57178")
public void test_modern_proxy_settings() {
final String httpProxyHost = "some.org";
final String httpProxyPort = "3128";
final String httpNonProxyHosts = "localhost|*.mydomain.com";
final String httpsProxyPort = "3129";
final String httpsProxyHost = "other.org";
System.setProperty("teamcity.http.proxyHost", httpProxyHost);
System.setProperty("teamcity.http.proxyPort", httpProxyPort);
System.setProperty("teamcity.http.nonProxyHosts", httpNonProxyHosts);
System.setProperty("teamcity.https.proxyHost", httpsProxyHost);
System.setProperty("teamcity.https.proxyPort", httpsProxyPort);
ServerPluginConfig config = new PluginConfigImpl(myServerPaths);
assertEquals(asList("-Dhttp.proxyHost=" + httpProxyHost, "-Dhttp.proxyPort=" + httpProxyPort, SystemInfo.isUnix ? "-Dhttp.nonProxyHosts=" + httpNonProxyHosts : "-Dhttp.nonProxyHosts=\"" + httpNonProxyHosts + "\"", "-Dhttps.proxyHost=" + httpsProxyHost, "-Dhttps.proxyPort=" + httpsProxyPort), config.getOptionsForSeparateProcess());
assertNull(config.getJschProxy());
}
use of jetbrains.buildServer.util.TestFor in project teamcity-git by JetBrains.
the class SshAuthenticationTest method ssh_git_wrong_key_file_local_rsa_encrypted_key.
@TestFor(issues = "TW-73578")
@Test(dataProvider = "true,false")
public void ssh_git_wrong_key_file_local_rsa_encrypted_key(boolean nativeOperationsEnabled) throws Exception {
final File key = dataFile("keys/id_ecdsa");
withSubstitutedLocalKeys("id_rsa_encrypted", () -> {
try {
do_ssh_test(nativeOperationsEnabled, false, "ssh://git@%s:%s/home/git/repo.git", "PasswordAuthentication yes\nPubkeyAuthentication yes\n", null, "keys/id_rsa_encrypted.pub", b -> b.withAuthMethod(AuthenticationMethod.PRIVATE_KEY_FILE).withPrivateKeyPath(key.getAbsolutePath()));
fail("Exception was expected");
} catch (Exception e) {
final String msg = e.getMessage();
if (msg.contains("Permission denied") || msg.contains("Auth fail") || msg.contains("Too many authentication failures"))
return null;
throw e;
}
return null;
});
}
use of jetbrains.buildServer.util.TestFor in project teamcity-git by JetBrains.
the class SshAuthenticationTest method ssh_git_rsa_key_file_with_cr_lf.
@TestFor(issues = "TW-75138")
@Test(dataProvider = "true,false")
public void ssh_git_rsa_key_file_with_cr_lf(boolean nativeOperationsEnabled) throws Exception {
final File key = dataFile("keys/id_rsa");
final File wrong_key = myTempFiles.createTempFile(FileUtil.readText(key, "UTF-8").replace("\n", "\r\n"));
do_ssh_test(nativeOperationsEnabled, true, "ssh://git@%s:%s/home/git/repo.git", "", null, "keys/id_rsa.pub", b -> b.withAuthMethod(AuthenticationMethod.PRIVATE_KEY_FILE).withPrivateKeyPath(wrong_key.getAbsolutePath()));
}
use of jetbrains.buildServer.util.TestFor in project teamcity-git by JetBrains.
the class TestConnectionTest method test_not_existing_local_repository.
@TestFor(issues = "TW-9933")
public void test_not_existing_local_repository() throws Exception {
File notExisting = new File(myTempFiles.createTempDir(), "not-existing");
String url = GitUtils.toURL(notExisting);
VcsRootImpl root = vcsRoot().withFetchUrl(url).build();
try {
myGit.testConnection(root);
fail("Should throw an exception for not-existing repository");
} catch (VcsException e) {
TeamCityAsserts.assertContainsAny(e.getMessage(), "Cannot access the '" + url + "' repository", "Please make sure you have the correct access rights and the repository exists");
assertFalse(e.getMessage().endsWith("\n"));
}
}
Aggregations