Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brianstrauch committed Sep 10, 2021
1 parent 348f099 commit a97f371
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 20 deletions.
5 changes: 3 additions & 2 deletions internal/cmd/schema-registry/command_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ var (
func NewExporterCommand(prerunner pcmd.PreRunner, srClient *srsdk.APIClient) *cobra.Command {
cliCmd := pcmd.NewAuthenticatedStateFlagCommand(
&cobra.Command{
Use: "exporter",
Short: "Manage Schema Registry exporters.",
Use: "exporter",
Short: "Manage Schema Registry exporters.",
Annotations: map[string]string{pcmd.RunRequirement: pcmd.RequireCloudLogin},
}, prerunner, ExporterSubcommandFlags)
exporterCmd := &exporterCommand{
AuthenticatedStateFlagCommand: cliCmd,
Expand Down
32 changes: 17 additions & 15 deletions internal/cmd/schema-registry/command_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@ package schemaregistry
import (
"bytes"
"context"
"io/ioutil"
"net/http"
"os"
"path/filepath"
"testing"

schedv1 "github.com/confluentinc/cc-structs/kafka/scheduler/v1"
"github.com/confluentinc/ccloud-sdk-go-v1"
"github.com/confluentinc/ccloud-sdk-go-v1/mock"
v0 "github.com/confluentinc/cli/internal/pkg/config/v0"
v3 "github.com/confluentinc/cli/internal/pkg/config/v3"
cliMock "github.com/confluentinc/cli/mock"
srsdk "github.com/confluentinc/schema-registry-sdk-go"
srMock "github.com/confluentinc/schema-registry-sdk-go/mock"
"github.com/spf13/cobra"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"io/ioutil"
"net/http"
"os"
"path/filepath"
"testing"

v0 "github.com/confluentinc/cli/internal/pkg/config/v0"
v3 "github.com/confluentinc/cli/internal/pkg/config/v3"
cliMock "github.com/confluentinc/cli/mock"
)

var (
Expand Down Expand Up @@ -101,7 +103,7 @@ func (suite *ExporterTestSuite) newCMD() *cobra.Command {
client := &ccloud.Client{
SchemaRegistry: suite.srMothershipMock,
}
return New(suite.conf.CLIName, cliMock.NewPreRunnerMock(client, nil, nil, suite.conf), suite.srClientMock, suite.conf.Logger, cliMock.NewDummyAnalyticsMock())
return New(suite.conf, cliMock.NewPreRunnerMock(client, nil, nil, suite.conf), suite.srClientMock, suite.conf.Logger, cliMock.NewDummyAnalyticsMock())
}

func (suite *ExporterTestSuite) TestCreateExporter() {
Expand Down Expand Up @@ -154,9 +156,9 @@ func (suite *ExporterTestSuite) TestDescribeExporter() {
params := apiMock.GetExporterInfoCalls()[0]
req.Equal(params.Name, exporterName)

req.Equal("+--------------------------------+-------------+\n" +
"| Name | my_exporter |\n| Subjects | Subject |\n" +
"| Context Type | AUTO |\n| Context | |\n" +
req.Equal("+--------------------------------+-------------+\n"+
"| Name | my_exporter |\n| Subjects | Subject |\n"+
"| Context Type | AUTO |\n| Context | |\n"+
"| Remote Schema Registry Configs | |\n+--------------------------------+-------------+\n", output.String())
}

Expand All @@ -173,9 +175,9 @@ func (suite *ExporterTestSuite) TestStatusExporter() {
params := apiMock.GetExporterStatusCalls()[0]
req.Equal(params.Name, exporterName)

req.Equal("+--------------------+-------------+\n" +
"| Name | my_exporter |\n| Exporter State | PAUSED |\n" +
"| Exporter Offset | 0 |\n| Exporter Timestamp | 0 |\n" +
req.Equal("+--------------------+-------------+\n"+
"| Name | my_exporter |\n| Exporter State | PAUSED |\n"+
"| Exporter Offset | 0 |\n| Exporter Timestamp | 0 |\n"+
"| Error Trace | |\n+--------------------+-------------+\n", output.String())
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Error: required flag(s) "api-key", "api-secret" not set
Usage:
ccloud ksql app create <name> [flags]
confluent ksql app create <name> [flags]

Flags:
--csu int32 Number of CSUs to use in the cluster. (default 4)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Manage Schema Registry exporters.

Usage:
ccloud schema-registry exporter [command]
confluent schema-registry exporter [command]

Available Commands:
create Create new schema exporter.
Expand All @@ -19,4 +19,4 @@ Global Flags:
-h, --help Show help for this command.
-v, --verbose count Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace).

Use "ccloud schema-registry exporter [command] --help" for more information about a command.
Use "confluent schema-registry exporter [command] --help" for more information about a command.

0 comments on commit a97f371

Please sign in to comment.