diff --git a/config/actionscfg_test.go b/config/actionscfg_test.go index af4f663c2..3cbe8d19d 100644 --- a/config/actionscfg_test.go +++ b/config/actionscfg_test.go @@ -371,3 +371,26 @@ func TestActionSCloneSection(t *testing.T) { t.Errorf("Expected %v \n but received \n %v", exp, actCfg) } } +func TestDiffActionsOptsJsonCfg(t *testing.T) { + d := &ActionsOptsJson{} + v1 := &ActionsOpts{ + PosterAttempts: []*utils.DynamicIntOpt{}, + } + v2 := &ActionsOpts{ + PosterAttempts: []*utils.DynamicIntOpt{{ + FilterIDs: []string{"fltr1"}, + }, + }, + } + exp := &ActionsOptsJson{ + + PosterAttempts: []*utils.DynamicIntOpt{{ + FilterIDs: []string{"fltr1"}, + }, + }, + } + if rcv := diffActionsOptsJsonCfg(d, v1, v2); utils.ToJSON(rcv) != utils.ToJSON(exp) { + t.Errorf("Expected <%v> \n Received \n <%v>", exp, rcv) + } + +} diff --git a/config/analyzerscfg_test.go b/config/analyzerscfg_test.go index f7fff1865..471fdbf37 100644 --- a/config/analyzerscfg_test.go +++ b/config/analyzerscfg_test.go @@ -204,3 +204,41 @@ func TestAnalyzerSCloneSection(t *testing.T) { t.Errorf("Expected %v \n but received \n %v", utils.ToJSON(exp), utils.ToJSON(anlCfg)) } } + +// //unfinished +// func TestToLoadFromJSONCfg(t *testing.T) { +// anzOpts := &AnalyzerSOpts{ +// ExporterIDs: []*utils.DynamicStringSliceOpt{ +// { +// FilterIDs: []string{"filtr1"}, +// }, +// }, +// } +// var jsonAnzOpts *AnalyzerSOptsJson + +// anzOpts.loadFromJSONCfg(jsonAnzOpts) + +// } + +func TestDiffAnalyzerSOptsJsonCfg(t *testing.T) { + d := &AnalyzerSOptsJson{} + v1 := &AnalyzerSOpts{ + ExporterIDs: []*utils.DynamicStringSliceOpt{}, + } + v2 := &AnalyzerSOpts{ + ExporterIDs: []*utils.DynamicStringSliceOpt{{ + FilterIDs: []string{"test"}, + }, + }, + } + exp := &AnalyzerSOptsJson{ + + ExporterIDs: []*utils.DynamicStringSliceOpt{{ + FilterIDs: []string{"test"}, + }, + }, + } + if rcv := diffAnalyzerSOptsJsonCfg(d, v1, v2); utils.ToJSON(rcv) != utils.ToJSON(exp) { + t.Errorf("Expected <%v> \n Received \n <%v>", exp, rcv) + } +}