Skip to content

Commit

Permalink
Fix probe agent test setup
Browse files Browse the repository at this point in the history
  • Loading branch information
afritzler committed Sep 13, 2024
1 parent 479b3dc commit afd1de4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
18 changes: 17 additions & 1 deletion internal/probe/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,32 @@
package probe_test

import (
"context"
"encoding/json"
"fmt"
"net/http"

"github.com/ironcore-dev/metal-operator/internal/probe"

"github.com/ironcore-dev/metal-operator/internal/api/registry"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

var _ = Describe("ProbeServer", func() {
var _ = Describe("ProbeAgent", func() {
BeforeEach(func() {
By("Starting the probe agent")
ctx, cancel := context.WithCancel(context.Background())
DeferCleanup(cancel)

// Initialize your probe agent
probeAgent = probe.NewAgent(systemUUID, registryURL)
go func() {
defer GinkgoRecover()
Expect(probeAgent.Start(ctx)).To(Succeed(), "failed to start probe agent")
}()
})

It("should ensure the correct endpoints have been registered", func() {
By("performing a GET request to the /systems/{uuid} endpoint")
var resp *http.Response
Expand Down
7 changes: 0 additions & 7 deletions internal/probe/probe_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,4 @@ var _ = BeforeSuite(func() {
defer GinkgoRecover()
Expect(registryServer.Start(ctx)).To(Succeed(), "failed to start registry agent")
}()

// Initialize your probe server
probeAgent = probe.NewAgent(systemUUID, registryURL)
go func() {
defer GinkgoRecover()
Expect(probeAgent.Start(ctx)).To(Succeed(), "failed to start probe agent")
}()
})

0 comments on commit afd1de4

Please sign in to comment.