Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
672 changes: 672 additions & 0 deletions CLAUDE.md

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions internal/bminventory/inventory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,14 @@ func mockNoChangeInOperatorDependencies(mock *operators.MockAPI) {

func TestValidator(t *testing.T) {
RegisterFailHandler(Fail)
common.InitializeDBTest()
defer common.TerminateDBTest()
RunSpecs(t, "inventory_test")
}

var _ = BeforeSuite(func() {
common.InitializeDBTest()
DeferCleanup(common.TerminateDBTest)
})

var _ = Describe("RegisterDisconnectedCluster", func() {
var (
ctx = context.Background()
Expand Down
5 changes: 1 addition & 4 deletions internal/cluster/cluster_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,5 @@ var _ = BeforeSuite(func() {
}

common.InitializeDBTest()
})

var _ = AfterSuite(func() {
common.TerminateDBTest()
DeferCleanup(common.TerminateDBTest)
})
5 changes: 3 additions & 2 deletions internal/controller/controllers/controllers_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ const (

func TestControllers(t *testing.T) {
RegisterFailHandler(Fail)
common.InitializeDBTest()
defer common.TerminateDBTest()
RunSpecs(t, "controllers tests")
}

Expand All @@ -48,6 +46,9 @@ var (
)

var _ = BeforeSuite(func() {
common.InitializeDBTest()
DeferCleanup(common.TerminateDBTest)

// Configure the Kubernetes and controller-runtime libraries so that they write log messages
// to the Ginkgo writer, this way those messages are automatically associated to the right
// test.
Expand Down
7 changes: 5 additions & 2 deletions internal/events/event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2010,7 +2010,10 @@ func WithTime(t time.Time) types.GomegaMatcher {

func TestEvents(t *testing.T) {
RegisterFailHandler(Fail)
common.InitializeDBTest()
defer common.TerminateDBTest()
RunSpecs(t, "Events test Suite")
}

var _ = BeforeSuite(func() {
common.InitializeDBTest()
DeferCleanup(common.TerminateDBTest)
})
7 changes: 5 additions & 2 deletions internal/host/hostcommands/instruction_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,10 @@ func checkStepsByState(state string, host *models.Host, db *gorm.DB, mockEvents

func TestHostCommands(t *testing.T) {
RegisterFailHandler(Fail)
common.InitializeDBTest()
defer common.TerminateDBTest()
RunSpecs(t, "Host commands test Suite")
}

var _ = BeforeSuite(func() {
common.InitializeDBTest()
DeferCleanup(common.TerminateDBTest)
})
5 changes: 1 addition & 4 deletions internal/host/hosts_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,5 @@ var _ = BeforeSuite(func() {
}

common.InitializeDBTest()
})

var _ = AfterSuite(func() {
common.TerminateDBTest()
DeferCleanup(common.TerminateDBTest)
})
7 changes: 5 additions & 2 deletions internal/host/hostutil/host_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,10 @@ var _ = Describe("GetHostInstallationDisk", func() {

func TestHostUtil(t *testing.T) {
RegisterFailHandler(Fail)
common.InitializeDBTest()
defer common.TerminateDBTest()
RunSpecs(t, "HostUtil Tests")
}

var _ = BeforeSuite(func() {
common.InitializeDBTest()
DeferCleanup(common.TerminateDBTest)
})
7 changes: 5 additions & 2 deletions internal/infraenv/infraenv_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import (

func TestInfraEnv(t *testing.T) {
RegisterFailHandler(Fail)
common.InitializeDBTest()
defer common.TerminateDBTest()
RunSpecs(t, "infraEnv tests")
}

var _ = BeforeSuite(func() {
common.InitializeDBTest()
DeferCleanup(common.TerminateDBTest)
})
8 changes: 5 additions & 3 deletions internal/manifests/manifests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ import (

func TestValidator(t *testing.T) {
RegisterFailHandler(Fail)

common.InitializeDBTest()
defer common.TerminateDBTest()
RunSpecs(t, "manifests_test")
}

var _ = BeforeSuite(func() {
common.InitializeDBTest()
DeferCleanup(common.TerminateDBTest)
})

const contentAsYAMLPatch = `---
- op: replace
path: /status/infrastructureTopology
Expand Down
7 changes: 5 additions & 2 deletions internal/migrations/migrations_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ import (

func TestMigrations(t *testing.T) {
RegisterFailHandler(Fail)
common.InitializeDBTest()
defer common.TerminateDBTest()
RunSpecs(t, "Migrations Suite")
}

var _ = BeforeSuite(func() {
common.InitializeDBTest()
DeferCleanup(common.TerminateDBTest)
})

// migrateToBefore is a helper function for migration tests
// It runs all the migrations before the given one to simplify setting up a valid test scenario
// nolint,unused
Expand Down
7 changes: 5 additions & 2 deletions internal/operators/handler/handler_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import (

func TestHandler(t *testing.T) {
RegisterFailHandler(Fail)
common.InitializeDBTest()
defer common.TerminateDBTest()
RunSpecs(t, "Operators handler Suite")
}

var _ = BeforeSuite(func() {
common.InitializeDBTest()
DeferCleanup(common.TerminateDBTest)
})
7 changes: 5 additions & 2 deletions internal/releasesources/release_sources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ import (

func TestHandler(t *testing.T) {
RegisterFailHandler(Fail)
common.InitializeDBTest()
defer common.TerminateDBTest()
RunSpecs(t, "releasesources")
}

var _ = BeforeSuite(func() {
common.InitializeDBTest()
DeferCleanup(common.TerminateDBTest)
})

func setGetReleasesMock(releasesMock *MockopenShiftReleasesAPIClientInterface, testsParams []RequestResponseParameters) {
for _, testParams := range testsParams {
releasesGraph, err := getExpectedReleasesGraphForValidParams(testParams.Channel, testParams.Version, testParams.CPUArchitecture)
Expand Down
11 changes: 7 additions & 4 deletions internal/usage/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@ import (

func TestUsageEvents(t *testing.T) {
RegisterFailHandler(Fail)
common.InitializeDBTest()
defer common.TerminateDBTest()
RunSpecs(t, "Usage test Suite")
}

var _ = BeforeSuite(func() {
common.InitializeDBTest()
DeferCleanup(common.TerminateDBTest)
})

var _ = Describe("Feature Usage", func() {
var (
db *gorm.DB
Expand All @@ -31,7 +34,7 @@ var _ = Describe("Feature Usage", func() {
ctrl *gomock.Controller
)

var _ = BeforeSuite(func() {
BeforeEach(func() {
ctrl = gomock.NewController(GinkgoT())
db, dbName = common.PrepareTestDB()
manager = NewManager(logrus.WithField("pkg", "usage"), commontesting.GetDummyNotificationStream(ctrl))
Expand All @@ -43,7 +46,7 @@ var _ = Describe("Feature Usage", func() {
Expect(db.Create(&cluster).Error).ShouldNot(HaveOccurred())
})

var _ = AfterSuite(func() {
AfterEach(func() {
common.DeleteTestDB(db, dbName)
})

Expand Down
7 changes: 5 additions & 2 deletions internal/versions/kube_api_versions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ import (

func TestHandler_Versions(t *testing.T) {
RegisterFailHandler(Fail)
common.InitializeDBTest()
defer common.TerminateDBTest()
RunSpecs(t, "versions")
}

var _ = BeforeSuite(func() {
common.InitializeDBTest()
DeferCleanup(common.TerminateDBTest)
})

var defaultOsImages = models.OsImages{
&models.OsImage{
CPUArchitecture: swag.String(common.X86CPUArchitecture),
Expand Down
7 changes: 5 additions & 2 deletions pkg/auth/auth_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import (

func TestCluster(t *testing.T) {
RegisterFailHandler(Fail)
common.InitializeDBTest()
defer common.TerminateDBTest()
RunSpecs(t, "auth tests")
}

var _ = BeforeSuite(func() {
common.InitializeDBTest()
DeferCleanup(common.TerminateDBTest)
})