Skip to content

Commit

Permalink
Merge pull request #626 from Security-Onion-Solutions/cogburn/robust-…
Browse files Browse the repository at this point in the history
…tests

Fixes for running multiple tests
  • Loading branch information
coreyogburn authored Aug 28, 2024
2 parents d03addd + 2be6cf4 commit 260bcfb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/modules/detections/ai_summary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"io/fs"
"sort"
"testing"
"time"

"github.com/apex/log"
"github.com/security-onion-solutions/securityonion-soc/model"
Expand Down Expand Up @@ -55,6 +56,8 @@ func TestRefreshAiSummaries(t *testing.T) {

logger := log.WithField("test", true)

lastSuccessfulAiUpdate = time.Time{}

err := RefreshAiSummaries(loader, model.SigLangSigma, &isRunning, "baseRepoFolder", repo, branch, logger, iom)
assert.NoError(t, err)
}
3 changes: 3 additions & 0 deletions server/modules/detections/detengine_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,13 +394,16 @@ func TestCheckTemplate(t *testing.T) {
detStore.EXPECT().DoesTemplateExist(ctx, "so-detection").Return(false, nil)
detStore.EXPECT().DoesTemplateExist(ctx, "so-detection").Return(true, nil).Times(1)

templateFound = false

results := []bool{}
for i := 0; i < 10; i++ {
result := CheckTemplate(ctx, detStore)
results = append(results, result)
}

assert.Equal(t, []bool{false, true, true, true, true, true, true, true, true, true}, results)
assert.Equal(t, true, templateFound)
}

func TestUpdateRepos(t *testing.T) {
Expand Down

0 comments on commit 260bcfb

Please sign in to comment.