SMDK - Build & Test a SmartModule
This section covers building and testing SmartModules locally, and the next section describes how to load them on the Cluster for live traffic testing.
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.
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 outputed
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 outputed
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.