Skip to content

Commit

Permalink
add split tests
Browse files Browse the repository at this point in the history
  • Loading branch information
robbycochran committed Feb 9, 2024
1 parent 642e65f commit b3693c3
Show file tree
Hide file tree
Showing 5 changed files with 531 additions and 0 deletions.
55 changes: 55 additions & 0 deletions integration-tests/connections_async_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//go:build ci || connections
// +build ci connections

// TODO Merge these tests into one launch of collector, reset connection to sensor?
// TODO Remove tests with connection status disabled -- what is the value of testing

package integrationtests

import (
"testing"

"github.com/stretchr/testify/suite"

"github.com/stackrox/collector/integration-tests/suites"
)

// By default, a failed connection is not reported.
func TestAsyncConnectionBlocked(t *testing.T) {
blockedAsyncConnection := &suites.AsyncConnectionTestSuite{
DisableConnectionStatusTracking: false,
BlockConnection: true,
ExpectToSeeTheConnection: false,
}
suite.Run(t, blockedAsyncConnection)
}

// A successfull connection is always reported
func TestAsyncConnectionSuccess(t *testing.T) {
asyncConnection := &suites.AsyncConnectionTestSuite{
DisableConnectionStatusTracking: false,
BlockConnection: false,
ExpectToSeeTheConnection: true,
}
suite.Run(t, asyncConnection)
}

// With connection status tracking disabled, failed async connections are reported.
func TestAsyncConnectionBlockedWithDisableTracking(t *testing.T) {
blockedAsyncConnection := &suites.AsyncConnectionTestSuite{
DisableConnectionStatusTracking: true,
BlockConnection: true,
ExpectToSeeTheConnection: true,
}
suite.Run(t, blockedAsyncConnection)
}

// With connection status tracking disabled, a successfull connection is always reported
func TestAsyncConnectionSuccessWithDisableTracking(t *testing.T) {
asyncConnection := &suites.AsyncConnectionTestSuite{
DisableConnectionStatusTracking: true,
BlockConnection: false,
ExpectToSeeTheConnection: true,
}
suite.Run(t, asyncConnection)
}
Loading

0 comments on commit b3693c3

Please sign in to comment.