Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Commit

Permalink
Remove testWritesThenCloseThenReopenWithVars (#891)
Browse files Browse the repository at this point in the history
This test started failing while testing
subconsciousnetwork/noosphere#623, leading us to
question why it ever passed in the first place. Due to Swift compiler
trivia the deinit for `Noosphere` is not guaranteed to be called at the
time we overwrite the variable, meaning two instances of `Noosphere`
co-exist pointing at the same data. We should not ever be trying to open
multiple instances of `Noosphere` pointing at the same database.

After team discussion we decided to drop this test case and make this an
explicit failure case on the Noosphere side.
  • Loading branch information
bfollington authored Sep 13, 2023
1 parent fa508bc commit e21a2d6
Showing 1 changed file with 0 additions and 70 deletions.
70 changes: 0 additions & 70 deletions xcode/Subconscious/SubconsciousTests/Tests_Sphere.swift
Original file line number Diff line number Diff line change
Expand Up @@ -448,76 +448,6 @@ final class Tests_Sphere: XCTestCase {
}
}

func testWritesThenCloseThenReopenWithVars() async throws {
let base = UUID()

let globalStoragePath = try createTmpDir(path: "\(base)/noosphere")
.path()

let sphereStoragePath = try createTmpDir(path: "\(base)/sphere")
.path()

var noosphere = try Noosphere(
globalStoragePath: globalStoragePath,
sphereStoragePath: sphereStoragePath
)

let sphereReceipt = try await noosphere.createSphere(
ownerKeyName: "bob"
)

let sphereIdentity = sphereReceipt.identity

var sphere = try Sphere(
noosphere: noosphere,
identity: sphereReceipt.identity
)

let versionA0 = try await sphere.version()

let body = try "Test content".toData().unwrap()
let contentType = "text/subtext"
try await sphere.write(
slug: Slug("a")!,
contentType: contentType,
body: body
)

let versionA1 = try await sphere.save()

try await sphere.write(
slug: Slug("b")!,
contentType: contentType,
body: body
)
try await sphere.write(
slug: Slug("c")!,
contentType: contentType,
body: body
)
let versionA2 = try await sphere.save()

let versionAN = try await sphere.version()

XCTAssertNotEqual(versionA0, versionAN)
XCTAssertNotEqual(versionA1, versionAN)
XCTAssertEqual(versionA2, versionAN)

// Overwrite var with new instance
noosphere = try Noosphere(
globalStoragePath: globalStoragePath,
sphereStoragePath: sphereStoragePath
)
// Overwrite sphere with new sphere
sphere = try Sphere(
noosphere: noosphere,
identity: sphereIdentity
)
let versionB0 = try await sphere.version()

XCTAssertEqual(versionB0, versionAN)
}

func testPetnameRoundtrip() async throws {
let base = UUID()

Expand Down

0 comments on commit e21a2d6

Please sign in to comment.