Add fake client for local command operation (#1515)
This PR adds a fake controller client for local CLI operations like offline spec generation or for unit test purposes. The fake client now only implements the "Version()" function and more functions will be implemented once we figure out how to achieve the goals mentioned above.
This commit is contained in:
@@ -44,13 +44,19 @@ func App() *cobra.Command {
|
||||
PersistentPreRunE: wrapper.Wrapper(
|
||||
func(input cli.Input) error {
|
||||
console.Verbosity = input.Int(flagkey.Verbosity)
|
||||
serverUrl, err := util.GetServerURL(input)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
if input.IsSet(flagkey.ClientOnly) {
|
||||
// TODO: use fake rest client for offline spec generation
|
||||
cmd.SetClientset(client.MakeFakeClientset(nil))
|
||||
} else {
|
||||
serverUrl, err := util.GetServerURL(input)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
restClient := rest.NewRESTClient(serverUrl)
|
||||
cmd.SetClientset(client.MakeClientset(restClient))
|
||||
}
|
||||
restClient := rest.NewRESTClient(serverUrl)
|
||||
// TODO: use fake rest client for offline spec generation
|
||||
cmd.SetClientset(client.MakeClientset(restClient))
|
||||
|
||||
return nil
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user