Skip to content

Commit

Permalink
tests: Update unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Mahendra Paipuri <[email protected]>
  • Loading branch information
mahendrapaipuri committed Dec 16, 2023
1 parent 0db1488 commit 50a5db3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cmd/batchjob_exporter/batchjob_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

var (
binary, _ = filepath.Abs("bin/batchjob_exporter")
binary, _ = filepath.Abs("../../bin/batchjob_exporter")
)

const (
Expand All @@ -36,7 +36,14 @@ func TestFileDescriptorLeak(t *testing.T) {
t.Errorf("unable to read process stats: %s", err)
}

exporter := exec.Command(binary, "--web.listen-address", address)
fixturePath, err := filepath.Abs("../../pkg/collector/fixtures/sys/fs/cgroup")
if err != nil {
t.Errorf("Failed to read fixtures: %s", err)
}

exporter := exec.Command(
binary, "--web.listen-address", address, "--path.cgroupfs", fixturePath,
)
test := func(pid int) error {
if err := queryExporter(address); err != nil {
return err
Expand Down Expand Up @@ -75,6 +82,7 @@ func TestFileDescriptorLeak(t *testing.T) {

func queryExporter(address string) error {
resp, err := http.Get(fmt.Sprintf("http://%s/metrics", address))
fmt.Println(err)
if err != nil {
return err
}
Expand Down

0 comments on commit 50a5db3

Please sign in to comment.