forked from openshift/rosa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OCM-4624 | feat: add cache for checking version mirror
- Loading branch information
1 parent
dd63b70
commit 934406d
Showing
46 changed files
with
2,104 additions
and
1,702 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package rosa | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
func TestRosaVerify(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "ROSA Verify Suite") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package rosa | ||
|
||
import ( | ||
"fmt" | ||
|
||
"go.uber.org/mock/gomock" | ||
|
||
goVer "github.com/hashicorp/go-version" | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
|
||
"github.com/openshift/rosa/pkg/version" | ||
) | ||
|
||
var _ = Describe("VerifyRosaOptions", func() { | ||
var ctrl *gomock.Controller | ||
|
||
BeforeEach(func() { | ||
ctrl = gomock.NewController(GinkgoT()) | ||
}) | ||
|
||
AfterEach(func() { | ||
ctrl.Finish() | ||
}) | ||
|
||
Context("NewVerifyRosaOptions", func() { | ||
It("should create VerifyRosaOptions successfully", func() { | ||
versionMock := version.NewMockRosaVersion(ctrl) | ||
versionMock.EXPECT().IsLatest(gomock.Any()).Return( | ||
nil, false, fmt.Errorf("failed to check latest version")) | ||
|
||
opts := &VerifyRosaOptions{ | ||
rosaVersion: versionMock, | ||
} | ||
|
||
err := opts.Verify() | ||
Expect(err).ToNot(BeNil()) | ||
Expect(err.Error()).To(Equal( | ||
"there was a problem verifying if version is latest: failed to check latest version")) | ||
|
||
}) | ||
|
||
It("should return no error if version is up to date", func() { | ||
versionMock := version.NewMockRosaVersion(ctrl) | ||
versionMock.EXPECT().IsLatest(gomock.Any()).Return(&goVer.Version{}, true, nil).AnyTimes() | ||
|
||
opts := &VerifyRosaOptions{ | ||
rosaVersion: versionMock, | ||
} | ||
|
||
err := opts.Verify() | ||
Expect(err).To(BeNil()) | ||
}) | ||
}) | ||
}) | ||
|
||
var _ = Describe("NewVerifyRosaCommand", func() { | ||
When("NewVerifyRosa succeeds", func() { | ||
It("should return a valid command", func() { | ||
cmd := NewVerifyRosaCommand() | ||
Expect(cmd).ToNot(BeNil()) | ||
Expect(cmd.Use).To(Equal("rosa-client")) | ||
Expect(cmd.Aliases).To(Equal([]string{"rosa"})) | ||
Expect(cmd.Short).To(Equal("Verify ROSA client tools")) | ||
Expect(cmd.Long).To(Equal("Verify that the ROSA client tools is installed and compatible.")) | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.