SMDK - Build & Test a SmartModule

SmartModules are binaries developed for real-time data stream processing, requiring in-line and live testing facilities. This section covers in-line testing, and the next section describes how to load SmartModules on the Cluster for live traffic testing.

Prerequisites

This section assumes that SMDK is installed and my-filter project has been generated.

 

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 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.

 

Steps

  1. Install SMDK
  2. Generate a SmartModule
  3. Build and Test
  4. Load to your Cluster
  5. Publish to SmartModule Hub