Skip to content

Commit

Permalink
Adding a small test for default-config
Browse files Browse the repository at this point in the history
  • Loading branch information
safaci2000 committed Nov 8, 2024
1 parent 5524b7d commit d2202e3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cli/test/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ import (
"github.com/stretchr/testify/assert"
)

func TestDefaultConfigCommand(t *testing.T) {
assert.NoError(t, path.FixTestDir("test", "../.."))
execMe := func(mock *mocks.GrafanaService, optionMockSvc func() support.RootOption) error {
err := cli.Execute([]string{"default-config"}, optionMockSvc())
return err
}
outStr, closeReader := test_tooling.SetupAndExecuteMockingServices(t, execMe)
defer closeReader()

assert.True(t, strings.Contains(outStr, "storage_engine"))
assert.True(t, strings.Contains(outStr, "global"))
assert.True(t, strings.Contains(outStr, "context_name:"))
assert.True(t, strings.Contains(outStr, "contexts:"))
}

func TestVersionCommand(t *testing.T) {
assert.NoError(t, path.FixTestDir("test", "../.."))
execMe := func(mock *mocks.GrafanaService, optionMockSvc func() support.RootOption) error {
Expand Down

0 comments on commit d2202e3

Please sign in to comment.