diff options
author | Valery Piashchynski <[email protected]> | 2022-03-06 12:35:14 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2022-03-06 12:35:14 +0100 |
commit | 1c5a6a590832bbefb2cab99a81f413a5a0e756de (patch) | |
tree | cc6595214e4ff39600099fb8c6f39e7a3dd560e9 /internal/rpc/client_test.go | |
parent | 587702be62b65c151d27dc79e62fcbbd11290e6f (diff) | |
parent | 70e4f020afd0352dc52114651f0f65c1965ed399 (diff) |
[#1036]: chore(cli): remove config plugin from the `root.go`
Diffstat (limited to 'internal/rpc/client_test.go')
-rw-r--r-- | internal/rpc/client_test.go | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/internal/rpc/client_test.go b/internal/rpc/client_test.go index 34240826..0744e167 100644 --- a/internal/rpc/client_test.go +++ b/internal/rpc/client_test.go @@ -14,28 +14,22 @@ func TestNewClient_RpcServiceDisabled(t *testing.T) { cfgPlugin := &config.Plugin{Type: "yaml", ReadInCfg: []byte{}} assert.NoError(t, cfgPlugin.Init()) - c, err := rpc.NewClient(cfgPlugin) + c, err := rpc.NewClient("test/config_rpc_empty.yaml") assert.Nil(t, c) assert.EqualError(t, err, "rpc service disabled") } func TestNewClient_WrongRcpConfiguration(t *testing.T) { - cfgPlugin := &config.Plugin{Type: "yaml", ReadInCfg: []byte("rpc:\n $foo bar")} - assert.NoError(t, cfgPlugin.Init()) - - c, err := rpc.NewClient(cfgPlugin) + c, err := rpc.NewClient("test/config_rpc_wrong.yaml") assert.Nil(t, c) assert.Error(t, err) - assert.Contains(t, err.Error(), "config_plugin_unmarshal_key") + assert.Contains(t, err.Error(), "'' expected a map, got 'string'") } func TestNewClient_ConnectionError(t *testing.T) { - cfgPlugin := &config.Plugin{Type: "yaml", ReadInCfg: []byte("rpc:\n listen: tcp://127.0.0.1:0")} - assert.NoError(t, cfgPlugin.Init()) - - c, err := rpc.NewClient(cfgPlugin) + c, err := rpc.NewClient("test/config_rpc_conn_err.yaml") assert.Nil(t, c) assert.Error(t, err) @@ -43,15 +37,12 @@ func TestNewClient_ConnectionError(t *testing.T) { } func TestNewClient_SuccessfullyConnected(t *testing.T) { - l, err := net.Listen("tcp", "127.0.0.1:0") + l, err := net.Listen("tcp", "127.0.0.1:55555") assert.NoError(t, err) defer func() { assert.NoError(t, l.Close()) }() - cfgPlugin := &config.Plugin{Type: "yaml", ReadInCfg: []byte("rpc:\n listen: tcp://" + l.Addr().String())} - assert.NoError(t, cfgPlugin.Init()) - - c, err := rpc.NewClient(cfgPlugin) + c, err := rpc.NewClient("test/config_rpc_ok.yaml") assert.NotNil(t, c) assert.NoError(t, err) |