Updated tests

This commit is contained in:
Trial97
2020-11-03 13:53:04 +02:00
committed by Dan Christian Bogos
parent a64e58278d
commit 0b55bc7899
14 changed files with 50 additions and 13 deletions

View File

@@ -75,7 +75,6 @@ func newRPCClient(cfg *config.ListenCfg) (c *rpc.Client, err error) {
//Test start here
func TestAnalyzerSIT(t *testing.T) {
for _, stest := range sTestsAlsPrf {
t.Run("TestAnalyzerSIT", stest)
}
@@ -220,4 +219,7 @@ func testAnalyzerSKillEngine(t *testing.T) {
if err := engine.KillEngine(100); err != nil {
t.Error(err)
}
if err := os.RemoveAll(anzCfg.AnalyzerSCfg().DBPath); err != nil {
t.Fatal(err)
}
}

View File

@@ -63,6 +63,9 @@ func TestNewAnalyzerService(t *testing.T) {
t.Fatal(err)
}
anz.db.Close()
if err := os.RemoveAll(cfg.AnalyzerSCfg().DBPath); err != nil {
t.Fatal(err)
}
}
func TestAnalyzerSLogTraffic(t *testing.T) {
@@ -116,6 +119,9 @@ func TestAnalyzerSLogTraffic(t *testing.T) {
if err = anz.clenaUp(); err != bleve.ErrorIndexClosed {
t.Errorf("Expected error: %v,received: %+v", bleve.ErrorIndexClosed, err)
}
if err := os.RemoveAll(cfg.AnalyzerSCfg().DBPath); err != nil {
t.Fatal(err)
}
}
func TestAnalyzersDeleteHits(t *testing.T) {
@@ -138,6 +144,9 @@ func TestAnalyzersDeleteHits(t *testing.T) {
if err = anz.deleteHits(search.DocumentMatchCollection{&search.DocumentMatch{}}); err != utils.ErrPartiallyExecuted {
t.Errorf("Expected error: %v,received: %+v", utils.ErrPartiallyExecuted, err)
}
if err := os.RemoveAll(cfg.AnalyzerSCfg().DBPath); err != nil {
t.Fatal(err)
}
}
func TestAnalyzersListenAndServe(t *testing.T) {
@@ -173,6 +182,9 @@ func TestAnalyzersListenAndServe(t *testing.T) {
anz.db.Close()
}()
anz.ListenAndServe(make(chan bool))
if err := os.RemoveAll(cfg.AnalyzerSCfg().DBPath); err != nil {
t.Fatal(err)
}
}
func TestAnalyzersV1Search(t *testing.T) {
@@ -289,4 +301,7 @@ func TestAnalyzersV1Search(t *testing.T) {
if err = anz.V1StringQuery("RequestEncoding:*gob", &reply); err != bleve.ErrorIndexClosed {
t.Errorf("Expected error: %v,received: %+v", bleve.ErrorIndexClosed, err)
}
if err := os.RemoveAll(cfg.AnalyzerSCfg().DBPath); err != nil {
t.Fatal(err)
}
}

View File

@@ -97,4 +97,7 @@ func TestNewServerCodec(t *testing.T) {
} else if cnt != 1 {
t.Errorf("Expected only one document received:%v", cnt)
}
if err := os.RemoveAll(cfg.AnalyzerSCfg().DBPath); err != nil {
t.Fatal(err)
}
}

View File

@@ -62,4 +62,7 @@ func TestNewAnalyzeConnector(t *testing.T) {
} else if cnt != 1 {
t.Errorf("Expected only one document received:%v", cnt)
}
if err := os.RemoveAll(cfg.AnalyzerSCfg().DBPath); err != nil {
t.Fatal(err)
}
}