-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ef0bb8
commit 4b960fa
Showing
2 changed files
with
93 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
//nolint:paralleltest // disabled | ||
func TestValidateConfigNoConfigProvided(t *testing.T) { | ||
defer func() { | ||
if r := recover(); r == nil { | ||
require.Fail(t, "Expected to have a panic here!") | ||
} | ||
}() | ||
|
||
os.Args = []string{"cmd", "validate-config"} | ||
main() | ||
assert.True(t, true) | ||
} | ||
|
||
//nolint:paralleltest // disabled | ||
func TestValidateConfigFailedToLoad(t *testing.T) { | ||
defer func() { | ||
if r := recover(); r == nil { | ||
require.Fail(t, "Expected to have a panic here!") | ||
} | ||
}() | ||
|
||
os.Args = []string{"cmd", "validate-config", "--config", "../assets/config-not-found.toml"} | ||
main() | ||
assert.True(t, true) | ||
} | ||
|
||
//nolint:paralleltest // disabled | ||
func TestValidateConfigInvalid(t *testing.T) { | ||
defer func() { | ||
if r := recover(); r == nil { | ||
require.Fail(t, "Expected to have a panic here!") | ||
} | ||
}() | ||
|
||
os.Args = []string{"cmd", "validate-config", "--config", "../assets/config-invalid.toml"} | ||
main() | ||
assert.True(t, true) | ||
} | ||
|
||
//nolint:paralleltest // disabled | ||
func TestValidateConfigWithWarnings(t *testing.T) { | ||
os.Args = []string{"cmd", "validate-config", "--config", "../assets/config-with-warnings.toml"} | ||
main() | ||
assert.True(t, true) | ||
} | ||
|
||
//nolint:paralleltest // disabled | ||
func TestValidateConfigValid(t *testing.T) { | ||
os.Args = []string{"cmd", "validate-config", "--config", "../assets/config-valid.toml"} | ||
main() | ||
assert.True(t, true) | ||
} | ||
|
||
//nolint:paralleltest // disabled | ||
func TestStartNoConfigProvided(t *testing.T) { | ||
defer func() { | ||
if r := recover(); r == nil { | ||
require.Fail(t, "Expected to have a panic here!") | ||
} | ||
}() | ||
|
||
os.Args = []string{"cmd"} | ||
main() | ||
assert.True(t, true) | ||
} | ||
|
||
//nolint:paralleltest // disabled | ||
func TestStartConfigProvided(t *testing.T) { | ||
defer func() { | ||
if r := recover(); r == nil { | ||
require.Fail(t, "Expected to have a panic here!") | ||
} | ||
}() | ||
|
||
os.Args = []string{"cmd", "--config", "../assets/config-invalid.toml"} | ||
main() | ||
assert.True(t, true) | ||
} |