Refactoring of k8s helpers
This commit is contained in:
parent
090d1872e9
commit
2b62384223
7 changed files with 68 additions and 79 deletions
25
middleware/kubernetes/kubernetes_test.go
Normal file
25
middleware/kubernetes/kubernetes_test.go
Normal file
|
@ -0,0 +1,25 @@
|
|||
package kubernetes
|
||||
|
||||
import "testing"
|
||||
|
||||
// Test data for TestSymbolContainsWildcard cases.
|
||||
var testdataSymbolContainsWildcard = []struct {
|
||||
Symbol string
|
||||
ExpectedResult bool
|
||||
}{
|
||||
{"mynamespace", false},
|
||||
{"*", true},
|
||||
{"any", true},
|
||||
{"my*space", true},
|
||||
{"*space", true},
|
||||
{"myname*", true},
|
||||
}
|
||||
|
||||
func TestSymbolContainsWildcard(t *testing.T) {
|
||||
for _, example := range testdataSymbolContainsWildcard {
|
||||
actualResult := symbolContainsWildcard(example.Symbol)
|
||||
if actualResult != example.ExpectedResult {
|
||||
t.Errorf("Expected SymbolContainsWildcard result '%v' for example string='%v'. Instead got result '%v'.", example.ExpectedResult, example.Symbol, actualResult)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue