Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 committed Aug 14, 2024
1 parent ed081c4 commit 06e1e5c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/destination/ddl/expiry.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func ShouldDeleteFromName(name string) bool {
if !strings.Contains(name, constants.ArtiePrefix) {
if !strings.Contains(strings.ToLower(name), constants.ArtiePrefix) {
return false
}

Expand Down
5 changes: 5 additions & 0 deletions lib/destination/ddl/expiry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ddl

import (
"fmt"
"strings"
"testing"
"time"

Expand All @@ -21,6 +22,8 @@ func TestShouldDeleteFromName(t *testing.T) {
}

for _, tblToNotDelete := range tablesToNotDrop {
assert.False(t, ShouldDeleteFromName(strings.ToLower(tblToNotDelete)), tblToNotDelete)
assert.False(t, ShouldDeleteFromName(strings.ToUpper(tblToNotDelete)), tblToNotDelete)
assert.False(t, ShouldDeleteFromName(tblToNotDelete), tblToNotDelete)
}
}
Expand All @@ -32,6 +35,8 @@ func TestShouldDeleteFromName(t *testing.T) {
}

for _, tblToDelete := range tablesToDrop {
assert.True(t, ShouldDeleteFromName(strings.ToLower(tblToDelete)), tblToDelete)
assert.True(t, ShouldDeleteFromName(strings.ToUpper(tblToDelete)), tblToDelete)
assert.True(t, ShouldDeleteFromName(tblToDelete), tblToDelete)
}
}
Expand Down

0 comments on commit 06e1e5c

Please sign in to comment.