mattermost-community-enterp.../public/plugin/http_test.go
Claude ec1f89217a Merge: Complete Mattermost Server with Community Enterprise
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>
2025-12-17 23:59:07 +09:00

41 lines
1.1 KiB
Go

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package plugin
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
// TestFlushGracefulDegradation verifies that the Flush RPC handler gracefully handles
// underlying writers that don't support http.Flusher interface
func TestFlushGracefulDegradation(t *testing.T) {
// Create a mock writer that does NOT implement http.Flusher
type basicWriter struct {
http.ResponseWriter
}
mockWriter := &basicWriter{
ResponseWriter: httptest.NewRecorder(),
}
// Verify it doesn't implement Flusher
_, ok := any(mockWriter).(http.Flusher)
require.False(t, ok, "basicWriter should not implement http.Flusher")
// Create server with non-Flusher writer
server := &httpResponseWriterRPCServer{
w: mockWriter,
}
// Test that Flush doesn't panic even when underlying writer doesn't support it
assert.NotPanics(t, func() {
err := server.Flush(struct{}{}, &struct{}{})
assert.NoError(t, err)
})
}