From 6b2b04d416bade2258a7ab605649f10702536531 Mon Sep 17 00:00:00 2001 From: bacnd Date: Sat, 29 Oct 2022 16:20:48 +0700 Subject: [PATCH] fix test and doc --- README.MD | 39 ++++++++++++++++++---- rules/conditional/conditional_rule_test.go | 18 +++++----- 2 files changed, 41 insertions(+), 16 deletions(-) diff --git a/README.MD b/README.MD index b4b9a7d..9e3274c 100644 --- a/README.MD +++ b/README.MD @@ -1,5 +1,14 @@ # Rule Engine Golang [![Go](https://github.com/dipper-iot/dipper-engine/actions/workflows/go.yml/badge.svg?branch=main)](https://github.com/dipper-iot/dipper-engine/actions/workflows/go.yml) [![CodeQL](https://github.com/dipper-iot/dipper-engine/actions/workflows/codeql.yml/badge.svg?branch=main)](https://github.com/dipper-iot/dipper-engine/actions/workflows/codeql.yml) [![Coverage Status](https://coveralls.io/repos/github/dipper-iot/dipper-engine/badge.svg?branch=main)](https://coveralls.io/github/dipper-iot/dipper-engine?branch=main) + + + + * [Setup](#setup) + * [Run](#run) + * [Rule Engine](#rule-engine) + * [Example Developer Test](#example-developer-test) + + ## Setup ```shell @@ -41,18 +50,36 @@ Start Dipper Engine Rules: 5 ----------------------------------------------------------- -No Rule Name Worker Status -1 log-core 1 enable -2 arithmetic 1 enable -3 fork 1 enable -4 conditional 1 enable -5 switch 1 enable +No Rule Name Worker Infinity Status +1 arithmetic 1 false enable +2 conditional 1 false enable +3 fork 1 false enable +4 input-redis-queue 0 true disable +5 input-redis-queue-extend 1 true enable +6 log-core 1 false enable +7 output-redis-queue 0 false disable +8 output-redis-queue-extend 1 false enable +9 switch 1 false enable ----------------------------------------------------------- Running Engine... ``` +## Rule Engine + +| No | Rule | Description | Infinity | Doc | +|:-----:|:-----------------------------------|:---------------------------------|:--------:|-----| +| 1 | arithmetic | operator match rule | false | | +| 2 | conditional | compare data rule | false | | +| 3 | fork | fork to rules | false | | +| 4 | input-redis-queue | input data from queue on config | true | | +| 5 | input-redis-queue-extend | input data from queue on option | true | | +| 6 | log-core | log to console | false | | +| 7 | output-redis-queue | output data from queue on config | false | | +| 8 | output-redis-queue-extend | output data from queue on option | false | | +| 9 | switch | switch to rules | false | | + ## Example Developer Test ```golang diff --git a/rules/conditional/conditional_rule_test.go b/rules/conditional/conditional_rule_test.go index ee61eb8..3370a05 100644 --- a/rules/conditional/conditional_rule_test.go +++ b/rules/conditional/conditional_rule_test.go @@ -38,11 +38,10 @@ func TestConditionalRule_Run(t *testing.T) { "next_true": "4", "next_false": "4", }, - End: false, - Infinite: false, - Debug: false, - RuleId: "1", - NodeId: "1", + End: false, + Debug: false, + RuleId: "1", + NodeId: "1", }, Data: map[string]interface{}{ "default": map[string]interface{}{ @@ -78,11 +77,10 @@ func TestConditionalRule_Run(t *testing.T) { "next_true": "4", "next_false": "4", }, - End: false, - Infinite: false, - Debug: false, - RuleId: "1", - NodeId: "1", + End: false, + Debug: false, + RuleId: "1", + NodeId: "1", }, Data: map[string]interface{}{ "default": map[string]interface{}{