Skip to content

Commit 4771efa

Browse files
authored
fix: Fix Destination testing suite (#417)
Seems we weren't running some tests. I had to invert the variables which actually also make sense so they will be enabled by default. Let's say we add a new test this will detect if a plugin is not supporting a new mode.
1 parent c1b4240 commit 4771efa

2 files changed

Lines changed: 7 additions & 11 deletions

File tree

plugins/destination_test.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@ import (
1313
func TestDestinationPlugin(t *testing.T) {
1414
p := NewDestinationPlugin("test", "development", NewTestDestinationMemDBClient)
1515
DestinationPluginTestSuiteRunner(t, p, nil,
16-
DestinationTestSuiteTests{
17-
Overwrite: true,
18-
DeleteStale: true,
19-
Append: true,
20-
})
16+
DestinationTestSuiteTests{})
2117
}
2218

2319
func TestDestinationOnNewError(t *testing.T) {

plugins/destination_testing.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ type destinationTestSuite struct {
1919
}
2020

2121
type DestinationTestSuiteTests struct {
22-
Overwrite bool
23-
DeleteStale bool
24-
Append bool
22+
SkipOverwrite bool
23+
SkipDeleteStale bool
24+
SkipAppend bool
2525
}
2626

2727
func getTestLogger(t *testing.T) zerolog.Logger {
@@ -106,7 +106,7 @@ func (s *destinationTestSuite) destinationPluginTestWriteOverwrite(ctx context.C
106106
return fmt.Errorf("expected data to be %v, got %v", resource.Data, resourcesRead[1])
107107
}
108108

109-
if s.tests.DeleteStale {
109+
if !s.tests.SkipDeleteStale {
110110
if err := p.DeleteStale(ctx, tables, sourceName, secondSyncTime); err != nil {
111111
return fmt.Errorf("failed to delete stale data second time: %w", err)
112112
}
@@ -199,7 +199,7 @@ func DestinationPluginTestSuiteRunner(t *testing.T, p *DestinationPlugin, spec i
199199

200200
t.Run("TestWriteOverwrite", func(t *testing.T) {
201201
t.Helper()
202-
if suite.tests.Overwrite {
202+
if suite.tests.SkipOverwrite {
203203
t.Skip("skipping TestWriteOverwrite")
204204
return
205205
}
@@ -210,7 +210,7 @@ func DestinationPluginTestSuiteRunner(t *testing.T, p *DestinationPlugin, spec i
210210

211211
t.Run("TestWriteAppend", func(t *testing.T) {
212212
t.Helper()
213-
if suite.tests.Append {
213+
if suite.tests.SkipAppend {
214214
t.Skip("skipping TestWriteAppend")
215215
return
216216
}

0 commit comments

Comments
 (0)