-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: adding node factory tests (#2524)
- Loading branch information
1 parent
8d7eb3a
commit a1b3e09
Showing
3 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{.used.} | ||
|
||
import | ||
testutils/unittests, | ||
chronos | ||
|
||
import | ||
../testlib/wakunode, | ||
../../waku/factory/node_factory, | ||
../../waku/waku_node | ||
|
||
suite "Node Factory": | ||
test "Set up a node based on default configurations": | ||
let conf = defaultTestWakuNodeConf() | ||
|
||
let node = setupNode(conf).valueOr: | ||
raiseAssert error | ||
|
||
check: | ||
not node.isNil() | ||
node.wakuArchive.isNil() | ||
node.wakuStore.isNil() | ||
node.wakuFilter.isNil() | ||
not node.wakuStoreClient.isNil() | ||
not node.rendezvous.isNil() | ||
|
||
test "Set up a node with Store enabled": | ||
var conf = defaultTestWakuNodeConf() | ||
conf.store = true | ||
|
||
let node = setupNode(conf).valueOr: | ||
raiseAssert error | ||
|
||
check: | ||
not node.isNil() | ||
not node.wakuStore.isNil() | ||
not node.wakuArchive.isNil() | ||
|
||
test "Set up a node with Filter enabled": | ||
var conf = defaultTestWakuNodeConf() | ||
conf.filter = true | ||
|
||
let node = setupNode(conf).valueOr: | ||
raiseAssert error | ||
|
||
check: | ||
not node.isNil() | ||
not node.wakuFilter.isNil() | ||
|
||
test "Start a node based on default configurations": | ||
let conf = defaultTestWakuNodeConf() | ||
|
||
let node = setupNode(conf).valueOr: | ||
raiseAssert error | ||
|
||
assert not node.isNil(), "Node can't be nil" | ||
|
||
let startRes = catch: (waitFor startNode(node, conf)) | ||
|
||
assert not startRes.isErr(), "Exception starting node" | ||
assert startRes.get().isOk(), "Error starting node " & startRes.get().error | ||
|
||
check: | ||
node.started == true | ||
|
||
## Cleanup | ||
waitFor node.stop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters