Files
object-browser/restapi/ws_handle_test.go
César Nieto 6fef30f29d Add Watch api and UI integration (#120)
Uses a similar approach as Trace and Console Logs by using
websockets. It also includes the integration with the UI which
needs 3 input fields that are sent as query parameters.
2020-05-15 14:24:29 -07:00

54 lines
1.7 KiB
Go

// This file is part of MinIO Console Server
// Copyright (c) 2020 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package restapi
import (
"time"
)
// Common mocks for WSConn interface
// assigning mock at runtime instead of compile time
var connWriteMessageMock func(messageType int, data []byte) error
var connReadMessageMock func() (messageType int, p []byte, err error)
// Uncomment and implement if needed
// var connCloseMock func() error
// var connSetReadLimitMock func(limit int64)
// var connSetReadDeadlineMock func(t time.Time) error
// var connSetPongHandlerMock func(h func(appData string) error)
// The Conn type represents a WebSocket connection.
type mockConn struct{}
func (c mockConn) writeMessage(messageType int, data []byte) error {
return connWriteMessageMock(messageType, data)
}
func (c mockConn) readMessage() (messageType int, p []byte, err error) {
return connReadMessageMock()
}
func (c mockConn) close() error {
return nil
}
func (c mockConn) setReadLimit(limit int64) {
}
func (c mockConn) setReadDeadline(t time.Time) error {
return nil
}
func (c mockConn) setPongHandler(h func(appData string) error) {
}