diff --git a/cmd/collector/main_test.go b/cmd/collector/main_test.go new file mode 100644 index 00000000..1de1d9e2 --- /dev/null +++ b/cmd/collector/main_test.go @@ -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)) +}