mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
fix TestGetServiceEnvironment (#24506)
A late change to the service environment functionality had us defaulting to `dev` instead of `test` without the `production` build tag. Unfortunately, because these tests were unintentionally being skipped within the submodule, the failure wasn't caught at the time. A simple update addresses the unit tests. Fixes: https://mattermost.atlassian.net/browse/MM-54197
This commit is contained in:
parent
4022d2e762
commit
2d1848bf14
@ -16,15 +16,13 @@ import (
|
||||
// semantics at the unit test level. Validating the default, enterprise service environment is left
|
||||
// to smoketests before releasing.
|
||||
func TestGetServiceEnvironment(t *testing.T) {
|
||||
t.Run("no env defaults to test (without production tag)", func(t *testing.T) {
|
||||
t.Skip("https://mattermost.atlassian.net/browse/MM-54197")
|
||||
require.Equal(t, model.ServiceEnvironmentTest, model.GetServiceEnvironment())
|
||||
t.Run("no env defaults to dev (without production tag)", func(t *testing.T) {
|
||||
require.Equal(t, model.ServiceEnvironmentDev, model.GetServiceEnvironment())
|
||||
})
|
||||
t.Run("empty string defaults to test (without production tag)", func(t *testing.T) {
|
||||
t.Skip("https://mattermost.atlassian.net/browse/MM-54197")
|
||||
t.Run("empty string defaults to dev (without production tag)", func(t *testing.T) {
|
||||
os.Setenv("MM_SERVICEENVIRONMENT", "")
|
||||
defer os.Unsetenv("MM_SERVICEENVIRONMENT")
|
||||
require.Equal(t, model.ServiceEnvironmentTest, model.GetServiceEnvironment())
|
||||
require.Equal(t, model.ServiceEnvironmentDev, model.GetServiceEnvironment())
|
||||
})
|
||||
t.Run("production", func(t *testing.T) {
|
||||
os.Setenv("MM_SERVICEENVIRONMENT", "production")
|
||||
|
Loading…
Reference in New Issue
Block a user