Skip to content

Commit

Permalink
remove assertions
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Alvarez <alvajus@amazon.com>
  • Loading branch information
pendo324 committed Jan 31, 2025
1 parent e98e19e commit 1986b38
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions e2e/e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import (
"regexp"
"runtime"

"github.com/onsi/gomega"
"github.com/runfinch/common-tests/option"
)

Expand Down Expand Up @@ -79,13 +78,17 @@ func CreateOption() (*option.Option, error) {
return o, nil
}

func getNerdctlVersion(subject string) string {
func getNerdctlVersion(subject string) (string, error) {
output, err := exec.Command(subject, "version").CombinedOutput()
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
if err != nil {
return "", fmt.Errorf("failed to run version command: %w", err)
}
re := regexp.MustCompile(`nerdctl:\n\s*Version:\s*v(.*)$`)
matches := re.FindStringSubmatch(string(output))

gomega.Expect(matches).ShouldNot(gomega.BeNil())
gomega.Expect(matches).Should(gomega.HaveLen(2))
return matches[1]
if matches == nil || len(matches) != 2 {
return "", fmt.Errorf("regexp did not match properly, output: %s", output)
}

return matches[1], nil
}

0 comments on commit 1986b38

Please sign in to comment.