mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-01-08 00:13:08 +00:00
Add availability enabled parameter
This commit is contained in:
parent
fc971feecf
commit
2dd0cb4e6a
@ -364,7 +364,7 @@ asyncchecksuite "Reservations module":
|
||||
a: Availability
|
||||
) {.gcsafe, async: (raises: []).} =
|
||||
called = true
|
||||
availability.freeSize -= 1.u256
|
||||
availability.freeSize -= 1.uint64
|
||||
discard await reservations.update(availability)
|
||||
|
||||
check not called
|
||||
|
||||
@ -369,7 +369,7 @@ asyncchecksuite "Sales":
|
||||
): Future[?!void] {.async.} =
|
||||
slotIndex = slot
|
||||
let blk = bt.Block.new(@[1.byte]).get
|
||||
await onBatch(blk.repeat(request.ask.slotSize.truncate(int)))
|
||||
await onBatch(blk.repeat(request.ask.slotSize))
|
||||
|
||||
let sold = newFuture[void]()
|
||||
sales.onSale = proc(request: StorageRequest, slotIndex: uint64) =
|
||||
|
||||
@ -42,6 +42,19 @@ twonodessuite "REST API":
|
||||
space.quotaUsedBytes == 65592.NBytes
|
||||
space.quotaReservedBytes == 12.NBytes
|
||||
|
||||
test "created correctly an availability when not enabled by default", twoNodesConfig:
|
||||
let totalSize = 12.u256
|
||||
let minPricePerBytePerSecond = 1.u256
|
||||
let totalCollateral = totalSize * minPricePerBytePerSecond
|
||||
let availability = client1.postAvailability(
|
||||
totalSize = totalSize,
|
||||
duration = 2.u256,
|
||||
minPricePerBytePerSecond = minPricePerBytePerSecond,
|
||||
totalCollateral = totalCollateral,
|
||||
enabled = false.some,
|
||||
).get
|
||||
check availability.enabled == false
|
||||
|
||||
test "node lists local files", twoNodesConfig:
|
||||
let content1 = "some file contents"
|
||||
let content2 = "some other contents"
|
||||
|
||||
@ -135,6 +135,18 @@ multinodesuite "Sales":
|
||||
check updatedAvailability.totalSize == 100000
|
||||
check updatedAvailability.freeSize == 100000
|
||||
|
||||
test "updating availability - updating enabled", salesConfig:
|
||||
let availability = host.postAvailability(
|
||||
totalSize = 140000.u256,
|
||||
duration = 200.u256,
|
||||
minPricePerBytePerSecond = 3.u256,
|
||||
totalCollateral = 300.u256,
|
||||
enabled = true.some,
|
||||
).get
|
||||
host.patchAvailability(availability.id, enabled = false.some)
|
||||
let updatedAvailability = (host.getAvailabilities().get).findItem(availability).get
|
||||
check updatedAvailability.enabled == false
|
||||
|
||||
test "updating availability - updating totalSize does not allow bellow utilized",
|
||||
salesConfig:
|
||||
let originalSize = 0xFFFFFF.uint64
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user