mirror of
https://github.com/minio/minio.git
synced 2025-12-07 00:02:31 -05:00
Simplify gateway backend registration (#5111)
This commit is contained in:
@@ -19,8 +19,31 @@ package cmd
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/minio/cli"
|
||||
)
|
||||
|
||||
// Test RegisterGatewayCommand
|
||||
func TestRegisterGatewayCommand(t *testing.T) {
|
||||
var err error
|
||||
|
||||
cmd := cli.Command{Name: "test"}
|
||||
err = RegisterGatewayCommand(cmd)
|
||||
if err != nil {
|
||||
t.Errorf("RegisterGatewayCommand got unexpected error: %s", err)
|
||||
}
|
||||
|
||||
// Should returns 'duplicated' error
|
||||
err = RegisterGatewayCommand(cmd)
|
||||
if err == nil {
|
||||
t.Errorf("RegisterGatewayCommand twice with same name should return error")
|
||||
} else {
|
||||
if err.Error() != "duplicate gateway: test" {
|
||||
t.Errorf("RegisterGatewayCommand got unexpected error: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Test parseGatewayEndpoint
|
||||
func TestParseGatewayEndpoint(t *testing.T) {
|
||||
testCases := []struct {
|
||||
|
||||
Reference in New Issue
Block a user