pomerium/internal/telemetry/util_test.go
Caleb Doxsey d5178f24a3
config: support multiple running services in addition to all-in-one mode (#5656)
## Summary
Currently you can either run a single service or all-in-one mode. This
PR adds support for running any 2 or 3 services together. For example
`services: authorize,proxy`.

I think I updated the conditions to make sense, but there's some risk
here as there may have been some assumptions in places I'm overlooking.

## Related issues
-
[ENG-2485](https://linear.app/pomerium/issue/ENG-2485/core-support-running-multiple-but-not-all-services)


## Checklist

- [x] reference any related issues
- [x] updated unit tests
- [x] add appropriate label (`enhancement`, `bug`, `breaking`,
`dependencies`, `ci`)
- [x] ready for review
2025-07-21 14:28:31 -06:00

27 lines
506 B
Go

package telemetry
import (
"testing"
"github.com/stretchr/testify/assert"
)
func Test_ServiceName(t *testing.T) {
t.Parallel()
tests := []struct {
name string
servicesOpt string
want string
}{
{"all", "all", "pomerium"},
{"proxy", "proxy", "pomerium-proxy"},
{"missing", "", "pomerium"},
{"multiple", "authorize,proxy", "pomerium"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
assert.Equal(t, tt.want, ServiceName(tt.servicesOpt))
})
}
}