2018-03-20 03:29:14 +00:00
|
|
|
package connect
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/mitchellh/go-testing-interface"
|
|
|
|
)
|
|
|
|
|
|
|
|
// TestSpiffeIDService returns a SPIFFE ID representing a service.
|
|
|
|
func TestSpiffeIDService(t testing.T, service string) *SpiffeIDService {
|
2018-05-10 16:04:33 +00:00
|
|
|
return TestSpiffeIDServiceWithHost(t, service, TestClusterID+".consul")
|
2018-05-09 19:30:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// TestSpiffeIDServiceWithHost returns a SPIFFE ID representing a service with
|
|
|
|
// the specified trust domain.
|
|
|
|
func TestSpiffeIDServiceWithHost(t testing.T, service, host string) *SpiffeIDService {
|
2020-10-21 19:49:21 +00:00
|
|
|
return TestSpiffeIDServiceWithHostDC(t, service, host, "dc1")
|
|
|
|
}
|
|
|
|
|
|
|
|
// TestSpiffeIDServiceWithHostDC returns a SPIFFE ID representing a service with
|
|
|
|
// the specified trust domain for the given datacenter.
|
|
|
|
func TestSpiffeIDServiceWithHostDC(t testing.T, service, host, datacenter string) *SpiffeIDService {
|
2018-03-20 03:29:14 +00:00
|
|
|
return &SpiffeIDService{
|
2018-05-09 19:30:43 +00:00
|
|
|
Host: host,
|
2018-03-20 03:29:14 +00:00
|
|
|
Namespace: "default",
|
2020-10-21 19:49:21 +00:00
|
|
|
Datacenter: datacenter,
|
2018-03-20 03:29:14 +00:00
|
|
|
Service: service,
|
|
|
|
}
|
|
|
|
}
|