Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom McKay committed Apr 23, 2024
1 parent d229f2a commit fb47415
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/create/oidcconfig/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/spf13/cobra"
)

func TestDescribeAutoscaler(t *testing.T) {
func TestCreateOidcConfig(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "rosa create oidc-config")
}
Expand Down
55 changes: 55 additions & 0 deletions cmd/create/oidcprovider/cmd_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package oidcprovider

import (
"context"
"testing"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/openshift/rosa/pkg/output"
"github.com/openshift/rosa/pkg/test"
"github.com/spf13/cobra"
)

func TestCreateOidcProvider(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "rosa create oidc-config")
}

var _ = Describe("create oidc-provider", func() {
Context("create oidc-provider command", func() {
It("returns command", func() {
cmd := NewCreateOidcProviderCommand()
Expect(cmd).NotTo(BeNil())
})
})

Context("execute create oidc-provider", func() {

var t *test.TestingRuntime
var cmd *cobra.Command

BeforeEach(func() {
t = test.NewTestRuntime()
output.SetOutput("")
cmd = NewCreateOidcProviderCommand()
})

AfterEach(func() {
output.SetOutput("")
})

It("error on both --cluster and --oidc-config-id", func() {

cmd.Flag("cluster").Value.Set("1")
cmd.Flag("oidc-config-id").Value.Set("1")

runner := CreateOidcProviderRunner()
err := runner(context.Background(), t.RosaRuntime, cmd,
[]string{"--cluster", "1", "--oidc-config-id", "1"})

Expect(err).NotTo(BeNil())
Expect(err.Error()).To(ContainSubstring("????"))
})
})
})

0 comments on commit fb47415

Please sign in to comment.