Skip to content

Commit

Permalink
Fix test e2e-kind test run
Browse files Browse the repository at this point in the history
  • Loading branch information
engedaam committed Dec 11, 2024
1 parent a740974 commit c0da244
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test/pkg/debug/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,22 @@ const (
var m *Monitor
var e *EventClient

func BeforeEach(ctx context.Context, config *rest.Config, kubeClient client.Client) {
func BeforeSuite(ctx context.Context, config *rest.Config, kubeClient client.Client) {
// If the test is labeled as NoWatch, then the node/pod monitor will just list at the beginning
// of the test rather than perform a watch during it
if !lo.Contains(ginkgo.CurrentSpecReport().Labels(), NoWatch) {
m = New(ctx, config, kubeClient)
m.MustStart()
}
}

func AfterSuite(ctx context.Context, config *rest.Config, kubeClient client.Client) {
if !lo.Contains(ginkgo.CurrentSpecReport().Labels(), NoWatch) {
m.Stop()
}
}

func BeforeEach(ctx context.Context, config *rest.Config, kubeClient client.Client) {
if !lo.Contains(ginkgo.CurrentSpecReport().Labels(), NoEvents) {
e = NewEventClient(kubeClient)
}
Expand Down
2 changes: 2 additions & 0 deletions test/suites/perf/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ func TestPerf(t *testing.T) {
RegisterFailHandler(Fail)
BeforeSuite(func() {
env = common.NewEnvironment(t)
debug.BeforeSuite(env.Context, env.Config, env.Client)
})
AfterSuite(func() {
// Write out the timestamps from our tests
if err := debug.WriteTimestamps(env.OutputDir, env.TimeIntervalCollector); err != nil {
log.FromContext(env).Info(fmt.Sprintf("Failed to write timestamps to files, %s", err))
}
debug.AfterSuite(env.Context, env.Config, env.Client)
env.Stop()
})
RunSpecs(t, "Perf")
Expand Down

0 comments on commit c0da244

Please sign in to comment.