Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
Merge pull request #6 from cloudfoundry-incubator/f0rmiga/add-service…
Browse files Browse the repository at this point in the history
…-status

Added Service command helper
  • Loading branch information
viovanov authored Oct 23, 2019
2 parents 4a28134 + 3aefdfc commit 47d6d1c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions testing/command_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,19 @@ func (k *Kubectl) ServiceExists(namespace string, serviceName string) (bool, err
return false, nil
}

// Service returns the service if serviceName exists.
func (k *Kubectl) Service(namespace string, serviceName string) (v1.Service, error) {
out, err := runBinary(kubeCtlCmd, "--namespace", namespace, "get", "service", serviceName, "-o", "json")
if err != nil {
return v1.Service{}, errors.Wrapf(err, "failed to get service %s", serviceName)
}
var service v1.Service
if err := json.Unmarshal(out, &service); err != nil {
return v1.Service{}, errors.Wrapf(err, "failed to get service %s", serviceName)
}
return service, nil
}

// WaitForSecret blocks until the secret is available. It fails after the timeout.
func (k *Kubectl) WaitForSecret(namespace string, secretName string) error {
return wait.PollImmediate(k.pollInterval, k.PollTimeout, func() (bool, error) {
Expand Down

0 comments on commit 47d6d1c

Please sign in to comment.