Service environment (#23443)
* fix fileutils.TestFindFile on MacOS * introduce model.ExternalServiceEnvironment * pick license public key from external service env * pick Stripe public key from external service env * pick Rudder key from external service env * configure Sentry DSN from external service env * always log external_service_environment, Unsetenv * clear faked BuildEnv, improve logging * strip out unset GOTAGS * fix Sentry tests * simplify to just ServiceEnvironment * relocate ServiceEnvironment in client config * initialize CWS URLs based on service environment * unset rudder key for boards dev * harden service environment to avoid accidental production * fix TestSentry again * fix DEFAULT -> ENTERPRISE * s/dev/test when naming playbooks rudder key * simplify boards rudder key switch * use uniform rudderKey variable names * retain compatibility with existing pipeline * reduce to just production/test * unit test with valid test license * simplify Playbooks telemetry initialization * restore dev service environment * emit ServiceEnvironment when running e2e tests
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
6c82605df0
Коммит
305fac6507
@@ -395,6 +395,22 @@ func TestSentry(t *testing.T) {
|
||||
}}
|
||||
testDir, _ := fileutils.FindDir("tests")
|
||||
|
||||
setSentryDSN := func(t *testing.T, dsn *sentry.Dsn) {
|
||||
os.Setenv("MM_SERVICEENVIRONMENT", model.ServiceEnvironmentTest)
|
||||
|
||||
// Allow Playbooks to startup
|
||||
oldBuildHash := model.BuildHash
|
||||
model.BuildHash = "dev"
|
||||
|
||||
oldSentryDSN := SentryDSN
|
||||
SentryDSN = dsn.String()
|
||||
t.Cleanup(func() {
|
||||
os.Unsetenv("MM_SERVICEENVIRONMENT")
|
||||
model.BuildHash = oldBuildHash
|
||||
SentryDSN = oldSentryDSN
|
||||
})
|
||||
}
|
||||
|
||||
t.Run("sentry is disabled, should not receive a report", func(t *testing.T) {
|
||||
data := make(chan bool, 1)
|
||||
|
||||
@@ -408,7 +424,7 @@ func TestSentry(t *testing.T) {
|
||||
_, port, _ := net.SplitHostPort(server.Listener.Addr().String())
|
||||
dsn, err := sentry.NewDsn(fmt.Sprintf("http://test:test@localhost:%s/123", port))
|
||||
require.NoError(t, err)
|
||||
SentryDSN = dsn.String()
|
||||
setSentryDSN(t, dsn)
|
||||
|
||||
s, err := newServerWithConfig(t, func(cfg *model.Config) {
|
||||
*cfg.ServiceSettings.ListenAddress = "localhost:0"
|
||||
@@ -452,7 +468,7 @@ func TestSentry(t *testing.T) {
|
||||
_, port, _ := net.SplitHostPort(server.Listener.Addr().String())
|
||||
dsn, err := sentry.NewDsn(fmt.Sprintf("http://test:test@localhost:%s/123", port))
|
||||
require.NoError(t, err)
|
||||
SentryDSN = dsn.String()
|
||||
setSentryDSN(t, dsn)
|
||||
|
||||
s, err := newServerWithConfig(t, func(cfg *model.Config) {
|
||||
*cfg.ServiceSettings.ListenAddress = "localhost:0"
|
||||
|
||||
Ссылка в новой задаче
Block a user