Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mac-app/Sources/CloudMachineCore/MachineBudget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public enum MachineBudget {
///
/// Also under `machineKey`, the way `machines.json` was keyed before the
/// folder became the key. On a Mac set up then, the two differ: on this
/// project's own Mac the entry is `marcin-mac-studio-3` with 3500 GB, while
/// project's own Mac the entry is `<user>-mac-studio-3` with 3500 GB, while
/// the folder is `mac-studio`. Until 09.10.2026 only the folder was looked
/// up, so the limit was there in the file and nowhere in effect: no usage
/// measurement, no 90% / 100% alarm. The folder's own entry wins - it is the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ final class BackupVisibilityTests: XCTestCase {
"mac-studio.sparsebundle")
XCTAssertNil(
InstallationTraces.cachedImage(
folder: "marcin-mac-studio-3", imageName: "marcin-mac-studio-3", cacheDir: directory))
folder: "home-mac-studio-3", imageName: "home-mac-studio-3", cacheDir: directory))
}

func testNoCacheMeansNoTraces() {
Expand Down Expand Up @@ -116,13 +116,13 @@ final class BackupVisibilityTests: XCTestCase {
XCTAssertEqual(
DriveFolder.decide(
existing: nil, requested: nil, legacyEvidence: evidence,
machineKey: "marcin-mac-studio-3"),
machineKey: "home-mac-studio-3"),
.assign("mac-studio"))
}
XCTAssertEqual(DriveFolder.legacyEvidence(remoteConfigured: false, cachedFolders: []), false)
XCTAssertNil(DriveFolder.legacyEvidence(remoteConfigured: nil, cachedFolders: []))
XCTAssertEqual(
DriveFolder.legacyEvidence(remoteConfigured: false, cachedFolders: ["marcin-mac-studio-3"]),
DriveFolder.legacyEvidence(remoteConfigured: false, cachedFolders: ["home-mac-studio-3"]),
false)
}

Expand Down
4 changes: 2 additions & 2 deletions mac-app/Tests/CloudMachineAppTests/DriveFolderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ final class DriveFolderTests: XCTestCase {
/// in `mac-studio`, would have been given its machine key as a new, empty
/// folder.
func testUnknownLegacyEvidenceRefusesInsteadOfGuessing() {
for requested in [nil, "mac-studio", "marcin-mac-studio-3"] {
for requested in [nil, "mac-studio", "home-mac-studio-3"] {
guard
case .refuse = DriveFolder.decide(
existing: nil, requested: requested, legacyEvidence: nil,
machineKey: "marcin-mac-studio-3")
machineKey: "home-mac-studio-3")
else { return XCTFail("chose a folder without knowing whether a backup already exists") }
}
}
Expand Down
10 changes: 5 additions & 5 deletions mac-app/Tests/CloudMachineAppTests/MachineBudgetTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ final class MachineBudgetTests: XCTestCase {
private func productionLikeConfig() -> MachinesConfig {
var config = MachinesConfig.empty
config.machines = [
MachineEntry(key: "marcin-mac-studio-3", displayName: "Marcin Mac Studio 3", limitGB: 3500)
MachineEntry(key: "home-mac-studio-3", displayName: "Home Mac Studio 3", limitGB: 3500)
]
return config
}
Expand All @@ -124,15 +124,15 @@ final class MachineBudgetTests: XCTestCase {
func testLimitUnderTheMachineKeyCounts() {
XCTAssertEqual(
MachineBudget.limitGB(
in: productionLikeConfig(), folder: "mac-studio", machineKey: "marcin-mac-studio-3"),
in: productionLikeConfig(), folder: "mac-studio", machineKey: "home-mac-studio-3"),
3500)
}

func testFolderEntryWinsOverTheMachineKey() {
var config = productionLikeConfig()
config.machines.append(MachineEntry(key: "mac-studio", displayName: "x", limitGB: 1000))
XCTAssertEqual(
MachineBudget.limitGB(in: config, folder: "mac-studio", machineKey: "marcin-mac-studio-3"),
MachineBudget.limitGB(in: config, folder: "mac-studio", machineKey: "home-mac-studio-3"),
1000)
}

Expand All @@ -145,10 +145,10 @@ final class MachineBudgetTests: XCTestCase {
/// Setting the limit moves the old entry, so one Mac is not counted twice.
func testSettingTheLimitMovesTheOldEntry() {
let config = MachineBudget.withLimit(
3000, folder: "mac-studio", machineKey: "marcin-mac-studio-3", in: productionLikeConfig())
3000, folder: "mac-studio", machineKey: "home-mac-studio-3", in: productionLikeConfig())
XCTAssertEqual(config.machines.map(\.key), ["mac-studio"])
XCTAssertEqual(config.machines.first?.limitGB, 3000)
XCTAssertEqual(config.machines.first?.displayName, "Marcin Mac Studio 3")
XCTAssertEqual(config.machines.first?.displayName, "Home Mac Studio 3")
XCTAssertEqual(config.allocatedGB, 3000)
}

Expand Down
Loading