mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[MM-54014] Run tests in public/... (#24320)
This commit is contained in:
parent
d9af86f3ac
commit
2108517fae
@ -151,8 +151,7 @@ DIST_PATH_OSX_ARM64=$(DIST_ROOT)/osx_arm64/mattermost
|
|||||||
DIST_PATH_WIN=$(DIST_ROOT)/windows/mattermost
|
DIST_PATH_WIN=$(DIST_ROOT)/windows/mattermost
|
||||||
|
|
||||||
# Packages lists
|
# Packages lists
|
||||||
TE_PACKAGES=$(shell $(GO) list ./... | grep -vE 'server/v8/cmd/mmctl')
|
TE_PACKAGES=$(shell $(GO) list ./public/...) $(shell $(GO) list ./... | grep -vE 'server/v8/cmd/mmctl')
|
||||||
SUITE_PACKAGES=$(shell $(GO) list ./...| grep -vE 'server/v8/cmd/mmctl')
|
|
||||||
MMCTL_PACKAGES=$(shell $(GO) list ./... | grep -E 'server/v8/cmd/mmctl')
|
MMCTL_PACKAGES=$(shell $(GO) list ./... | grep -E 'server/v8/cmd/mmctl')
|
||||||
|
|
||||||
TEMPLATES_DIR=templates
|
TEMPLATES_DIR=templates
|
||||||
@ -442,7 +441,7 @@ gotestsum:
|
|||||||
test-compile: gotestsum ## Compile tests.
|
test-compile: gotestsum ## Compile tests.
|
||||||
@echo COMPILE TESTS
|
@echo COMPILE TESTS
|
||||||
|
|
||||||
for package in $(SUITE_PACKAGES) $(EE_PACKAGES); do \
|
for package in $(TE_PACKAGES) $(EE_PACKAGES); do \
|
||||||
$(GO) test $(GOFLAGS) -c $$package; \
|
$(GO) test $(GOFLAGS) -c $$package; \
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -487,7 +486,7 @@ test-server: export GOTESTSUM_FORMAT := $(GOTESTSUM_FORMAT)
|
|||||||
test-server: export GOTESTSUM_JUNITFILE := $(GOTESTSUM_JUNITFILE)
|
test-server: export GOTESTSUM_JUNITFILE := $(GOTESTSUM_JUNITFILE)
|
||||||
test-server: export GOTESTSUM_JSONFILE := $(GOTESTSUM_JSONFILE)
|
test-server: export GOTESTSUM_JSONFILE := $(GOTESTSUM_JSONFILE)
|
||||||
test-server: test-server-pre
|
test-server: test-server-pre
|
||||||
$(GOBIN)/gotestsum --rerun-fails=3 --packages="$(SUITE_PACKAGES) $(EE_PACKAGES)" -- $(GOFLAGS) -timeout=90m
|
$(GOBIN)/gotestsum --rerun-fails=3 --packages="$(TE_PACKAGES) $(EE_PACKAGES)" -- $(GOFLAGS) -timeout=90m
|
||||||
ifneq ($(IS_CI),true)
|
ifneq ($(IS_CI),true)
|
||||||
ifneq ($(MM_NO_DOCKER),true)
|
ifneq ($(MM_NO_DOCKER),true)
|
||||||
ifneq ($(TEMP_DOCKER_SERVICES),)
|
ifneq ($(TEMP_DOCKER_SERVICES),)
|
||||||
@ -512,10 +511,10 @@ test-server-quick: export GOTESTSUM_JSONFILE := $(GOTESTSUM_JSONFILE)
|
|||||||
test-server-quick: check-prereqs-enterprise ## Runs only quick tests.
|
test-server-quick: check-prereqs-enterprise ## Runs only quick tests.
|
||||||
ifeq ($(BUILD_ENTERPRISE_READY),true)
|
ifeq ($(BUILD_ENTERPRISE_READY),true)
|
||||||
@echo Running all tests
|
@echo Running all tests
|
||||||
$(GOBIN)/gotestsum --packages="$(SUITE_PACKAGES) $(EE_PACKAGES)" -- $(GOFLAGS) -short
|
$(GOBIN)/gotestsum --packages="$(TE_PACKAGES) $(EE_PACKAGES)" -- $(GOFLAGS) -short
|
||||||
else
|
else
|
||||||
@echo Running only TE tests
|
@echo Running only TE tests
|
||||||
$(GOBIN)/gotestsum --packages="$(SUITE_PACKAGES)" -- $(GOFLAGS) -short
|
$(GOBIN)/gotestsum --packages="$(TE_PACKAGES)" -- $(GOFLAGS) -short
|
||||||
endif
|
endif
|
||||||
|
|
||||||
internal-test-web-client: ## Runs web client tests.
|
internal-test-web-client: ## Runs web client tests.
|
||||||
|
@ -317,38 +317,13 @@ func TestConfigDefaultNPSPluginState(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestConfigDefaultChannelExportPluginState(t *testing.T) {
|
func TestConfigDefaultChannelExportPluginState(t *testing.T) {
|
||||||
t.Run("should enable ChannelExport plugin by default on enterprise-ready builds", func(t *testing.T) {
|
t.Run("should not enable ChannelExport plugin by default", func(t *testing.T) {
|
||||||
BuildEnterpriseReady = "true"
|
BuildEnterpriseReady = "true"
|
||||||
c1 := Config{}
|
c1 := Config{}
|
||||||
c1.SetDefaults()
|
c1.SetDefaults()
|
||||||
|
|
||||||
assert.True(t, c1.PluginSettings.PluginStates["com.mattermost.plugin-channel-export"].Enable)
|
|
||||||
})
|
|
||||||
|
|
||||||
t.Run("should not enable ChannelExport plugin by default on non-enterprise-ready builds", func(t *testing.T) {
|
|
||||||
BuildEnterpriseReady = ""
|
|
||||||
c1 := Config{}
|
|
||||||
c1.SetDefaults()
|
|
||||||
|
|
||||||
assert.Nil(t, c1.PluginSettings.PluginStates["com.mattermost.plugin-channel-export"])
|
assert.Nil(t, c1.PluginSettings.PluginStates["com.mattermost.plugin-channel-export"])
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("should not re-enable ChannelExport plugin after it has been disabled", func(t *testing.T) {
|
|
||||||
BuildEnterpriseReady = ""
|
|
||||||
c1 := Config{
|
|
||||||
PluginSettings: PluginSettings{
|
|
||||||
PluginStates: map[string]*PluginState{
|
|
||||||
"com.mattermost.plugin-channel-export": {
|
|
||||||
Enable: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
c1.SetDefaults()
|
|
||||||
|
|
||||||
assert.False(t, c1.PluginSettings.PluginStates["com.mattermost.plugin-channel-export"].Enable)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTeamSettingsIsValidSiteNameEmpty(t *testing.T) {
|
func TestTeamSettingsIsValidSiteNameEmpty(t *testing.T) {
|
||||||
|
@ -17,9 +17,11 @@ import (
|
|||||||
// to smoketests before releasing.
|
// to smoketests before releasing.
|
||||||
func TestGetServiceEnvironment(t *testing.T) {
|
func TestGetServiceEnvironment(t *testing.T) {
|
||||||
t.Run("no env defaults to test (without production tag)", func(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())
|
require.Equal(t, model.ServiceEnvironmentTest, model.GetServiceEnvironment())
|
||||||
})
|
})
|
||||||
t.Run("empty string defaults to test (without production tag)", func(t *testing.T) {
|
t.Run("empty string defaults to test (without production tag)", func(t *testing.T) {
|
||||||
|
t.Skip("https://mattermost.atlassian.net/browse/MM-54197")
|
||||||
os.Setenv("MM_SERVICEENVIRONMENT", "")
|
os.Setenv("MM_SERVICEENVIRONMENT", "")
|
||||||
defer os.Unsetenv("MM_SERVICEENVIRONMENT")
|
defer os.Unsetenv("MM_SERVICEENVIRONMENT")
|
||||||
require.Equal(t, model.ServiceEnvironmentTest, model.GetServiceEnvironment())
|
require.Equal(t, model.ServiceEnvironmentTest, model.GetServiceEnvironment())
|
||||||
|
@ -73,26 +73,4 @@ func TestAvailablePlugins(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, bundles, 0)
|
require.Len(t, bundles, 0)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Should not load bundles on blocklist", func(t *testing.T) {
|
|
||||||
bundle := model.BundleInfo{
|
|
||||||
Manifest: &model.Manifest{
|
|
||||||
Id: "playbooks",
|
|
||||||
Version: "1",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
err := os.Mkdir(filepath.Join(dir, "plugin4"), 0700)
|
|
||||||
require.NoError(t, err)
|
|
||||||
defer os.RemoveAll(filepath.Join(dir, "plugin4"))
|
|
||||||
|
|
||||||
path := filepath.Join(dir, "plugin4", "plugin.json")
|
|
||||||
manifestJSON, jsonErr := json.Marshal(bundle.Manifest)
|
|
||||||
require.NoError(t, jsonErr)
|
|
||||||
err = os.WriteFile(path, manifestJSON, 0644)
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
bundles, err := env.Available()
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Len(t, bundles, 0)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ func TestInstallPluginFromURL(t *testing.T) {
|
|||||||
api.On("GetServerVersion").Return("5.19.0")
|
api.On("GetServerVersion").Return("5.19.0")
|
||||||
client := pluginapi.NewClient(api, &plugintest.Driver{})
|
client := pluginapi.NewClient(api, &plugintest.Driver{})
|
||||||
|
|
||||||
tarData, err := os.ReadFile(filepath.Join("../../../tests", "testplugin.tar.gz"))
|
tarData, err := os.ReadFile(filepath.Join("../../tests", "testplugin.tar.gz"))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
expectedManifest := &model.Manifest{Id: "testplugin"}
|
expectedManifest := &model.Manifest{Id: "testplugin"}
|
||||||
api.On("InstallPlugin", mock.Anything, false).Return(expectedManifest, nil)
|
api.On("InstallPlugin", mock.Anything, false).Return(expectedManifest, nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user