-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
91036a5
commit b18bb2f
Showing
2 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package internal | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestFilterNames_CanFilterInternalVitessTables(t *testing.T) { | ||
var tests = []struct { | ||
name string | ||
tableName string | ||
filtered bool | ||
}{ | ||
{ | ||
name: "filters_vrepl_tables", | ||
tableName: "_750a3e1f_e6f3_5249_82af_82f5d325ecab_20240528153135_vrepl", | ||
filtered: true, | ||
}, | ||
{ | ||
name: "filters_vt_DROP_tables", | ||
tableName: "_vt_DROP_6ace8bcef73211ea87e9f875a4d24e90_20200915120410", | ||
filtered: true, | ||
}, | ||
{ | ||
name: "filters_vt_HOLD_tables", | ||
tableName: "_vt_HOLD_6ace8bcef73211ea87e9f875a4d24e90_20200915120410", | ||
filtered: true, | ||
}, | ||
{ | ||
name: "filters_vt_EVAC_tables", | ||
tableName: "_vt_EVAC_6ace8bcef73211ea87e9f875a4d24e90_20200915120410", | ||
filtered: true, | ||
}, | ||
{ | ||
name: "filters_vt_PURGE_tables", | ||
tableName: "_vt_PURGE_6ace8bcef73211ea87e9f875a4d24e90_20200915120410", | ||
filtered: true, | ||
}, | ||
{ | ||
name: "does_not_filter_regular_table", | ||
tableName: "customers", | ||
filtered: false, | ||
}, | ||
} | ||
|
||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
filteredResult := filterTable(tt.tableName) | ||
assert.Equal(t, tt.filtered, filteredResult) | ||
}) | ||
} | ||
} |