Updates for broken tests
This commit is contained in:
@@ -32,6 +32,9 @@ import java.io.IOException;
|
||||
* @author Daniel Lavoie
|
||||
*/
|
||||
public class ConfigServerTestUtils {
|
||||
|
||||
public static final String REPO_PREFIX = "target/repos/";
|
||||
|
||||
public static Repository prepareBareRemote() throws IOException {
|
||||
// Create a folder in the temp folder that will act as the remote repository
|
||||
File remoteDir = File.createTempFile("remote", "");
|
||||
@@ -65,7 +68,11 @@ public class ConfigServerTestUtils {
|
||||
repoPath = repoPath + "/";
|
||||
}
|
||||
File source = new File(baseDir + "src/test/resources" + repoPath);
|
||||
FileSystemUtils.copyRecursively(source, new File(buildDir + repoPath));
|
||||
File dest = new File(buildDir + repoPath);
|
||||
if (dest.exists()) {
|
||||
FileUtils.delete(dest, FileUtils.RECURSIVE | FileUtils.RETRY);
|
||||
}
|
||||
FileSystemUtils.copyRecursively(source, dest);
|
||||
File dotGit = new File(buildDir + repoPath + ".git");
|
||||
File git = new File(buildDir + repoPath + "git");
|
||||
if (git.exists()) {
|
||||
@@ -102,14 +109,14 @@ public class ConfigServerTestUtils {
|
||||
}
|
||||
|
||||
public static String copyLocalRepo(String path) throws IOException {
|
||||
File dest = new File("target/repos/" + path);
|
||||
File dest = new File(REPO_PREFIX + path);
|
||||
FileSystemUtils.deleteRecursively(dest);
|
||||
FileSystemUtils.copyRecursively(new File("target/repos/config-repo"), dest);
|
||||
return "file:./target/repos/" + path;
|
||||
}
|
||||
|
||||
public static boolean deleteLocalRepo(String path) throws IOException {
|
||||
File dest = new File("target/repos/" + path);
|
||||
File dest = new File(REPO_PREFIX + path);
|
||||
return FileSystemUtils.deleteRecursively(dest);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,15 +15,16 @@
|
||||
*/
|
||||
package org.springframework.cloud.config.server;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.web.server.LocalServerPort;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
import org.springframework.boot.web.server.LocalServerPort;
|
||||
import org.springframework.cloud.config.environment.Environment;
|
||||
import org.springframework.cloud.config.server.environment.SvnKitEnvironmentRepository;
|
||||
import org.springframework.cloud.config.server.test.ConfigServerTestUtils;
|
||||
@@ -31,10 +32,11 @@ import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
|
||||
import static org.springframework.cloud.config.server.test.ConfigServerTestUtils.REPO_PREFIX;
|
||||
|
||||
/**
|
||||
* @author Michael Prankl
|
||||
@@ -81,7 +83,8 @@ public class SubversionConfigServerIntegrationTests {
|
||||
@Test
|
||||
public void updateUnavailableRepo() throws IOException {
|
||||
contextLoads();
|
||||
assertTrue(ConfigServerTestUtils.deleteLocalRepo("svn-config-repo"));
|
||||
ConfigServerTestUtils.deleteLocalRepo("svn-config-repo");
|
||||
assertThat(new File(REPO_PREFIX, "svn-config-repo")).doesNotExist();
|
||||
contextLoads();
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.springframework.cloud.config.server.test.ConfigServerTestUtils;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.env.StandardEnvironment;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@@ -133,7 +134,8 @@ public class SVNKitEnvironmentRepositoryTests {
|
||||
@Test
|
||||
public void vanilla_with_update_after_repo_delete() throws IOException {
|
||||
this.vanilla_with_update();
|
||||
assertTrue(ConfigServerTestUtils.deleteLocalRepo(REPOSITORY_NAME));
|
||||
ConfigServerTestUtils.deleteLocalRepo(REPOSITORY_NAME);
|
||||
assertThat(new File(basedir, REPOSITORY_NAME)).doesNotExist();
|
||||
this.vanilla();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user