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
+8 -7
View File
@@ -20,11 +20,6 @@ import (
"github.com/fission/fission/pkg/utils/loggerfactory"
)
const (
EXECUTOR_URL = "http://executor.fission"
STORAGESVC_URL = "http://storagesvc.fission"
)
type ServiceInfo struct {
Port int
}
@@ -61,10 +56,14 @@ func NewFramework() *Framework {
if err != nil {
panic(err)
}
_, filename, _, _ := runtime.Caller(0) //nolint
root := filepath.Dir(filename)
crdPath := filepath.Join(root, "..", "..", "..", "crds", "v1")
return &Framework{
logger: loggerfactory.GetLogger(),
env: &envtest.Environment{
CRDDirectoryPaths: []string{filepath.Join("../../..", "crds", "v1")},
CRDDirectoryPaths: []string{crdPath},
ErrorIfCRDPathMissing: true,
CRDInstallOptions: envtest.CRDInstallOptions{
MaxTime: 60 * time.Second,
@@ -111,9 +110,11 @@ func (f *Framework) ClientGen() *crd.ClientGenerator {
}
func (f *Framework) Stop() error {
f.logger.Info("Stopping test env")
_ = f.logger.Sync()
err := f.env.Stop()
if err != nil {
return fmt.Errorf("error stopping test env: %v", err)
return fmt.Errorf("error stopping test env: %w", err)
}
return nil
}