Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go.mod: bump github.com/conduitio/conduit-connector-sdk from 0.9.1 to 0.11.0 #63

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
run:
timeout: 5m

linters-settings:
gofmt:
simplify: false
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ test:
lint:
golangci-lint run

.PHONY: generate
generate:
go generate ./...

.PHONY: install-tools
install-tools:
@echo Installing tools from tools.go
Expand Down
12 changes: 6 additions & 6 deletions acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import (
"github.com/conduitio-labs/conduit-connector-zendesk/source"
"github.com/conduitio-labs/conduit-connector-zendesk/source/position"
"github.com/conduitio-labs/conduit-connector-zendesk/zendesk"
"github.com/conduitio/conduit-commons/opencdc"
sdk "github.com/conduitio/conduit-connector-sdk"

"github.com/stretchr/testify/assert"
"go.uber.org/goleak"
)
Expand Down Expand Up @@ -144,13 +144,13 @@ type AcceptanceTestDriver struct {
sdk.ConfigurableAcceptanceTestDriver
}

func (d AcceptanceTestDriver) GenerateRecord(_ *testing.T, _ sdk.Operation) sdk.Record {
func (d AcceptanceTestDriver) GenerateRecord(_ *testing.T, _ opencdc.Operation) opencdc.Record {
payload := fmt.Sprintf(`{"description":"%s","subject":"%s","raw_subject":"%s"}`, d.randString(32), d.randString(32), d.randString(32))
return sdk.Record{
Position: sdk.Position(fmt.Sprintf(`{last_modified_time:%v,id:"%v",}`, time.Now().Add(1*time.Second), 0)),
return opencdc.Record{
Position: opencdc.Position(fmt.Sprintf(`{last_modified_time:%v,id:"%v",}`, time.Now().Add(1*time.Second), 0)),
Metadata: nil,
Key: sdk.RawData(fmt.Sprintf("%v", 0)),
Payload: sdk.Change{After: sdk.RawData(payload)},
Key: opencdc.RawData(fmt.Sprintf("%v", 0)),
Payload: opencdc.Change{After: opencdc.RawData(payload)},
}
}

Expand Down
1 change: 0 additions & 1 deletion cmd/connector/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package main

import (
zendesk "github.com/conduitio-labs/conduit-connector-zendesk"

sdk "github.com/conduitio/conduit-connector-sdk"
)

Expand Down
1 change: 0 additions & 1 deletion connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package zendesk
import (
"github.com/conduitio-labs/conduit-connector-zendesk/destination"
"github.com/conduitio-labs/conduit-connector-zendesk/source"

sdk "github.com/conduitio/conduit-connector-sdk"
)

Expand Down
23 changes: 12 additions & 11 deletions destination/destination.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,25 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:generate mockery --name=Writer

package destination

import (
"context"

"github.com/conduitio-labs/conduit-connector-zendesk/config"
"github.com/conduitio-labs/conduit-connector-zendesk/zendesk"
cconfig "github.com/conduitio/conduit-commons/config"
"github.com/conduitio/conduit-commons/opencdc"
sdk "github.com/conduitio/conduit-connector-sdk"
)

type Writer interface {
Write(ctx context.Context, records []sdk.Record) error
Write(ctx context.Context, records []opencdc.Record) error
Close()
}

//go:generate mockery --name=Writer

type Destination struct {
sdk.UnimplementedDestination
cfg Config // destination specific config for zendesk
Expand All @@ -41,33 +43,32 @@ func NewDestination() sdk.Destination {
}

// Parameters returns a map of named Parameters that describe how to configure the Source.
func (d *Destination) Parameters() map[string]sdk.Parameter {
return map[string]sdk.Parameter{
func (d *Destination) Parameters() cconfig.Parameters {
return map[string]cconfig.Parameter{
config.KeyDomain: {
Default: "",
Required: true,
Description: "A domain is referred as the organization name to which zendesk is registered",
Validations: []cconfig.Validation{cconfig.ValidationRequired{}},
},
config.KeyUserName: {
Default: "",
Required: true,
Description: "Login to zendesk performed using username",
Validations: []cconfig.Validation{cconfig.ValidationRequired{}},
},
config.KeyAPIToken: {
Default: "",
Required: true,
Description: "password to login",
Validations: []cconfig.Validation{cconfig.ValidationRequired{}},
},
KeyMaxRetries: {
Default: "3",
Required: false,
Description: "max API retries, before returning an error",
},
}
}

// Configure parses and initializes the config.
func (d *Destination) Configure(_ context.Context, cfg map[string]string) error {
func (d *Destination) Configure(_ context.Context, cfg cconfig.Config) error {
configuration, err := Parse(cfg)
if err != nil {
return err
Expand All @@ -86,7 +87,7 @@ func (d *Destination) Open(_ context.Context) error {
}

// Write writes records into a Destination.
func (d *Destination) Write(ctx context.Context, records []sdk.Record) (int, error) {
func (d *Destination) Write(ctx context.Context, records []opencdc.Record) (int, error) {
err := d.writer.Write(ctx, records)
if err != nil {
return 0, err
Expand Down
20 changes: 10 additions & 10 deletions destination/destination_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

"github.com/conduitio-labs/conduit-connector-zendesk/config"
"github.com/conduitio-labs/conduit-connector-zendesk/destination/mocks"
sdk "github.com/conduitio/conduit-connector-sdk"
"github.com/conduitio/conduit-commons/opencdc"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
Expand Down Expand Up @@ -88,7 +88,7 @@ func TestOpen(t *testing.T) {
func TestWrite(t *testing.T) {
tests := []struct {
name string
record sdk.Record
record opencdc.Record
err error
dest Destination
}{
Expand All @@ -102,16 +102,16 @@ func TestWrite(t *testing.T) {
return w
}(),
},
record: sdk.Record{
Key: sdk.RawData(`dummy_key`),
Payload: sdk.Change{After: sdk.RawData(``)},
record: opencdc.Record{
Key: opencdc.RawData(`dummy_key`),
Payload: opencdc.Change{After: opencdc.RawData(``)},
},
err: nil,
},
{
name: "valid case",
record: sdk.Record{
Payload: sdk.Change{After: sdk.RawData(`"dummy_data":"12345"`)},
record: opencdc.Record{
Payload: opencdc.Change{After: opencdc.RawData(`"dummy_data":"12345"`)},
},
dest: Destination{
writer: func() Writer {
Expand All @@ -124,8 +124,8 @@ func TestWrite(t *testing.T) {
},
{
name: "write invalid case with flush error",
record: sdk.Record{
Payload: sdk.Change{After: sdk.RawData(`"dummy_data":"12345"`)},
record: opencdc.Record{
Payload: opencdc.Change{After: opencdc.RawData(`"dummy_data":"12345"`)},
},
dest: Destination{
writer: func() Writer {
Expand All @@ -141,7 +141,7 @@ func TestWrite(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
n, err := tt.dest.Write(context.Background(), []sdk.Record{tt.record})
n, err := tt.dest.Write(context.Background(), []opencdc.Record{tt.record})
if tt.err != nil {
assert.NotNil(t, err)
assert.Equal(t, err, tt.err)
Expand Down
7 changes: 3 additions & 4 deletions destination/mocks/Writer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading