Build & Test
This section covers building and testing SmartModules locally, and the next section describes how to load them on the Cluster for live traffic testing.
Build - Operation
Navigate to my-filter
project directory and run build
:
$ smdk build
...
Compiling my-filter v0.1.0 (~/smdk/my-filter)
Finished release-lto [optimized] target(s) in 12.65s
The build process generated an binary optimized for WebAssembly. We are now ready to test it.
Test - Operation
When testing a SmartModule you can provide the test input via direct text
, specifying a file
,
or reading from the stdin
.
Let's perform the matching test for our my-filter
that looks for letter a
:
$ smdk test --text cat
loading module at: ~/smdk/my-filter/target/wasm32-unknown-unknown/release-lto/my_filter.wasm
1 records outputted
cat
Next, a non-matching test, reading the input from the stdin
:
$ echo -n dog | smdk test --stdin
loading module at: ~/smdk/my-filter/target/wasm32-unknown-unknown/release-lto/my_filter.wasm
0 records outputted
Checkout the smdk test -h
for additional parameters.
Checkout the next section on how upload the SmartModule to your local cluster or InfinyOn Cloud for live traffic testing.