Skip to content

Commit

Permalink
Attempt to fix tests in Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
treydock committed May 18, 2024
1 parent be1419e commit a989651
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions cgroup_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,26 @@ import (

kingpin "github.com/alecthomas/kingpin/v2"
"github.com/go-kit/log"
"github.com/treydock/cgroup_exporter/collector"
)

const (
address = "localhost:19306"
)

func TestMain(m *testing.M) {
if _, err := kingpin.CommandLine.Parse([]string{"--config.paths=/user.slice"}); err != nil {
os.Exit(1)
}
_, filename, _, _ := runtime.Caller(0)
dir := filepath.Dir(filename)
fixture := filepath.Join(dir, "fixtures")
collector.CgroupRoot = &fixture
procFixture := filepath.Join(fixture, "proc")
collector.ProcRoot = &procFixture
varTrue := true
disableExporterMetrics = &varTrue
args := []string{
"--config.paths=/user.slice",
fmt.Sprintf("--path.cgroup.root=%s", fixture),
fmt.Sprintf("--path.proc.root=%s", procFixture),
"--web.disable-exporter-metrics",
}
if _, err := kingpin.CommandLine.Parse(args); err != nil {
os.Exit(1)
}
w := log.NewSyncWriter(os.Stderr)
logger := log.NewLogfmtLogger(w)
go func() {
Expand Down

0 comments on commit a989651

Please sign in to comment.