Add tests for preupgradchecks and spec/archive CLI (#2874)

* Add tests for preupgradchecks
* Add spec tests
* Add package archive tests
* Wait for cleanup
* Fix test and coverage

---------

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
Sanket Sudake
2023-11-17 14:08:38 +05:30
committed by GitHub
parent e7d6381876
commit d23ed572f9
18 changed files with 186 additions and 77 deletions
+7
View File
@@ -18,6 +18,7 @@ package cli
import (
"context"
"io"
"time"
)
@@ -76,5 +77,11 @@ type (
// Duration returns time duration of given flag.
Duration(key string) time.Duration
// Stdout returns io.Writer for stdout.
Stdout() io.Writer
// Stderr returns io.Writer for stderr.
Stderr() io.Writer
}
)
@@ -19,6 +19,7 @@ package cobra
import (
"context"
"fmt"
"io"
"strings"
"time"
@@ -311,3 +312,11 @@ func (u Cli) Duration(key string) time.Duration {
v, _ := u.c.Flags().GetDuration(key)
return v
}
func (u Cli) Stdout() io.Writer {
return u.c.OutOrStdout()
}
func (u Cli) Stderr() io.Writer {
return u.c.OutOrStderr()
}
@@ -18,6 +18,8 @@ package dummy
import (
"context"
"io"
"os"
"time"
fCli "github.com/fission/fission/pkg/fission-cli/cliwrapper/cli"
@@ -169,3 +171,11 @@ func (u Cli) Duration(key string) time.Duration {
}
return val.(time.Duration)
}
func (u Cli) Stdout() io.Writer {
return os.Stdout
}
func (u Cli) Stderr() io.Writer {
return os.Stderr
}