Skip to content

Commit

Permalink
modify e2e tests uninstall global settings initialisation to accept e…
Browse files Browse the repository at this point in the history
…mpty list (#1014)
  • Loading branch information
mihaialexandrescu authored Jul 17, 2023
1 parent 82d2ec2 commit 34071dc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
6 changes: 6 additions & 0 deletions tests/e2e/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,12 @@ func listK8sResourceKinds(kubectlOptions k8s.KubectlOptions, apiGroupSelector st
return nil, err
}

output = strings.Trim(output, "'")
// Empty output
if output == "" {
return nil, nil
}

return kubectlRemoveWarnings(strings.Split(output, "\n")), nil
}

Expand Down
21 changes: 6 additions & 15 deletions tests/e2e/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,16 @@ func (c *dependencyCRDsType) CertManager() []string {
func (c *dependencyCRDsType) Initialize(kubectlOptions k8s.KubectlOptions) error {
var err error
c.certManager, err = listK8sResourceKinds(kubectlOptions, apiGroupKoperatorDependencies()["cert-manager"])
if len(c.certManager) == 0 {
if err != nil {
return fmt.Errorf("initialize Cert-manager CRDs error: %w", err)
}
return fmt.Errorf("Cert-manager CRDs %w", ErrorNotFound)
if err != nil {
return fmt.Errorf("initialize Cert-manager CRDs error: %w", err)
}
c.prometheus, err = listK8sResourceKinds(kubectlOptions, apiGroupKoperatorDependencies()["prometheus"])
if len(c.prometheus) == 0 {
if err != nil {
return fmt.Errorf("initialize Prometheus CRDs error: %w", err)
}
return fmt.Errorf("Prometheus CRDs %w", ErrorNotFound)
if err != nil {
return fmt.Errorf("initialize Prometheus CRDs error: %w", err)
}
c.zookeeper, err = listK8sResourceKinds(kubectlOptions, apiGroupKoperatorDependencies()["zookeeper"])
if len(c.zookeeper) == 0 {
if err != nil {
return fmt.Errorf("initialize Zookeeper CRDs error: %w", err)
}
return fmt.Errorf("Zookeeper CRDs %w", ErrorNotFound)
if err != nil {
return fmt.Errorf("initialize Zookeeper CRDs error: %w", err)
}
return nil
}

0 comments on commit 34071dc

Please sign in to comment.