INNER CODE UNIT · Go
TestMainTestSuite
alexei-led/pumba · cmd/main_test.go:44
func TestMainTestSuite(t *testing.T) {
suite.Run(t, new(mainTestSuite))
}
// newRuntimeTestContext builds a cli.Context populated with the global flag
// defaults and overrides from values. Lets createRuntimeClient read flags
// without running the whole urfave/cli app lifecycle.
func newRuntimeTestContext(t *testing.T, values map[string]string) *cli.Context {
t.Helper()
app := cli.NewApp()
fs := flag.NewFlagSet("test", flag.ContinueOnError)
for _, f := range globalFlags("/tmp/certs") {
f.Apply(fs)
}
for k, v := range values {
require.NoError(t, fs.Set(k, v))
}
return cli.NewContext(app, fs, nil)