From 8fe511b85de08e48ba40071c67fb1049afb0354e Mon Sep 17 00:00:00 2001 From: Nikita Kryuchkov Date: Fri, 13 Dec 2019 00:18:22 +0300 Subject: [PATCH] Remove outdated tests --- pkg/router/router_test.go | 109 -------------------------------------- 1 file changed, 109 deletions(-) diff --git a/pkg/router/router_test.go b/pkg/router/router_test.go index 8e137402ac..eb8e641b17 100644 --- a/pkg/router/router_test.go +++ b/pkg/router/router_test.go @@ -357,7 +357,6 @@ func TestRouter_handleTransportPacket(t *testing.T) { }) } -// TODO (Darkren): fix tests func TestRouter_Rules(t *testing.T) { pk, sk := cipher.GenerateKeyPair() @@ -453,114 +452,6 @@ func TestRouter_Rules(t *testing.T) { r.RemoveRouteDescriptor(desc) assert.Equal(t, 0, rt.Count()) }) - - // TEST: Ensure AddRule and DeleteRule requests from a SetupNode does as expected. - // t.Run("AddRemoveRule", func(t *testing.T) { - // clearRules() - // - // // Add/Remove rules multiple times. - // for i := 0; i < 5; i++ { - // // As setup connections close after a single request completes - // // So we need two pairs of connections. - // requestIDIn, requestIDOut := net.Pipe() - // addIn, addOut := net.Pipe() - // delIn, delOut := net.Pipe() - // errCh := make(chan error, 2) - // go func() { - // errCh <- r.handleSetupConn(requestIDOut) // Receive RequestRegistrationID request. - // errCh <- r.handleSetupConn(addOut) // Receive AddRule request. - // errCh <- r.handleSetupConn(delOut) // Receive DeleteRule request. - // close(errCh) - // }() - // - // // Emulate SetupNode sending RequestRegistrationID request. - // proto := setup.NewSetupProtocol(requestIDIn) - // ids, err := proto.ReserveRtIDs(context.TODO(), 1) - // require.NoError(t, err) - // - // // Emulate SetupNode sending AddRule request. - // rule := routing.IntermediaryForwardRule(10*time.Minute, ids[0], 3, uuid.New()) - // proto = setup.NewSetupProtocol(addIn) - // err = proto.AddRules(context.TODO(), []routing.Rule{rule}) - // require.NoError(t, err) - // - // // Check routing table state after AddRule. - // assert.Equal(t, 1, rt.Count()) - // r, err := rt.Rule(ids[0]) - // require.NoError(t, err) - // assert.Equal(t, rule, r) - // - // // Emulate SetupNode sending RemoveRule request. - // require.NoError(t, setup.DeleteRule(context.TODO(), setup.NewSetupProtocol(delIn), ids[0])) - // - // // Check routing table state after DeleteRule. - // assert.Equal(t, 0, rt.Count()) - // r, err = rt.Rule(ids[0]) - // assert.Error(t, err) - // assert.Nil(t, r) - // - // require.NoError(t, requestIDIn.Close()) - // require.NoError(t, addIn.Close()) - // require.NoError(t, delIn.Close()) - // for err := range errCh { - // require.NoError(t, err) - // } - // } - // }) - - // TEST: Ensure RoutesCreated request from SetupNode is handled properly. - // t.Run("RoutesCreated", func(t *testing.T) { - // clearRules() - // - // var inLoop routing.Loop - // var inRule routing.Rule - // - // r.OnRoutesCreated = func(loop routing.Loop, rule routing.Rule) (err error) { - // inLoop = loop - // inRule = rule - // return nil - // } - // defer func() { r.OnRoutesCreated = nil }() - // - // in, out := net.Pipe() - // errCh := make(chan error, 1) - // go func() { - // errCh <- r.handleSetupConn(out) - // close(errCh) - // }() - // defer func() { - // require.NoError(t, in.Close()) - // require.NoError(t, <-errCh) - // }() - // - // proto := setup.NewSetupProtocol(in) - // pk, _ := cipher.GenerateKeyPair() - // - // rule := routing.ConsumeRule(10*time.Minute, 2, pk, 2, 3) - // require.NoError(t, rt.SaveRule(rule)) - // - // rule = routing.IntermediaryForwardRule(10*time.Minute, 1, 3, uuid.New()) - // require.NoError(t, rt.SaveRule(rule)) - // - // ld := routing.LoopData{ - // Loop: routing.Loop{ - // Remote: routing.Addr{ - // PubKey: pk, - // Port: 3, - // }, - // Local: routing.Addr{ - // Port: 2, - // }, - // }, - // RouteID: 1, - // } - // err := proto.RoutesCreated(context.TODO(), ld) - // require.NoError(t, err) - // assert.Equal(t, rule, inRule) - // assert.Equal(t, routing.Port(2), inLoop.Local.Port) - // assert.Equal(t, routing.Port(3), inLoop.Remote.Port) - // assert.Equal(t, pk, inLoop.Remote.PubKey) - // }) } func TestRouter_SetupIsTrusted(t *testing.T) {