Skip to content

Commit

Permalink
Remove outdated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nkryuchkov committed Dec 12, 2019
1 parent e6dc9a2 commit 8fe511b
Showing 1 changed file with 0 additions and 109 deletions.
109 changes: 0 additions & 109 deletions pkg/router/router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,6 @@ func TestRouter_handleTransportPacket(t *testing.T) {
})
}

// TODO (Darkren): fix tests
func TestRouter_Rules(t *testing.T) {
pk, sk := cipher.GenerateKeyPair()

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 8fe511b

Please sign in to comment.