aae6d8080d
This adds an aws-iam auth method type which supports authenticating to Consul using AWS IAM identities. Co-authored-by: R.B. Boyer <4903+rboyer@users.noreply.github.com>
38 lines
784 B
Go
38 lines
784 B
Go
package lib
|
|
|
|
import "testing"
|
|
|
|
func TestGlobbedStringsMatch(t *testing.T) {
|
|
tests := []struct {
|
|
item string
|
|
val string
|
|
expect bool
|
|
}{
|
|
{"", "", true},
|
|
{"*", "*", true},
|
|
{"**", "**", true},
|
|
{"*t", "t", true},
|
|
{"*t", "test", true},
|
|
{"t*", "test", true},
|
|
{"*test", "test", true},
|
|
{"*test", "a test", true},
|
|
{"test", "a test", false},
|
|
{"*test", "tests", false},
|
|
{"test*", "test", true},
|
|
{"test*", "testsss", true},
|
|
{"test**", "testsss", false},
|
|
{"test**", "test*", true},
|
|
{"**test", "*test", true},
|
|
{"TEST", "test", false},
|
|
{"test", "test", true},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
actual := GlobbedStringsMatch(tt.item, tt.val)
|
|
|
|
if actual != tt.expect {
|
|
t.Fatalf("Bad testcase %#v, expected %t, got %t", tt, tt.expect, actual)
|
|
}
|
|
}
|
|
}
|