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
+4 -22
View File
@@ -448,6 +448,10 @@ func ApplyLabelsAndAnnotations(input cli.Input, objectMeta *metav1.ObjectMeta) e
}
func GetStorageURL(ctx context.Context, client cmd.Client) (*url.URL, error) {
storagesvcURL := os.Getenv("FISSION_STORAGESVC_URL")
if len(storagesvcURL) > 0 {
return url.Parse(storagesvcURL)
}
storageLocalPort, err := SetupPortForward(ctx, client, GetFissionNamespace(), "application=fission-storage")
if err != nil {
return nil, err
@@ -507,28 +511,6 @@ func ConfigMapExists(ctx context.Context, m *metav1.ObjectMeta, kClient kubernet
return err
}
func GetSvcName(ctx context.Context, kClient kubernetes.Interface, application string) (string, error) {
var podNamespace = os.Getenv("POD_NAMESPACE")
if podNamespace == "" {
podNamespace = "fission"
}
appLabelSelector := "application=" + application
services, err := kClient.CoreV1().Services(podNamespace).List(ctx, metav1.ListOptions{
LabelSelector: appLabelSelector,
})
if err != nil {
return "", err
}
if len(services.Items) > 1 || len(services.Items) == 0 {
return "", errors.Errorf("more than one service found for application=%s", application)
}
service := services.Items[0]
return service.Name + "." + podNamespace, nil
}
// FunctionPodLogs : Get logs for a function directly from pod
func FunctionPodLogs(ctx context.Context, fnName, ns string, client cmd.Client) (err error) {