update flacky test
This commit is contained in:
parent
08cb6de83d
commit
90a4e71b06
|
@ -20,7 +20,6 @@ import android.util.Log
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import org.junit.Assert.assertEquals
|
import org.junit.Assert.assertEquals
|
||||||
import org.junit.Assert.assertNotNull
|
|
||||||
import org.junit.Assert.assertTrue
|
import org.junit.Assert.assertTrue
|
||||||
import org.junit.FixMethodOrder
|
import org.junit.FixMethodOrder
|
||||||
import org.junit.Ignore
|
import org.junit.Ignore
|
||||||
|
@ -62,47 +61,40 @@ class SpaceHierarchyTest : InstrumentedTest {
|
||||||
val spaceName = "My Space"
|
val spaceName = "My Space"
|
||||||
val topic = "A public space for test"
|
val topic = "A public space for test"
|
||||||
var spaceId = ""
|
var spaceId = ""
|
||||||
commonTestHelper.waitWithLatch {
|
commonTestHelper.runBlockingTest {
|
||||||
spaceId = session.spaceService().createSpace(spaceName, topic, null, true)
|
spaceId = session.spaceService().createSpace(spaceName, topic, null, true)
|
||||||
it.countDown()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val syncedSpace = session.spaceService().getSpace(spaceId)
|
val syncedSpace = session.spaceService().getSpace(spaceId)
|
||||||
|
|
||||||
var roomId = ""
|
var roomId = ""
|
||||||
commonTestHelper.waitWithLatch {
|
commonTestHelper.runBlockingTest {
|
||||||
roomId = session.roomService().createRoom(CreateRoomParams().apply { name = "General" })
|
roomId = session.roomService().createRoom(CreateRoomParams().apply { name = "General" })
|
||||||
it.countDown()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val viaServers = listOf(session.sessionParams.homeServerHost ?: "")
|
val viaServers = listOf(session.sessionParams.homeServerHost ?: "")
|
||||||
|
|
||||||
commonTestHelper.waitWithLatch {
|
commonTestHelper.runBlockingTest {
|
||||||
syncedSpace!!.addChildren(roomId, viaServers, null, true)
|
syncedSpace!!.addChildren(roomId, viaServers, null, true)
|
||||||
it.countDown()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
commonTestHelper.waitWithLatch {
|
commonTestHelper.runBlockingTest {
|
||||||
session.spaceService().setSpaceParent(roomId, spaceId, true, viaServers)
|
session.spaceService().setSpaceParent(roomId, spaceId, true, viaServers)
|
||||||
it.countDown()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread.sleep(9000)
|
commonTestHelper.waitWithLatch { latch ->
|
||||||
|
commonTestHelper.retryPeriodicallyWithLatch(latch) {
|
||||||
val parents = session.getRoom(roomId)?.roomSummary()?.spaceParents
|
val parents = session.getRoom(roomId)?.roomSummary()?.spaceParents
|
||||||
val canonicalParents = session.getRoom(roomId)?.roomSummary()?.spaceParents?.filter { it.canonical == true }
|
val canonicalParents = session.getRoom(roomId)?.roomSummary()?.spaceParents?.filter { it.canonical == true }
|
||||||
|
|
||||||
parents?.forEach {
|
parents?.forEach {
|
||||||
Log.d("## TEST", "parent : $it")
|
Log.d("## TEST", "parent : $it")
|
||||||
}
|
}
|
||||||
|
parents?.size == 1 &&
|
||||||
assertNotNull(parents)
|
parents.first().roomSummary?.name == spaceName &&
|
||||||
assertEquals(1, parents!!.size)
|
canonicalParents?.size == 1 &&
|
||||||
assertEquals(spaceName, parents.first().roomSummary?.name)
|
canonicalParents.first().roomSummary?.name == spaceName
|
||||||
|
}
|
||||||
assertNotNull(canonicalParents)
|
}
|
||||||
assertEquals(1, canonicalParents!!.size)
|
|
||||||
assertEquals(spaceName, canonicalParents.first().roomSummary?.name)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test
|
// @Test
|
||||||
|
@ -173,18 +165,22 @@ class SpaceHierarchyTest : InstrumentedTest {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testFilteringBySpace() = CommonTestHelper.runSessionTest(context()) { commonTestHelper ->
|
fun testFilteringBySpace() = runSessionTest(context()) { commonTestHelper ->
|
||||||
val session = commonTestHelper.createAccount("John", SessionTestParams(true))
|
val session = commonTestHelper.createAccount("John", SessionTestParams(true))
|
||||||
|
|
||||||
val spaceAInfo = createPublicSpace(
|
val spaceAInfo = createPublicSpace(
|
||||||
session, "SpaceA", listOf(
|
commonTestHelper,
|
||||||
|
session, "SpaceA",
|
||||||
|
listOf(
|
||||||
Triple("A1", true /*auto-join*/, true/*canonical*/),
|
Triple("A1", true /*auto-join*/, true/*canonical*/),
|
||||||
Triple("A2", true, true)
|
Triple("A2", true, true)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
/* val spaceBInfo = */ createPublicSpace(
|
/* val spaceBInfo = */ createPublicSpace(
|
||||||
session, "SpaceB", listOf(
|
commonTestHelper,
|
||||||
|
session, "SpaceB",
|
||||||
|
listOf(
|
||||||
Triple("B1", true /*auto-join*/, true/*canonical*/),
|
Triple("B1", true /*auto-join*/, true/*canonical*/),
|
||||||
Triple("B2", true, true),
|
Triple("B2", true, true),
|
||||||
Triple("B3", true, true)
|
Triple("B3", true, true)
|
||||||
|
@ -192,7 +188,9 @@ class SpaceHierarchyTest : InstrumentedTest {
|
||||||
)
|
)
|
||||||
|
|
||||||
val spaceCInfo = createPublicSpace(
|
val spaceCInfo = createPublicSpace(
|
||||||
session, "SpaceC", listOf(
|
commonTestHelper,
|
||||||
|
session, "SpaceC",
|
||||||
|
listOf(
|
||||||
Triple("C1", true /*auto-join*/, true/*canonical*/),
|
Triple("C1", true /*auto-join*/, true/*canonical*/),
|
||||||
Triple("C2", true, true)
|
Triple("C2", true, true)
|
||||||
)
|
)
|
||||||
|
@ -201,24 +199,21 @@ class SpaceHierarchyTest : InstrumentedTest {
|
||||||
// add C as a subspace of A
|
// add C as a subspace of A
|
||||||
val spaceA = session.spaceService().getSpace(spaceAInfo.spaceId)
|
val spaceA = session.spaceService().getSpace(spaceAInfo.spaceId)
|
||||||
val viaServers = listOf(session.sessionParams.homeServerHost ?: "")
|
val viaServers = listOf(session.sessionParams.homeServerHost ?: "")
|
||||||
commonTestHelper.waitWithLatch {
|
commonTestHelper.runBlockingTest {
|
||||||
spaceA!!.addChildren(spaceCInfo.spaceId, viaServers, null, true)
|
spaceA!!.addChildren(spaceCInfo.spaceId, viaServers, null, true)
|
||||||
session.spaceService().setSpaceParent(spaceCInfo.spaceId, spaceAInfo.spaceId, true, viaServers)
|
session.spaceService().setSpaceParent(spaceCInfo.spaceId, spaceAInfo.spaceId, true, viaServers)
|
||||||
it.countDown()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create orphan rooms
|
// Create orphan rooms
|
||||||
|
|
||||||
var orphan1 = ""
|
var orphan1 = ""
|
||||||
commonTestHelper.waitWithLatch {
|
commonTestHelper.runBlockingTest {
|
||||||
orphan1 = session.roomService().createRoom(CreateRoomParams().apply { name = "O1" })
|
orphan1 = session.roomService().createRoom(CreateRoomParams().apply { name = "O1" })
|
||||||
it.countDown()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var orphan2 = ""
|
var orphan2 = ""
|
||||||
commonTestHelper.waitWithLatch {
|
commonTestHelper.runBlockingTest {
|
||||||
orphan2 = session.roomService().createRoom(CreateRoomParams().apply { name = "O2" })
|
orphan2 = session.roomService().createRoom(CreateRoomParams().apply { name = "O2" })
|
||||||
it.countDown()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val allRooms = session.roomService().getRoomSummaries(roomSummaryQueryParams { excludeType = listOf(RoomType.SPACE) })
|
val allRooms = session.roomService().getRoomSummaries(roomSummaryQueryParams { excludeType = listOf(RoomType.SPACE) })
|
||||||
|
@ -240,10 +235,9 @@ class SpaceHierarchyTest : InstrumentedTest {
|
||||||
assertTrue("A1 should be a grand child of A", aChildren.any { it.name == "C2" })
|
assertTrue("A1 should be a grand child of A", aChildren.any { it.name == "C2" })
|
||||||
|
|
||||||
// Add a non canonical child and check that it does not appear as orphan
|
// Add a non canonical child and check that it does not appear as orphan
|
||||||
commonTestHelper.waitWithLatch {
|
commonTestHelper.runBlockingTest {
|
||||||
val a3 = session.roomService().createRoom(CreateRoomParams().apply { name = "A3" })
|
val a3 = session.roomService().createRoom(CreateRoomParams().apply { name = "A3" })
|
||||||
spaceA!!.addChildren(a3, viaServers, null, false)
|
spaceA!!.addChildren(a3, viaServers, null, false)
|
||||||
it.countDown()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread.sleep(6_000)
|
Thread.sleep(6_000)
|
||||||
|
@ -255,18 +249,22 @@ class SpaceHierarchyTest : InstrumentedTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Ignore("This test will be ignored until it is fixed")
|
@Ignore("This test will be ignored until it is fixed")
|
||||||
fun testBreakCycle() = CommonTestHelper.runSessionTest(context()) { commonTestHelper ->
|
fun testBreakCycle() = runSessionTest(context()) { commonTestHelper ->
|
||||||
val session = commonTestHelper.createAccount("John", SessionTestParams(true))
|
val session = commonTestHelper.createAccount("John", SessionTestParams(true))
|
||||||
|
|
||||||
val spaceAInfo = createPublicSpace(
|
val spaceAInfo = createPublicSpace(
|
||||||
session, "SpaceA", listOf(
|
commonTestHelper,
|
||||||
|
session, "SpaceA",
|
||||||
|
listOf(
|
||||||
Triple("A1", true /*auto-join*/, true/*canonical*/),
|
Triple("A1", true /*auto-join*/, true/*canonical*/),
|
||||||
Triple("A2", true, true)
|
Triple("A2", true, true)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
val spaceCInfo = createPublicSpace(
|
val spaceCInfo = createPublicSpace(
|
||||||
session, "SpaceC", listOf(
|
commonTestHelper,
|
||||||
|
session, "SpaceC",
|
||||||
|
listOf(
|
||||||
Triple("C1", true /*auto-join*/, true/*canonical*/),
|
Triple("C1", true /*auto-join*/, true/*canonical*/),
|
||||||
Triple("C2", true, true)
|
Triple("C2", true, true)
|
||||||
)
|
)
|
||||||
|
@ -275,17 +273,15 @@ class SpaceHierarchyTest : InstrumentedTest {
|
||||||
// add C as a subspace of A
|
// add C as a subspace of A
|
||||||
val spaceA = session.spaceService().getSpace(spaceAInfo.spaceId)
|
val spaceA = session.spaceService().getSpace(spaceAInfo.spaceId)
|
||||||
val viaServers = listOf(session.sessionParams.homeServerHost ?: "")
|
val viaServers = listOf(session.sessionParams.homeServerHost ?: "")
|
||||||
commonTestHelper.waitWithLatch {
|
commonTestHelper.runBlockingTest {
|
||||||
spaceA!!.addChildren(spaceCInfo.spaceId, viaServers, null, true)
|
spaceA!!.addChildren(spaceCInfo.spaceId, viaServers, null, true)
|
||||||
session.spaceService().setSpaceParent(spaceCInfo.spaceId, spaceAInfo.spaceId, true, viaServers)
|
session.spaceService().setSpaceParent(spaceCInfo.spaceId, spaceAInfo.spaceId, true, viaServers)
|
||||||
it.countDown()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// add back A as subspace of C
|
// add back A as subspace of C
|
||||||
commonTestHelper.waitWithLatch {
|
commonTestHelper.runBlockingTest {
|
||||||
val spaceC = session.spaceService().getSpace(spaceCInfo.spaceId)
|
val spaceC = session.spaceService().getSpace(spaceCInfo.spaceId)
|
||||||
spaceC!!.addChildren(spaceAInfo.spaceId, viaServers, null, true)
|
spaceC!!.addChildren(spaceAInfo.spaceId, viaServers, null, true)
|
||||||
it.countDown()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// A -> C -> A
|
// A -> C -> A
|
||||||
|
@ -300,18 +296,24 @@ class SpaceHierarchyTest : InstrumentedTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testLiveFlatChildren() = CommonTestHelper.runSessionTest(context()) { commonTestHelper ->
|
fun testLiveFlatChildren() = runSessionTest(context()) { commonTestHelper ->
|
||||||
val session = commonTestHelper.createAccount("John", SessionTestParams(true))
|
val session = commonTestHelper.createAccount("John", SessionTestParams(true))
|
||||||
|
|
||||||
val spaceAInfo = createPublicSpace(
|
val spaceAInfo = createPublicSpace(
|
||||||
session, "SpaceA", listOf(
|
commonTestHelper,
|
||||||
|
session,
|
||||||
|
"SpaceA",
|
||||||
|
listOf(
|
||||||
Triple("A1", true /*auto-join*/, true/*canonical*/),
|
Triple("A1", true /*auto-join*/, true/*canonical*/),
|
||||||
Triple("A2", true, true)
|
Triple("A2", true, true)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
val spaceBInfo = createPublicSpace(
|
val spaceBInfo = createPublicSpace(
|
||||||
session, "SpaceB", listOf(
|
commonTestHelper,
|
||||||
|
session,
|
||||||
|
"SpaceB",
|
||||||
|
listOf(
|
||||||
Triple("B1", true /*auto-join*/, true/*canonical*/),
|
Triple("B1", true /*auto-join*/, true/*canonical*/),
|
||||||
Triple("B2", true, true),
|
Triple("B2", true, true),
|
||||||
Triple("B3", true, true)
|
Triple("B3", true, true)
|
||||||
|
@ -321,13 +323,16 @@ class SpaceHierarchyTest : InstrumentedTest {
|
||||||
// add B as a subspace of A
|
// add B as a subspace of A
|
||||||
val spaceA = session.spaceService().getSpace(spaceAInfo.spaceId)
|
val spaceA = session.spaceService().getSpace(spaceAInfo.spaceId)
|
||||||
val viaServers = listOf(session.sessionParams.homeServerHost ?: "")
|
val viaServers = listOf(session.sessionParams.homeServerHost ?: "")
|
||||||
runBlocking {
|
commonTestHelper.runBlockingTest {
|
||||||
spaceA!!.addChildren(spaceBInfo.spaceId, viaServers, null, true)
|
spaceA!!.addChildren(spaceBInfo.spaceId, viaServers, null, true)
|
||||||
session.spaceService().setSpaceParent(spaceBInfo.spaceId, spaceAInfo.spaceId, true, viaServers)
|
session.spaceService().setSpaceParent(spaceBInfo.spaceId, spaceAInfo.spaceId, true, viaServers)
|
||||||
}
|
}
|
||||||
|
|
||||||
val spaceCInfo = createPublicSpace(
|
val spaceCInfo = createPublicSpace(
|
||||||
session, "SpaceC", listOf(
|
commonTestHelper,
|
||||||
|
session,
|
||||||
|
"SpaceC",
|
||||||
|
listOf(
|
||||||
Triple("C1", true /*auto-join*/, true/*canonical*/),
|
Triple("C1", true /*auto-join*/, true/*canonical*/),
|
||||||
Triple("C2", true, true)
|
Triple("C2", true, true)
|
||||||
)
|
)
|
||||||
|
@ -348,13 +353,13 @@ class SpaceHierarchyTest : InstrumentedTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flatAChildren.observeForever(childObserver)
|
||||||
|
|
||||||
// add C as subspace of B
|
// add C as subspace of B
|
||||||
val spaceB = session.spaceService().getSpace(spaceBInfo.spaceId)
|
val spaceB = session.spaceService().getSpace(spaceBInfo.spaceId)
|
||||||
spaceB!!.addChildren(spaceCInfo.spaceId, viaServers, null, true)
|
spaceB!!.addChildren(spaceCInfo.spaceId, viaServers, null, true)
|
||||||
|
|
||||||
// C1 and C2 should be in flatten child of A now
|
// C1 and C2 should be in flatten child of A now
|
||||||
|
|
||||||
flatAChildren.observeForever(childObserver)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test part one of the rooms
|
// Test part one of the rooms
|
||||||
|
@ -374,10 +379,10 @@ class SpaceHierarchyTest : InstrumentedTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// part from b room
|
|
||||||
session.roomService().leaveRoom(bRoomId)
|
|
||||||
// The room should have disapear from flat children
|
// The room should have disapear from flat children
|
||||||
flatAChildren.observeForever(childObserver)
|
flatAChildren.observeForever(childObserver)
|
||||||
|
// part from b room
|
||||||
|
session.roomService().leaveRoom(bRoomId)
|
||||||
}
|
}
|
||||||
commonTestHelper.signOutAndClose(session)
|
commonTestHelper.signOutAndClose(session)
|
||||||
}
|
}
|
||||||
|
@ -388,6 +393,7 @@ class SpaceHierarchyTest : InstrumentedTest {
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun createPublicSpace(
|
private fun createPublicSpace(
|
||||||
|
commonTestHelper: CommonTestHelper,
|
||||||
session: Session,
|
session: Session,
|
||||||
spaceName: String,
|
spaceName: String,
|
||||||
childInfo: List<Triple<String, Boolean, Boolean?>>
|
childInfo: List<Triple<String, Boolean, Boolean?>>
|
||||||
|
@ -395,8 +401,7 @@ class SpaceHierarchyTest : InstrumentedTest {
|
||||||
): TestSpaceCreationResult {
|
): TestSpaceCreationResult {
|
||||||
var spaceId = ""
|
var spaceId = ""
|
||||||
var roomIds: List<String> = emptyList()
|
var roomIds: List<String> = emptyList()
|
||||||
runSessionTest(context()) { commonTestHelper ->
|
commonTestHelper.runBlockingTest {
|
||||||
commonTestHelper.waitWithLatch { latch ->
|
|
||||||
spaceId = session.spaceService().createSpace(spaceName, "Test Topic", null, true)
|
spaceId = session.spaceService().createSpace(spaceName, "Test Topic", null, true)
|
||||||
val syncedSpace = session.spaceService().getSpace(spaceId)
|
val syncedSpace = session.spaceService().getSpace(spaceId)
|
||||||
val viaServers = listOf(session.sessionParams.homeServerHost ?: "")
|
val viaServers = listOf(session.sessionParams.homeServerHost ?: "")
|
||||||
|
@ -411,13 +416,12 @@ class SpaceHierarchyTest : InstrumentedTest {
|
||||||
session.spaceService().setSpaceParent(roomId, spaceId, canonical, viaServers)
|
session.spaceService().setSpaceParent(roomId, spaceId, canonical, viaServers)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
latch.countDown()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return TestSpaceCreationResult(spaceId, roomIds)
|
return TestSpaceCreationResult(spaceId, roomIds)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createPrivateSpace(
|
private fun createPrivateSpace(
|
||||||
|
commonTestHelper: CommonTestHelper,
|
||||||
session: Session,
|
session: Session,
|
||||||
spaceName: String,
|
spaceName: String,
|
||||||
childInfo: List<Triple<String, Boolean, Boolean?>>
|
childInfo: List<Triple<String, Boolean, Boolean?>>
|
||||||
|
@ -425,8 +429,7 @@ class SpaceHierarchyTest : InstrumentedTest {
|
||||||
): TestSpaceCreationResult {
|
): TestSpaceCreationResult {
|
||||||
var spaceId = ""
|
var spaceId = ""
|
||||||
var roomIds: List<String> = emptyList()
|
var roomIds: List<String> = emptyList()
|
||||||
runSessionTest(context()) { commonTestHelper ->
|
commonTestHelper.runBlockingTest {
|
||||||
commonTestHelper.waitWithLatch { latch ->
|
|
||||||
spaceId = session.spaceService().createSpace(spaceName, "My Private Space", null, false)
|
spaceId = session.spaceService().createSpace(spaceName, "My Private Space", null, false)
|
||||||
val syncedSpace = session.spaceService().getSpace(spaceId)
|
val syncedSpace = session.spaceService().getSpace(spaceId)
|
||||||
val viaServers = listOf(session.sessionParams.homeServerHost ?: "")
|
val viaServers = listOf(session.sessionParams.homeServerHost ?: "")
|
||||||
|
@ -452,8 +455,6 @@ class SpaceHierarchyTest : InstrumentedTest {
|
||||||
session.spaceService().setSpaceParent(roomId, spaceId, canonical, viaServers)
|
session.spaceService().setSpaceParent(roomId, spaceId, canonical, viaServers)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
latch.countDown()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return TestSpaceCreationResult(spaceId, roomIds)
|
return TestSpaceCreationResult(spaceId, roomIds)
|
||||||
}
|
}
|
||||||
|
@ -463,14 +464,18 @@ class SpaceHierarchyTest : InstrumentedTest {
|
||||||
val session = commonTestHelper.createAccount("John", SessionTestParams(true))
|
val session = commonTestHelper.createAccount("John", SessionTestParams(true))
|
||||||
|
|
||||||
/* val spaceAInfo = */ createPublicSpace(
|
/* val spaceAInfo = */ createPublicSpace(
|
||||||
session, "SpaceA", listOf(
|
commonTestHelper,
|
||||||
|
session, "SpaceA",
|
||||||
|
listOf(
|
||||||
Triple("A1", true /*auto-join*/, true/*canonical*/),
|
Triple("A1", true /*auto-join*/, true/*canonical*/),
|
||||||
Triple("A2", true, true)
|
Triple("A2", true, true)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
val spaceBInfo = createPublicSpace(
|
val spaceBInfo = createPublicSpace(
|
||||||
session, "SpaceB", listOf(
|
commonTestHelper,
|
||||||
|
session, "SpaceB",
|
||||||
|
listOf(
|
||||||
Triple("B1", true /*auto-join*/, true/*canonical*/),
|
Triple("B1", true /*auto-join*/, true/*canonical*/),
|
||||||
Triple("B2", true, true),
|
Triple("B2", true, true),
|
||||||
Triple("B3", true, true)
|
Triple("B3", true, true)
|
||||||
|
@ -478,7 +483,9 @@ class SpaceHierarchyTest : InstrumentedTest {
|
||||||
)
|
)
|
||||||
|
|
||||||
val spaceCInfo = createPublicSpace(
|
val spaceCInfo = createPublicSpace(
|
||||||
session, "SpaceC", listOf(
|
commonTestHelper,
|
||||||
|
session, "SpaceC",
|
||||||
|
listOf(
|
||||||
Triple("C1", true /*auto-join*/, true/*canonical*/),
|
Triple("C1", true /*auto-join*/, true/*canonical*/),
|
||||||
Triple("C2", true, true)
|
Triple("C2", true, true)
|
||||||
)
|
)
|
||||||
|
@ -490,7 +497,6 @@ class SpaceHierarchyTest : InstrumentedTest {
|
||||||
runBlocking {
|
runBlocking {
|
||||||
val spaceB = session.spaceService().getSpace(spaceBInfo.spaceId)
|
val spaceB = session.spaceService().getSpace(spaceBInfo.spaceId)
|
||||||
spaceB!!.addChildren(spaceCInfo.spaceId, viaServers, null, true)
|
spaceB!!.addChildren(spaceCInfo.spaceId, viaServers, null, true)
|
||||||
Thread.sleep(6_000)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Thread.sleep(4_000)
|
// Thread.sleep(4_000)
|
||||||
|
@ -501,11 +507,12 @@ class SpaceHierarchyTest : InstrumentedTest {
|
||||||
// + C
|
// + C
|
||||||
// + c1, c2
|
// + c1, c2
|
||||||
|
|
||||||
val rootSpaces = commonTestHelper.runBlockingTest {
|
commonTestHelper.waitWithLatch { latch ->
|
||||||
session.spaceService().getRootSpaceSummaries()
|
commonTestHelper.retryPeriodicallyWithLatch(latch) {
|
||||||
|
val rootSpaces = commonTestHelper.runBlockingTest { session.spaceService().getRootSpaceSummaries() }
|
||||||
|
rootSpaces.size == 2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assertEquals("Unexpected number of root spaces ${rootSpaces.map { it.name }}", 2, rootSpaces.size)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -514,7 +521,9 @@ class SpaceHierarchyTest : InstrumentedTest {
|
||||||
val bobSession = commonTestHelper.createAccount("Bib", SessionTestParams(true))
|
val bobSession = commonTestHelper.createAccount("Bib", SessionTestParams(true))
|
||||||
|
|
||||||
val spaceAInfo = createPrivateSpace(
|
val spaceAInfo = createPrivateSpace(
|
||||||
aliceSession, "Private Space A", listOf(
|
commonTestHelper,
|
||||||
|
aliceSession, "Private Space A",
|
||||||
|
listOf(
|
||||||
Triple("General", true /*suggested*/, true/*canonical*/),
|
Triple("General", true /*suggested*/, true/*canonical*/),
|
||||||
Triple("Random", true, true)
|
Triple("Random", true, true)
|
||||||
)
|
)
|
||||||
|
@ -529,10 +538,9 @@ class SpaceHierarchyTest : InstrumentedTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
var bobRoomId = ""
|
var bobRoomId = ""
|
||||||
commonTestHelper.waitWithLatch {
|
commonTestHelper.runBlockingTest {
|
||||||
bobRoomId = bobSession.roomService().createRoom(CreateRoomParams().apply { name = "A Bob Room" })
|
bobRoomId = bobSession.roomService().createRoom(CreateRoomParams().apply { name = "A Bob Room" })
|
||||||
bobSession.getRoom(bobRoomId)!!.membershipService().invite(aliceSession.myUserId)
|
bobSession.getRoom(bobRoomId)!!.membershipService().invite(aliceSession.myUserId)
|
||||||
it.countDown()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
commonTestHelper.runBlockingTest {
|
commonTestHelper.runBlockingTest {
|
||||||
|
@ -545,9 +553,8 @@ class SpaceHierarchyTest : InstrumentedTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
commonTestHelper.waitWithLatch {
|
commonTestHelper.runBlockingTest {
|
||||||
bobSession.spaceService().setSpaceParent(bobRoomId, spaceAInfo.spaceId, false, listOf(bobSession.sessionParams.homeServerHost ?: ""))
|
bobSession.spaceService().setSpaceParent(bobRoomId, spaceAInfo.spaceId, false, listOf(bobSession.sessionParams.homeServerHost ?: ""))
|
||||||
it.countDown()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
commonTestHelper.waitWithLatch { latch ->
|
commonTestHelper.waitWithLatch { latch ->
|
||||||
|
|
Loading…
Reference in New Issue