Skip to content

Commit

Permalink
Add test for collector config command
Browse files Browse the repository at this point in the history
  • Loading branch information
jwilder committed Jan 24, 2025
1 parent 1d2c782 commit f727c8a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions cmd/collector/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package main_test

import (
"os/exec"
"testing"

"github.com/Azure/adx-mon/cmd/collector/config"
"github.com/pelletier/go-toml/v2"
"github.com/stretchr/testify/require"
)

func TestMainFunction_Config(t *testing.T) {
cmd := exec.Command("go", "run", ".", "config")
output, err := cmd.CombinedOutput()
if err != nil {
t.Fatalf("Failed to run main function: %v\nOutput: %s", err, string(output))
}

var fileConfig config.Config
require.NoError(t, toml.Unmarshal(output, &fileConfig))
}

0 comments on commit f727c8a

Please sign in to comment.