From 694fd8896d2133fd5183349278be37e4f0c53d58 Mon Sep 17 00:00:00 2001 From: chirontt Date: Sun, 28 Apr 2019 15:51:21 -0400 Subject: Fix for various test failures. Most of failures were due to temporary test repos, users and/or teams being left behind after the test run, and these left-over stuff in $baseFolder/data/git caused assertion errors in many tests in subsequent test runs. This fix tries to delete those left-over stuff at the end of each test, mainly in their @Afterclass code blocks. PushLogTest.java is deleted as it doesn't work, and has been superseded with better tests in various protocol test suites (GitServletTest, GitDaemonTest, SshDaemonTest, etc.) --- src/test/java/com/gitblit/tests/RpcTests.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/test/java/com/gitblit/tests/RpcTests.java') diff --git a/src/test/java/com/gitblit/tests/RpcTests.java b/src/test/java/com/gitblit/tests/RpcTests.java index 51b4671b..4c794656 100644 --- a/src/test/java/com/gitblit/tests/RpcTests.java +++ b/src/test/java/com/gitblit/tests/RpcTests.java @@ -68,6 +68,11 @@ public class RpcTests extends GitblitUnitTest { @AfterClass public static void stopGitblit() throws Exception { + //clean up the "A-Team" if left over + TeamModel aTeam = new TeamModel("A-Team"); + aTeam.addRepositoryPermission("helloworld.git"); + RpcUtils.deleteTeam(aTeam, GitBlitSuite.url, GitBlitSuite.account, GitBlitSuite.password.toCharArray()); + if (started.get()) { GitBlitSuite.stopGitblit(); } @@ -265,11 +270,17 @@ public class RpcTests extends GitblitUnitTest { @Test public void testTeamAdministration() throws IOException { + //clean up the "A-Team" left over from previous run, if any + TeamModel aTeam = new TeamModel("A-Team"); + aTeam.addRepositoryPermission("helloworld.git"); + RpcUtils.deleteTeam(aTeam, url, account, password.toCharArray()); + List teams = RpcUtils.getTeams(url, account, password.toCharArray()); - assertEquals(1, teams.size()); + //should be just the admins team + assertEquals("In addition to 'admins', too many left-over team(s) in Gitblit server: " + teams, 1, teams.size()); // Create the A-Team - TeamModel aTeam = new TeamModel("A-Team"); + aTeam = new TeamModel("A-Team"); aTeam.users.add("admin"); aTeam.addRepositoryPermission("helloworld.git"); assertTrue(RpcUtils.createTeam(aTeam, url, account, password.toCharArray())); -- cgit v1.2.3