mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-01-10 01:13:10 +00:00
Removed modules: - sales (including reservations, slot queue, marketplace abstractions, state machines, etc) - purchasing - erasure coding - contract interactions - prover - slot builder - block exchange payments - sales/purchasing from REST api - removed persistence command and all config params from cli configuration - CI workflows (devnet, dist tests, cirdl build, start eth node, contracts version reporting) - unused modules from tests - marketplace integration tests, and starting provider/validator/hardhat nodes - unused manifest properties - integration tests using the above # Conflicts: # .github/workflows/ci-reusable.yml # .github/workflows/docker.yml # build.nims # codex/blockexchange/engine/payments.nim # codex/codex.nim # codex/conf.nim # codex/contracts/Readme.md # codex/erasure.nim # codex/erasure/backend.nim # codex/erasure/backends/leopard.nim # codex/erasure/erasure.nim # codex/rest/api.nim # codex/sales.nim # codex/sales/reservations.nim # codex/sales/states/filled.nim # codex/sales/states/preparing.nim # codex/sales/states/provingsimulated.nim # codex/slots/builder/builder.nim # codex/slots/converters.nim # codex/slots/proofs/backends/circomcompat.nim # codex/slots/proofs/backends/converters.nim # codex/slots/proofs/prover.nim # codex/slots/sampler/sampler.nim # codex/slots/sampler/utils.nim # codex/slots/types.nim # tests/integration/5_minutes/testrestapivalidation.nim # tests/integration/hardhatprocess.nim # tests/integration/multinodes.nim # tools/cirdl/cirdl.nim
71 lines
1.8 KiB
Nim
71 lines
1.8 KiB
Nim
import pkg/questionable
|
|
import pkg/questionable/results
|
|
import pkg/confutils
|
|
import pkg/chronicles
|
|
import pkg/chronos/asyncproc
|
|
import pkg/ethers
|
|
import pkg/libp2p
|
|
import std/os
|
|
import std/strutils
|
|
import codex/conf
|
|
import ./codexclient
|
|
import ./nodeprocess
|
|
|
|
export codexclient
|
|
export chronicles
|
|
export nodeprocess
|
|
|
|
logScope:
|
|
topics = "integration testing codex process"
|
|
|
|
type CodexProcess* = ref object of NodeProcess
|
|
client: ?CodexClient
|
|
|
|
method workingDir(node: CodexProcess): string =
|
|
return currentSourcePath() / ".." / ".." / ".."
|
|
|
|
method executable(node: CodexProcess): string =
|
|
return "build" / "storage"
|
|
|
|
method startedOutput(node: CodexProcess): string =
|
|
return "REST service started"
|
|
|
|
method processOptions(node: CodexProcess): set[AsyncProcessOption] =
|
|
return {AsyncProcessOption.StdErrToStdOut}
|
|
|
|
method outputLineEndings(node: CodexProcess): string {.raises: [].} =
|
|
return "\n"
|
|
|
|
method onOutputLineCaptured(node: CodexProcess, line: string) {.raises: [].} =
|
|
discard
|
|
|
|
proc dataDir(node: CodexProcess): string =
|
|
let config = CodexConf.load(cmdLine = node.arguments, quitOnFailure = false)
|
|
return config.dataDir.string
|
|
|
|
proc apiUrl*(node: CodexProcess): string =
|
|
let config = CodexConf.load(cmdLine = node.arguments, quitOnFailure = false)
|
|
return
|
|
"http://" & config.apiBindAddress.get() & ":" & $config.apiPort & "/api/storage/v1"
|
|
|
|
proc client*(node: CodexProcess): CodexClient =
|
|
if client =? node.client:
|
|
return client
|
|
let client = CodexClient.new(node.apiUrl)
|
|
node.client = some client
|
|
return client
|
|
|
|
method stop*(node: CodexProcess) {.async.} =
|
|
logScope:
|
|
nodeName = node.name
|
|
|
|
await procCall NodeProcess(node).stop()
|
|
|
|
trace "stopping Storage client"
|
|
if client =? node.client:
|
|
await client.close()
|
|
node.client = none CodexClient
|
|
|
|
method removeDataDir*(node: CodexProcess) =
|
|
removeDir(node.dataDir)
|