Full Mattermost server source with integrated Community Enterprise features. Includes vendor directory for offline/air-gapped builds. Structure: - enterprise-impl/: Enterprise feature implementations - enterprise-community/: Init files that register implementations - enterprise/: Bridge imports (community_imports.go) - vendor/: All dependencies for offline builds Build (online): go build ./cmd/mattermost Build (offline/air-gapped): go build -mod=vendor ./cmd/mattermost 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
52 lines
1.1 KiB
Go
52 lines
1.1 KiB
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.enterprise for license information.
|
|
|
|
package common
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestGetVersionComponents(t *testing.T) {
|
|
testCases := []struct {
|
|
Name string
|
|
Version string
|
|
ExpectedMajor int
|
|
ExpectedMinor int
|
|
ExpectedPatch int
|
|
ExpectedError bool
|
|
}{
|
|
{
|
|
Name: "Should error if version format is invalid",
|
|
Version: "invalid",
|
|
ExpectedMajor: 0,
|
|
ExpectedMinor: 0,
|
|
ExpectedPatch: 0,
|
|
ExpectedError: true,
|
|
},
|
|
{
|
|
Name: "Should work correctly if version has three valid components",
|
|
Version: "7.2.3",
|
|
ExpectedMajor: 7,
|
|
ExpectedMinor: 2,
|
|
ExpectedPatch: 3,
|
|
ExpectedError: false,
|
|
},
|
|
}
|
|
|
|
for _, tc := range testCases {
|
|
t.Run(tc.Name, func(t *testing.T) {
|
|
major, minor, patch, err := GetVersionComponents(tc.Version)
|
|
if tc.ExpectedError {
|
|
require.Error(t, err)
|
|
}
|
|
assert.Equal(t, tc.ExpectedMajor, major)
|
|
assert.Equal(t, tc.ExpectedMinor, minor)
|
|
assert.Equal(t, tc.ExpectedPatch, patch)
|
|
})
|
|
}
|
|
}
|