Make linter happy
This commit is contained in:
parent
a2df207f3e
commit
d1dd251423
|
@ -441,6 +441,7 @@ extension CompactBlockProcessor {
|
||||||
// This is main loop of the sync process. It simply takes state and try to find action which handles it. If action is found it executes the
|
// This is main loop of the sync process. It simply takes state and try to find action which handles it. If action is found it executes the
|
||||||
// action. If action is not found then loop finishes. Thanks to this it's super easy to identify start point of sync process and end points
|
// action. If action is not found then loop finishes. Thanks to this it's super easy to identify start point of sync process and end points
|
||||||
// of sync process without any side effects.
|
// of sync process without any side effects.
|
||||||
|
// swiftlint:disable:next cyclomatic_complexity
|
||||||
private func run() async {
|
private func run() async {
|
||||||
logger.debug("Starting run")
|
logger.debug("Starting run")
|
||||||
await resetContext()
|
await resetContext()
|
||||||
|
|
|
@ -45,7 +45,7 @@ class BlockBatchValidationTests: ZcashTestCase {
|
||||||
testTempDirectory = nil
|
testTempDirectory = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: [1094] review the tests and potentially fix it https://github.com/zcash/ZcashLightClientKit/issues/1094
|
// TODO: [#1094] review the tests and potentially fix it https://github.com/zcash/ZcashLightClientKit/issues/1094
|
||||||
// func testBranchIdFailure() async throws {
|
// func testBranchIdFailure() async throws {
|
||||||
// let network = ZcashNetworkBuilder.network(for: .mainnet)
|
// let network = ZcashNetworkBuilder.network(for: .mainnet)
|
||||||
// let service = MockLightWalletService(
|
// let service = MockLightWalletService(
|
||||||
|
|
|
@ -54,7 +54,7 @@ final class ScanActionTests: ZcashTestCase {
|
||||||
let syncContext: ActionContext = .init(state: .scan)
|
let syncContext: ActionContext = .init(state: .scan)
|
||||||
|
|
||||||
do {
|
do {
|
||||||
let _ = try await scanAction.run(with: syncContext) { _ in }
|
_ = try await scanAction.run(with: syncContext) { _ in }
|
||||||
XCTAssertFalse(transactionRepositoryMock.lastScannedHeightCalled, "transactionRepository.lastScannedHeight() is expected to be called.")
|
XCTAssertFalse(transactionRepositoryMock.lastScannedHeightCalled, "transactionRepository.lastScannedHeight() is expected to be called.")
|
||||||
XCTAssertFalse(loggerMock.debugFileFunctionLineCalled, "logger.debug(...) is expected to be called.")
|
XCTAssertFalse(loggerMock.debugFileFunctionLineCalled, "logger.debug(...) is expected to be called.")
|
||||||
XCTAssertFalse(blockScannerMock.scanBlocksAtTotalProgressRangeDidScanCalled, "blockScanner.scanBlocks(...) is expected to be called.")
|
XCTAssertFalse(blockScannerMock.scanBlocksAtTotalProgressRangeDidScanCalled, "blockScanner.scanBlocks(...) is expected to be called.")
|
||||||
|
@ -74,7 +74,7 @@ final class ScanActionTests: ZcashTestCase {
|
||||||
let syncContext = await setupActionContext()
|
let syncContext = await setupActionContext()
|
||||||
|
|
||||||
do {
|
do {
|
||||||
let _ = try await scanAction.run(with: syncContext) { _ in }
|
_ = try await scanAction.run(with: syncContext) { _ in }
|
||||||
XCTAssertTrue(transactionRepositoryMock.lastScannedHeightCalled, "transactionRepository.lastScannedHeight() is expected to be called.")
|
XCTAssertTrue(transactionRepositoryMock.lastScannedHeightCalled, "transactionRepository.lastScannedHeight() is expected to be called.")
|
||||||
XCTAssertFalse(loggerMock.debugFileFunctionLineCalled, "logger.debug(...) is expected to be called.")
|
XCTAssertFalse(loggerMock.debugFileFunctionLineCalled, "logger.debug(...) is expected to be called.")
|
||||||
XCTAssertFalse(blockScannerMock.scanBlocksAtTotalProgressRangeDidScanCalled, "blockScanner.scanBlocks(...) is expected to be called.")
|
XCTAssertFalse(blockScannerMock.scanBlocksAtTotalProgressRangeDidScanCalled, "blockScanner.scanBlocks(...) is expected to be called.")
|
||||||
|
|
|
@ -50,7 +50,10 @@ final class ValidateServerActionTests: ZcashTestCase {
|
||||||
} catch ZcashError.compactBlockProcessorChainName(let chainName) {
|
} catch ZcashError.compactBlockProcessorChainName(let chainName) {
|
||||||
XCTAssertEqual(chainName, "invalid")
|
XCTAssertEqual(chainName, "invalid")
|
||||||
} catch {
|
} catch {
|
||||||
XCTFail("testValidateServerAction_ChainNameError is expected to fail but error \(error) doesn't match ZcashError.compactBlockProcessorChainName")
|
XCTFail("""
|
||||||
|
testValidateServerAction_ChainNameError is expected to fail but error \(error) doesn't match \
|
||||||
|
ZcashError.compactBlockProcessorChainName
|
||||||
|
""")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +69,10 @@ final class ValidateServerActionTests: ZcashTestCase {
|
||||||
XCTAssertEqual(expected, .mainnet)
|
XCTAssertEqual(expected, .mainnet)
|
||||||
XCTAssertEqual(found, .testnet)
|
XCTAssertEqual(found, .testnet)
|
||||||
} catch {
|
} catch {
|
||||||
XCTFail("testValidateServerAction_NetworkMatchError is expected to fail but error \(error) doesn't match ZcashError.compactBlockProcessorNetworkMismatch")
|
XCTFail("""
|
||||||
|
testValidateServerAction_NetworkMatchError is expected to fail but error \(error) doesn't match \
|
||||||
|
ZcashError.compactBlockProcessorNetworkMismatch
|
||||||
|
""")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +88,10 @@ final class ValidateServerActionTests: ZcashTestCase {
|
||||||
XCTAssertEqual(expected, 280_000)
|
XCTAssertEqual(expected, 280_000)
|
||||||
XCTAssertEqual(found, 1)
|
XCTAssertEqual(found, 1)
|
||||||
} catch {
|
} catch {
|
||||||
XCTFail("testValidateServerAction_SaplingActivationError is expected to fail but error \(error) doesn't match ZcashError.compactBlockProcessorSaplingActivationMismatch")
|
XCTFail("""
|
||||||
|
testValidateServerAction_SaplingActivationError is expected to fail but error \(error) doesn't match \
|
||||||
|
ZcashError.compactBlockProcessorSaplingActivationMismatch
|
||||||
|
""")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +105,10 @@ final class ValidateServerActionTests: ZcashTestCase {
|
||||||
XCTFail("testValidateServerAction_ConsensusBranchIDError_InvalidRemoteBranch is expected to fail.")
|
XCTFail("testValidateServerAction_ConsensusBranchIDError_InvalidRemoteBranch is expected to fail.")
|
||||||
} catch ZcashError.compactBlockProcessorConsensusBranchID {
|
} catch ZcashError.compactBlockProcessorConsensusBranchID {
|
||||||
} catch {
|
} catch {
|
||||||
XCTFail("testValidateServerAction_ConsensusBranchIDError_InvalidRemoteBranch is expected to fail but error \(error) doesn't match ZcashError.compactBlockProcessorConsensusBranchID")
|
XCTFail("""
|
||||||
|
testValidateServerAction_ConsensusBranchIDError_InvalidRemoteBranch is expected to fail but error \(error) doesn't match \
|
||||||
|
ZcashError.compactBlockProcessorConsensusBranchID
|
||||||
|
""")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +124,10 @@ final class ValidateServerActionTests: ZcashTestCase {
|
||||||
XCTAssertEqual(expected, -1026109260)
|
XCTAssertEqual(expected, -1026109260)
|
||||||
XCTAssertEqual(found, 1)
|
XCTAssertEqual(found, 1)
|
||||||
} catch {
|
} catch {
|
||||||
XCTFail("testValidateServerAction_ConsensusBranchIDError_ValidRemoteBranch is expected to fail but error \(error) doesn't match ZcashError.compactBlockProcessorWrongConsensusBranchId")
|
XCTFail("""
|
||||||
|
testValidateServerAction_ConsensusBranchIDError_ValidRemoteBranch is expected to fail but error \(error) doesn't match \
|
||||||
|
ZcashError.compactBlockProcessorWrongConsensusBranchId
|
||||||
|
""")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ class CompactBlockProcessorOfflineTests: ZcashTestCase {
|
||||||
try FileManager.default.removeItem(at: testTempDirectory)
|
try FileManager.default.removeItem(at: testTempDirectory)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: [1095] review this test https://github.com/zcash/ZcashLightClientKit/issues/1095
|
// TODO: [#1095] review this test https://github.com/zcash/ZcashLightClientKit/issues/1095
|
||||||
// func testComputeProcessingRangeForSingleLoop() async throws {
|
// func testComputeProcessingRangeForSingleLoop() async throws {
|
||||||
// let network = ZcashNetworkBuilder.network(for: .testnet)
|
// let network = ZcashNetworkBuilder.network(for: .testnet)
|
||||||
// let rustBackend = ZcashRustBackend.makeForTests(fsBlockDbRoot: testTempDirectory, networkType: .testnet)
|
// let rustBackend = ZcashRustBackend.makeForTests(fsBlockDbRoot: testTempDirectory, networkType: .testnet)
|
||||||
|
|
|
@ -11,7 +11,7 @@ import Foundation
|
||||||
import XCTest
|
import XCTest
|
||||||
@testable import ZcashLightClientKit
|
@testable import ZcashLightClientKit
|
||||||
|
|
||||||
// TODO: [1098] review tests, after progress reporting some of them may not have a sense anymore
|
// TODO: [#1098] review tests, after progress reporting some of them may not have a sense anymore
|
||||||
// https://github.com/zcash/ZcashLightClientKit/issues/1098
|
// https://github.com/zcash/ZcashLightClientKit/issues/1098
|
||||||
class SynchronizerOfflineTests: ZcashTestCase {
|
class SynchronizerOfflineTests: ZcashTestCase {
|
||||||
let data = TestsData(networkType: .testnet)
|
let data = TestsData(networkType: .testnet)
|
||||||
|
|
|
@ -212,7 +212,7 @@ extension TestCoordinator {
|
||||||
func reset(saplingActivation: BlockHeight, branchID: String, chainName: String) throws {
|
func reset(saplingActivation: BlockHeight, branchID: String, chainName: String) throws {
|
||||||
Task {
|
Task {
|
||||||
await self.synchronizer.blockProcessor.stop()
|
await self.synchronizer.blockProcessor.stop()
|
||||||
// TODO: [1102] review and potentially fix/remove commented code https://github.com/zcash/ZcashLightClientKit/issues/1102
|
// TODO: [#1102] review and potentially fix/remove commented code https://github.com/zcash/ZcashLightClientKit/issues/1102
|
||||||
// let config = await self.synchronizer.blockProcessor.config
|
// let config = await self.synchronizer.blockProcessor.config
|
||||||
//
|
//
|
||||||
// let newConfig = CompactBlockProcessor.Configuration(
|
// let newConfig = CompactBlockProcessor.Configuration(
|
||||||
|
|
Loading…
Reference in New Issue