created helper to enable tracing if not running in CI
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
package addresses
|
||||
|
||||
import (
|
||||
"git.indra-labs.org/dev/ind"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec/reg"
|
||||
"git.indra-labs.org/dev/ind/pkg/crypto"
|
||||
"git.indra-labs.org/dev/ind/pkg/crypto/nonce"
|
||||
log2 "git.indra-labs.org/dev/ind/pkg/proc/log"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/ci"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/splice"
|
||||
"github.com/multiformats/go-multiaddr"
|
||||
"testing"
|
||||
@@ -14,9 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func TestNew(t *testing.T) {
|
||||
if indra.CI == "false" {
|
||||
log2.SetLogLevel(log2.Trace)
|
||||
}
|
||||
ci.TraceIfNot()
|
||||
var e error
|
||||
pr, _, _ := crypto.NewSigner()
|
||||
id := nonce.NewID()
|
||||
|
||||
@@ -1,22 +1,19 @@
|
||||
package intro
|
||||
|
||||
import (
|
||||
"git.indra-labs.org/dev/ind"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec/reg"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/ci"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/splice"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
||||
"git.indra-labs.org/dev/ind/pkg/crypto"
|
||||
"git.indra-labs.org/dev/ind/pkg/crypto/nonce"
|
||||
log2 "git.indra-labs.org/dev/ind/pkg/proc/log"
|
||||
)
|
||||
|
||||
func TestNew(t *testing.T) {
|
||||
if indra.CI == "false" {
|
||||
log2.SetLogLevel(log2.Trace)
|
||||
}
|
||||
ci.TraceIfNot()
|
||||
var e error
|
||||
pr, ks, _ := crypto.NewSigner()
|
||||
introducer := ks.Next()
|
||||
|
||||
@@ -2,21 +2,18 @@ package load
|
||||
|
||||
import (
|
||||
"git.indra-labs.org/dev/ind/pkg/codec"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/ci"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"git.indra-labs.org/dev/ind"
|
||||
|
||||
"git.indra-labs.org/dev/ind/pkg/codec/reg"
|
||||
"git.indra-labs.org/dev/ind/pkg/crypto"
|
||||
"git.indra-labs.org/dev/ind/pkg/crypto/nonce"
|
||||
log2 "git.indra-labs.org/dev/ind/pkg/proc/log"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/splice"
|
||||
)
|
||||
|
||||
func TestNew(t *testing.T) {
|
||||
if indra.CI == "false" {
|
||||
log2.SetLogLevel(log2.Trace)
|
||||
}
|
||||
ci.TraceIfNot()
|
||||
var e error
|
||||
pr, _, _ := crypto.NewSigner()
|
||||
id := nonce.NewID()
|
||||
|
||||
@@ -2,21 +2,18 @@ package peer
|
||||
|
||||
import (
|
||||
"git.indra-labs.org/dev/ind/pkg/codec"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/ci"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"git.indra-labs.org/dev/ind"
|
||||
|
||||
"git.indra-labs.org/dev/ind/pkg/codec/reg"
|
||||
"git.indra-labs.org/dev/ind/pkg/crypto"
|
||||
"git.indra-labs.org/dev/ind/pkg/crypto/nonce"
|
||||
log2 "git.indra-labs.org/dev/ind/pkg/proc/log"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/splice"
|
||||
)
|
||||
|
||||
func TestNew(t *testing.T) {
|
||||
if indra.CI == "false" {
|
||||
log2.SetLogLevel(log2.Trace)
|
||||
}
|
||||
ci.TraceIfNot()
|
||||
var e error
|
||||
pr, _, _ := crypto.NewSigner()
|
||||
id := nonce.NewID()
|
||||
|
||||
@@ -1,25 +1,23 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"git.indra-labs.org/dev/ind"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec/reg"
|
||||
"git.indra-labs.org/dev/ind/pkg/crypto"
|
||||
"git.indra-labs.org/dev/ind/pkg/crypto/nonce"
|
||||
log2 "git.indra-labs.org/dev/ind/pkg/proc/log"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/ci"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/splice"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestServiceAd(t *testing.T) {
|
||||
if indra.CI == "false" {
|
||||
log2.SetLogLevel(log2.Trace)
|
||||
}
|
||||
ci.TraceIfNot()
|
||||
var e error
|
||||
pr, _, _ := crypto.NewSigner()
|
||||
id := nonce.NewID()
|
||||
sv := New(id, pr, []Service{{80, 62346}, {443, 42216}}, time.Now().Add(time.Hour))
|
||||
sv := New(id, pr, []Service{{80, 62346}, {443, 42216}},
|
||||
time.Now().Add(time.Hour))
|
||||
log.D.S("service", sv)
|
||||
s := splice.New(sv.Len())
|
||||
if e = sv.Encode(s); fails(e) {
|
||||
|
||||
@@ -1,22 +1,19 @@
|
||||
package balance
|
||||
|
||||
import (
|
||||
"git.indra-labs.org/dev/ind"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec/ont"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec/reg"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/ci"
|
||||
"testing"
|
||||
|
||||
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
|
||||
|
||||
"git.indra-labs.org/dev/ind/pkg/crypto/nonce"
|
||||
log2 "git.indra-labs.org/dev/ind/pkg/proc/log"
|
||||
)
|
||||
|
||||
func TestOnions_Balance(t *testing.T) {
|
||||
if indra.CI == "false" {
|
||||
log2.SetLogLevel(log2.Debug)
|
||||
}
|
||||
ci.TraceIfNot()
|
||||
id := nonce.NewID()
|
||||
sats := lnwire.MilliSatoshi(10000)
|
||||
on := ont.Assemble([]ont.Onion{New(id, sats)})
|
||||
|
||||
@@ -1,27 +1,24 @@
|
||||
package confirmation
|
||||
|
||||
import (
|
||||
"git.indra-labs.org/dev/ind"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec/ont"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec/reg"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/ci"
|
||||
"testing"
|
||||
|
||||
|
||||
"git.indra-labs.org/dev/ind/pkg/crypto/nonce"
|
||||
log2 "git.indra-labs.org/dev/ind/pkg/proc/log"
|
||||
)
|
||||
|
||||
func TestOnions_Confirmation(t *testing.T) {
|
||||
if indra.CI == "false" {
|
||||
log2.SetLogLevel(log2.Debug)
|
||||
}
|
||||
ci.TraceIfNot()
|
||||
id := nonce.NewID()
|
||||
on := ont.Assemble([]ont.Onion{New(id)})
|
||||
s := codec.Encode(on)
|
||||
s.SetCursor(0)
|
||||
var onc codec.Codec
|
||||
if onc = reg.Recognise(s); onc == nil {
|
||||
|
||||
|
||||
t.Error("did not unwrap")
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
@@ -1,22 +1,19 @@
|
||||
package crypt
|
||||
|
||||
import (
|
||||
"git.indra-labs.org/dev/ind"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec/onion/cores/confirmation"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec/ont"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec/reg"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/ci"
|
||||
"testing"
|
||||
|
||||
|
||||
"git.indra-labs.org/dev/ind/pkg/crypto"
|
||||
"git.indra-labs.org/dev/ind/pkg/crypto/nonce"
|
||||
log2 "git.indra-labs.org/dev/ind/pkg/proc/log"
|
||||
)
|
||||
|
||||
func TestOnions_SimpleCrypt(t *testing.T) {
|
||||
if indra.CI == "false" {
|
||||
log2.SetLogLevel(log2.Debug)
|
||||
}
|
||||
ci.TraceIfNot()
|
||||
var e error
|
||||
n := nonce.NewID()
|
||||
n1 := nonce.New()
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
package delay
|
||||
|
||||
import (
|
||||
"git.indra-labs.org/dev/ind"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec/ont"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec/reg"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/ci"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
log2 "git.indra-labs.org/dev/ind/pkg/proc/log"
|
||||
)
|
||||
|
||||
func TestOnions_Delay(t *testing.T) {
|
||||
if indra.CI == "false" {
|
||||
log2.SetLogLevel(log2.Debug)
|
||||
}
|
||||
ci.TraceIfNot()
|
||||
dur := time.Second
|
||||
on := ont.Assemble([]ont.Onion{New(dur)})
|
||||
s := codec.Encode(on)
|
||||
@@ -27,7 +23,7 @@ func TestOnions_Delay(t *testing.T) {
|
||||
if e := onc.Decode(s); fails(e) {
|
||||
t.Error("did not decode")
|
||||
t.FailNow()
|
||||
|
||||
|
||||
}
|
||||
var dl *Delay
|
||||
var ok bool
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package forward
|
||||
|
||||
import (
|
||||
"git.indra-labs.org/dev/ind"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec/ont"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec/reg"
|
||||
log2 "git.indra-labs.org/dev/ind/pkg/proc/log"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/ci"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/multi"
|
||||
"github.com/multiformats/go-multiaddr"
|
||||
"math/rand"
|
||||
@@ -13,14 +12,12 @@ import (
|
||||
"net/netip"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
|
||||
"git.indra-labs.org/dev/ind/pkg/crypto/nonce"
|
||||
)
|
||||
|
||||
func TestOnions_Forward(t *testing.T) {
|
||||
if indra.CI == "false" {
|
||||
log2.SetLogLevel(log2.Trace)
|
||||
}
|
||||
ci.TraceIfNot()
|
||||
ipSizes := []int{net.IPv6len, net.IPv4len}
|
||||
for i := range ipSizes {
|
||||
n := nonce.New()
|
||||
@@ -57,7 +54,7 @@ func TestOnions_Forward(t *testing.T) {
|
||||
if e := onr.Decode(s); fails(e) {
|
||||
t.Error("did not decode")
|
||||
t.FailNow()
|
||||
|
||||
|
||||
}
|
||||
var cf *Forward
|
||||
if cf, ok = onr.(*Forward); !ok {
|
||||
|
||||
@@ -1,25 +1,21 @@
|
||||
package introquery
|
||||
|
||||
import (
|
||||
"git.indra-labs.org/dev/ind"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec/onion/cores/end"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec/onion/exit"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec/ont"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec/reg"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/ci"
|
||||
"testing"
|
||||
|
||||
|
||||
"git.indra-labs.org/dev/ind/pkg/crypto"
|
||||
"git.indra-labs.org/dev/ind/pkg/crypto/nonce"
|
||||
"git.indra-labs.org/dev/ind/pkg/engine/sessions"
|
||||
log2 "git.indra-labs.org/dev/ind/pkg/proc/log"
|
||||
)
|
||||
|
||||
func TestOnions_IntroQuery(t *testing.T) {
|
||||
if indra.CI == "false" {
|
||||
log2.SetLogLevel(log2.Trace)
|
||||
}
|
||||
log2.App.Store("")
|
||||
ci.TraceIfNot()
|
||||
var e error
|
||||
prvs, pubs := crypto.GetCipherSet()
|
||||
ciphers := crypto.GenCiphers(prvs, pubs)
|
||||
|
||||
@@ -4,7 +4,6 @@ package services
|
||||
|
||||
import (
|
||||
"context"
|
||||
"git.indra-labs.org/dev/ind"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec"
|
||||
intro "git.indra-labs.org/dev/ind/pkg/codec/ad/intro"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec/onion/exit"
|
||||
@@ -17,17 +16,13 @@ import (
|
||||
"git.indra-labs.org/dev/ind/pkg/engine/sessions"
|
||||
"git.indra-labs.org/dev/ind/pkg/engine/transport"
|
||||
headers2 "git.indra-labs.org/dev/ind/pkg/headers"
|
||||
log2 "git.indra-labs.org/dev/ind/pkg/proc/log"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/slice"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestOnions_HiddenService(t *testing.T) {
|
||||
if indra.CI == "false" {
|
||||
t.Log("ci not enabled")
|
||||
log2.SetLogLevel(log2.Trace)
|
||||
}
|
||||
ci.TraceIfNotCI()
|
||||
var e error
|
||||
n3 := crypto.Gen3Nonces()
|
||||
id := nonce.NewID()
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package reverse
|
||||
|
||||
import (
|
||||
"git.indra-labs.org/dev/ind"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec/ont"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec/reg"
|
||||
log2 "git.indra-labs.org/dev/ind/pkg/proc/log"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/ci"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/multi"
|
||||
"github.com/multiformats/go-multiaddr"
|
||||
"math/rand"
|
||||
@@ -13,14 +12,12 @@ import (
|
||||
"net/netip"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
|
||||
"git.indra-labs.org/dev/ind/pkg/crypto/nonce"
|
||||
)
|
||||
|
||||
func TestOnions_Reverse(t *testing.T) {
|
||||
if indra.CI == "false" {
|
||||
log2.SetLogLevel(log2.Trace)
|
||||
}
|
||||
ci.TraceIfNot()
|
||||
ipSizes := []int{net.IPv4len, net.IPv6len}
|
||||
for i := range ipSizes {
|
||||
n := nonce.New()
|
||||
@@ -55,7 +52,7 @@ func TestOnions_Reverse(t *testing.T) {
|
||||
if e := onr.Decode(s); fails(e) {
|
||||
t.Error("did not decode")
|
||||
t.FailNow()
|
||||
|
||||
|
||||
}
|
||||
var cf *Reverse
|
||||
if cf, ok = onr.(*Reverse); !ok {
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
package session
|
||||
|
||||
import (
|
||||
"git.indra-labs.org/dev/ind"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec/reg"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/ci"
|
||||
"testing"
|
||||
|
||||
log2 "git.indra-labs.org/dev/ind/pkg/proc/log"
|
||||
)
|
||||
|
||||
func TestOnions_Session(t *testing.T) {
|
||||
if indra.CI == "false" {
|
||||
log2.SetLogLevel(log2.Debug)
|
||||
}
|
||||
ci.TraceIfNot()
|
||||
sess := New(1)
|
||||
ss := sess.(*Session)
|
||||
s := codec.Encode(sess)
|
||||
@@ -25,7 +21,7 @@ func TestOnions_Session(t *testing.T) {
|
||||
if e := onc.Decode(s); fails(e) {
|
||||
t.Error("did not decode")
|
||||
t.FailNow()
|
||||
|
||||
|
||||
}
|
||||
var ci *Session
|
||||
var ok bool
|
||||
|
||||
@@ -2,17 +2,14 @@ package crypto
|
||||
|
||||
import (
|
||||
rand2 "crypto/rand"
|
||||
"git.indra-labs.org/dev/ind"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/ci"
|
||||
"testing"
|
||||
|
||||
|
||||
"git.indra-labs.org/dev/ind/pkg/crypto/sha256"
|
||||
log2 "git.indra-labs.org/dev/ind/pkg/proc/log"
|
||||
)
|
||||
|
||||
func TestFromBased32(t *testing.T) {
|
||||
if indra.CI == "false" {
|
||||
log2.SetLogLevel(log2.Trace)
|
||||
}
|
||||
ci.TraceIfNot()
|
||||
var rBytes sha256.Hash
|
||||
var n int
|
||||
var e error
|
||||
@@ -28,7 +25,7 @@ func TestFromBased32(t *testing.T) {
|
||||
if s, e = Sign(pr, rBytes); fails(e) {
|
||||
t.FailNow()
|
||||
}
|
||||
//fmt.Println("sig", s)
|
||||
// fmt.Println("sig", s)
|
||||
var sb SigBytes
|
||||
if sb, e = SigFromBased32(s.String()); fails(e) {
|
||||
t.FailNow()
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
package crypto
|
||||
|
||||
import (
|
||||
"git.indra-labs.org/dev/ind"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/ci"
|
||||
"testing"
|
||||
|
||||
log2 "git.indra-labs.org/dev/ind/pkg/proc/log"
|
||||
)
|
||||
|
||||
func TestBase32(t *testing.T) {
|
||||
if indra.CI == "false" {
|
||||
log2.SetLogLevel(log2.Debug)
|
||||
}
|
||||
ci.TraceIfNot()
|
||||
for i := 0; i < 10000; i++ {
|
||||
var k *Prv
|
||||
var e error
|
||||
@@ -21,7 +17,7 @@ func TestBase32(t *testing.T) {
|
||||
p := DerivePub(k)
|
||||
b32 := p.ToBased32()
|
||||
pr32 := k.ToBased32()
|
||||
//log.D.F("pub key: %d %s priv key: %d %s\n", len(b32), b32, len(pr32), pr32)
|
||||
// log.D.F("pub key: %d %s priv key: %d %s\n", len(b32), b32, len(pr32), pr32)
|
||||
var kk *Pub
|
||||
if kk, e = PubFromBased32(b32); fails(e) {
|
||||
t.Error(e)
|
||||
|
||||
@@ -7,31 +7,28 @@ import (
|
||||
"git.indra-labs.org/dev/ind/pkg/codec/onion/cores/confirmation"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec/onion/cores/response"
|
||||
"git.indra-labs.org/dev/ind/pkg/crypto/sha256"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/ci"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
||||
"git.indra-labs.org/dev/ind"
|
||||
"git.indra-labs.org/dev/ind/pkg/codec/ont"
|
||||
"git.indra-labs.org/dev/ind/pkg/engine"
|
||||
|
||||
|
||||
"git.indra-labs.org/dev/ind/pkg/util/slice"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/splice"
|
||||
|
||||
|
||||
"git.indra-labs.org/dev/ind/pkg/crypto/nonce"
|
||||
"git.indra-labs.org/dev/ind/pkg/engine/transport"
|
||||
|
||||
|
||||
"git.indra-labs.org/dev/ind/pkg/crypto"
|
||||
log2 "git.indra-labs.org/dev/ind/pkg/proc/log"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/tests"
|
||||
)
|
||||
|
||||
func TestDispatcher(t *testing.T) {
|
||||
t.Log(indra.CI)
|
||||
if indra.CI == "false" {
|
||||
log2.SetLogLevel(log2.Trace)
|
||||
log.D.Ln("debug")
|
||||
}
|
||||
ci.TraceIfNot()
|
||||
var e error
|
||||
var l1, l2 *transport.Listener
|
||||
_ = l2
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
///go:build failingtests
|
||||
// /go:build failingtests
|
||||
|
||||
package engine
|
||||
|
||||
//func TestEngine_Message(t *testing.T) {
|
||||
// if indra.CI == "false" {
|
||||
// log2.SetLogLevel(log2.Info)
|
||||
// }
|
||||
// func TestEngine_Message(t *testing.T) {
|
||||
// ci.TraceIfNot()
|
||||
// var clients []*Engine
|
||||
// var e error
|
||||
// const nCircuits = 10
|
||||
@@ -101,9 +99,7 @@ package engine
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
// if indra.CI == "false" {
|
||||
// log2.SetLogLevel(log2.Trace)
|
||||
// }
|
||||
// ci.TraceIfNot()
|
||||
// wg.Add(1)
|
||||
// counter.Inc()
|
||||
// svc := &services.Service{
|
||||
@@ -172,12 +168,10 @@ package engine
|
||||
// quit.Q()
|
||||
// cancel()
|
||||
// log.W.Ln("fin")
|
||||
//}
|
||||
// }
|
||||
|
||||
//func TestEngine_Route(t *testing.T) {
|
||||
// if indra.CI == "false" {
|
||||
// log2.SetLogLevel(log2.Debug)
|
||||
// }
|
||||
// func TestEngine_Route(t *testing.T) {
|
||||
// ci.TraceIfNot()
|
||||
// runtime.GOMAXPROCS(1)
|
||||
// var clients []*Engine
|
||||
// var e error
|
||||
@@ -293,9 +287,7 @@ package engine
|
||||
// })
|
||||
// wg.Wait()
|
||||
// time.Sleep(time.Second)
|
||||
// if indra.CI == "false" {
|
||||
// log2.SetLogLevel(log2.Debug)
|
||||
// }
|
||||
// ci.TraceIfNot()
|
||||
// wg.Add(1)
|
||||
// counter.Inc()
|
||||
// log.D.Ln("intro", ini.ID, ini.AddrPort.String(), ini.Key.ToBased32Abbreviated(),
|
||||
@@ -311,12 +303,10 @@ package engine
|
||||
// quit.Q()
|
||||
// cancel()
|
||||
// log.W.Ln("fin")
|
||||
//}
|
||||
// }
|
||||
|
||||
//func TestEngine_SendHiddenService(t *testing.T) {
|
||||
// if indra.CI == "false" {
|
||||
// log2.SetLogLevel(log2.Debug)
|
||||
// }
|
||||
// func TestEngine_SendHiddenService(t *testing.T) {
|
||||
// ci.TraceIfNot()
|
||||
// var clients []*Engine
|
||||
// var e error
|
||||
// const nCircuits = 10
|
||||
@@ -361,9 +351,7 @@ package engine
|
||||
// }
|
||||
// wg.Wait()
|
||||
// }
|
||||
// if indra.CI == "false" {
|
||||
// log2.SetLogLevel(log2.Debug)
|
||||
// }
|
||||
// ci.TraceIfNot()
|
||||
// var idPrv *crypto.Prv
|
||||
// if idPrv, e = crypto.GeneratePrvKey(); fails(e) {
|
||||
// return
|
||||
@@ -409,12 +397,10 @@ package engine
|
||||
// time.Sleep(time.Second)
|
||||
// quit.Q()
|
||||
// cancel()
|
||||
//}
|
||||
// }
|
||||
|
||||
//func TestDispatcher_Rekey(t *testing.T) {
|
||||
// if indra.CI == "false" {
|
||||
// log2.SetLogLevel(log2.Debug)
|
||||
// }
|
||||
// func TestDispatcher_Rekey(t *testing.T) {
|
||||
// ci.TraceIfNot()
|
||||
// var e error
|
||||
// var l1, l2 *transport.Listener
|
||||
// _ = l2
|
||||
@@ -512,12 +498,10 @@ package engine
|
||||
// if succ != countTo*3 {
|
||||
// t.Fatal("did not receive all messages correctly", succ, countTo*3)
|
||||
// }
|
||||
//}
|
||||
// }
|
||||
|
||||
//func TestClient_SendExit(t *testing.T) {
|
||||
// if indra.CI == "false" {
|
||||
// log2.SetLogLevel(log2.Debug)
|
||||
// }
|
||||
// func TestClient_SendExit(t *testing.T) {
|
||||
// ci.TraceIfNot()
|
||||
// var clients []*Engine
|
||||
// var e error
|
||||
// ctx, cancel := context.WithCancel(context.Background())
|
||||
@@ -557,7 +541,7 @@ package engine
|
||||
// quit.Q()
|
||||
// t.Error("Exit test failed")
|
||||
// }()
|
||||
//out:
|
||||
// out:
|
||||
// for i := 3; i < len(clients[0].Mgr().Sessions)-1; i++ {
|
||||
// wg.Add(1)
|
||||
// var msg slice.Bytes
|
||||
@@ -613,12 +597,10 @@ package engine
|
||||
// for _, v := range clients {
|
||||
// v.Shutdown()
|
||||
// }
|
||||
//}
|
||||
// }
|
||||
|
||||
//func TestClient_SendPing(t *testing.T) {
|
||||
// if indra.CI == "false" {
|
||||
// log2.SetLogLevel(log2.Debug)
|
||||
// }
|
||||
// func TestClient_SendPing(t *testing.T) {
|
||||
// ci.TraceIfNot()
|
||||
// var clients []*Engine
|
||||
// var e error
|
||||
// ctx, cancel := context.WithCancel(context.Background())
|
||||
@@ -642,7 +624,7 @@ package engine
|
||||
// quit.Q()
|
||||
// t.Error("SendPing test failed")
|
||||
// }()
|
||||
//out:
|
||||
// out:
|
||||
// for i := 3; i < len(clients[0].Mgr().Sessions)-1; i++ {
|
||||
// wg.Add(1)
|
||||
// var c sessions.Circuit
|
||||
@@ -666,12 +648,10 @@ package engine
|
||||
// for _, v := range clients {
|
||||
// v.Shutdown()
|
||||
// }
|
||||
//}
|
||||
// }
|
||||
|
||||
//func TestClient_SendSessionKeys(t *testing.T) {
|
||||
// if indra.CI == "false" {
|
||||
// log2.SetLogLevel(log2.Debug)
|
||||
// }
|
||||
// func TestClient_SendSessionKeys(t *testing.T) {
|
||||
// ci.TraceIfNot()
|
||||
// var clients []*Engine
|
||||
// var e error
|
||||
// ctx, cancel := context.WithCancel(context.Background())
|
||||
@@ -720,12 +700,10 @@ package engine
|
||||
// v.Shutdown()
|
||||
// }
|
||||
// cancel()
|
||||
//}
|
||||
// }
|
||||
|
||||
//func TestClient_SendGetBalance(t *testing.T) {
|
||||
// if indra.CI == "false" {
|
||||
// log2.SetLogLevel(log2.Trace)
|
||||
// }
|
||||
// func TestClient_SendGetBalance(t *testing.T) {
|
||||
// ci.TraceIfNot()
|
||||
// var clients []*Engine
|
||||
// var e error
|
||||
// ctx, cancel := context.WithCancel(context.Background())
|
||||
@@ -776,4 +754,4 @@ package engine
|
||||
// for _, v := range clients {
|
||||
// v.Shutdown()
|
||||
// }
|
||||
//}
|
||||
// }
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"git.indra-labs.org/dev/ind/pkg/crypto/nonce"
|
||||
"git.indra-labs.org/dev/ind/pkg/crypto/sha256"
|
||||
log2 "git.indra-labs.org/dev/ind/pkg/proc/log"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/ci"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/tests"
|
||||
"math/rand"
|
||||
"testing"
|
||||
@@ -40,7 +41,7 @@ func BenchmarkSplit(b *testing.B) {
|
||||
}
|
||||
_ = splitted
|
||||
}
|
||||
|
||||
|
||||
// Example benchmark results show about 10Mb/s/thread throughput
|
||||
// handling 64Kb messages.
|
||||
//
|
||||
@@ -75,9 +76,7 @@ func TestRemovePacket(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSplitJoin(t *testing.T) {
|
||||
if indra.CI == "false" {
|
||||
log2.SetLogLevel(log2.Debug)
|
||||
}
|
||||
ci.TraceIfNot()
|
||||
msgSize := 1 << 19
|
||||
segSize := 1382
|
||||
var e error
|
||||
@@ -137,9 +136,7 @@ func TestSplitJoin(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSplitJoinFEC(t *testing.T) {
|
||||
if indra.CI == "false" {
|
||||
log2.SetLogLevel(log2.Debug)
|
||||
}
|
||||
ci.TraceIfNot()
|
||||
msgSize := 1 << 18
|
||||
segSize := 1382
|
||||
var e error
|
||||
|
||||
@@ -2,8 +2,7 @@ package engine
|
||||
|
||||
import (
|
||||
"context"
|
||||
"git.indra-labs.org/dev/ind"
|
||||
log2 "git.indra-labs.org/dev/ind/pkg/proc/log"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/ci"
|
||||
"github.com/dgraph-io/badger/v3"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -14,11 +13,8 @@ func pauza() {
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
|
||||
//
|
||||
// func TestEngine_PeerStore(t *testing.T) {
|
||||
// if indra.CI == "false" {
|
||||
// log2.SetLogLevel(log2.Trace)
|
||||
// }
|
||||
// ci.TraceIfNot()
|
||||
// const nTotal = 10
|
||||
// var e error
|
||||
// var engines []*Engine
|
||||
@@ -94,9 +90,7 @@ func pauza() {
|
||||
// }
|
||||
|
||||
func TestEngine_PeerStoreDiscovery(t *testing.T) {
|
||||
if indra.CI == "false" {
|
||||
log2.SetLogLevel(log2.Trace)
|
||||
}
|
||||
ci.TraceIfNot()
|
||||
const nTotal = 10
|
||||
var (
|
||||
e error
|
||||
@@ -106,7 +100,7 @@ func TestEngine_PeerStoreDiscovery(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
if engines, cleanup, e = CreateAndStartMockEngines(nTotal, ctx,
|
||||
cancel); fails(e) {
|
||||
|
||||
|
||||
t.FailNow()
|
||||
}
|
||||
time.Sleep(time.Second * 3)
|
||||
@@ -117,9 +111,7 @@ func TestEngine_PeerStoreDiscovery(t *testing.T) {
|
||||
}
|
||||
}
|
||||
time.Sleep(time.Second * 3)
|
||||
if indra.CI == "false" {
|
||||
log2.SetLogLevel(log2.Debug)
|
||||
}
|
||||
ci.TraceIfNot()
|
||||
var ec int
|
||||
entryCount := &ec
|
||||
for _, v := range engines {
|
||||
@@ -153,9 +145,7 @@ func TestEngine_PeerStoreDiscovery(t *testing.T) {
|
||||
t.Log("nodes did not gossip completely to each other, only",
|
||||
*entryCount, "nodes ad sets counted, not the expected",
|
||||
nTotal)
|
||||
if indra.CI == "false" {
|
||||
t.FailNow()
|
||||
}
|
||||
ci.TraceIfNot()
|
||||
}
|
||||
cleanup()
|
||||
pauza()
|
||||
|
||||
@@ -3,21 +3,18 @@ package transport
|
||||
import (
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"git.indra-labs.org/dev/ind"
|
||||
"git.indra-labs.org/dev/ind/pkg/crypto/sha256"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/ci"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
||||
"git.indra-labs.org/dev/ind/pkg/crypto"
|
||||
log2 "git.indra-labs.org/dev/ind/pkg/proc/log"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/tests"
|
||||
)
|
||||
|
||||
func TestNewListener(t *testing.T) {
|
||||
if indra.CI == "false" {
|
||||
log2.SetLogLevel(log2.Trace)
|
||||
}
|
||||
ci.TraceIfNot()
|
||||
var e error
|
||||
var l1, l2 *Listener
|
||||
_ = l2
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"git.indra-labs.org/dev/ind"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/ci"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
|
||||
"git.indra-labs.org/dev/ind/pkg/proc/cmds"
|
||||
log2 "git.indra-labs.org/dev/ind/pkg/proc/log"
|
||||
)
|
||||
|
||||
func TestNew(t *testing.T) {
|
||||
if indra.CI == "false" {
|
||||
log2.SetLogLevel(log2.Debug)
|
||||
}
|
||||
|
||||
ci.TraceIfNot()
|
||||
args1 := "/random/path/to/server_binary --cafile ~/some/cafile --LC=cn node -addrindex --BD 48h30s"
|
||||
args1s := strings.Split(args1, " ")
|
||||
var a *App
|
||||
@@ -27,8 +23,8 @@ func TestNew(t *testing.T) {
|
||||
}
|
||||
if e = os.RemoveAll(a.Command.Configs["DataDir"].
|
||||
Expanded()); check(e) {
|
||||
|
||||
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
package cmds
|
||||
|
||||
import (
|
||||
"git.indra-labs.org/dev/ind"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/ci"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
log2 "git.indra-labs.org/dev/ind/pkg/proc/log"
|
||||
)
|
||||
|
||||
func TestCommand_ParseCLIArgs(t *testing.T) {
|
||||
if indra.CI == "false" {
|
||||
log2.SetLogLevel(log2.Debug)
|
||||
}
|
||||
ci.TraceIfNot()
|
||||
ec := GetExampleCommands()
|
||||
o, _ := Init(ec, nil)
|
||||
args6 := "/random/path/to/server_binary --cafile ~/some/cafile --LC=cn " +
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package i32
|
||||
|
||||
import (
|
||||
indra "git.indra-labs.org/dev/ind"
|
||||
log2 "git.indra-labs.org/dev/ind/pkg/proc/log"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/ci"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -12,9 +12,7 @@ var (
|
||||
)
|
||||
|
||||
func TestS(t *testing.T) {
|
||||
if indra.CI == "false" {
|
||||
log2.SetLogLevel(log2.Trace)
|
||||
}
|
||||
ci.TraceIfNot()
|
||||
|
||||
t1, t2 := New(), New()
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package t64
|
||||
|
||||
import (
|
||||
indra "git.indra-labs.org/dev/ind"
|
||||
log2 "git.indra-labs.org/dev/ind/pkg/proc/log"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/ci"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
@@ -13,9 +13,7 @@ var (
|
||||
)
|
||||
|
||||
func TestNew(t *testing.T) {
|
||||
if indra.CI == "false" {
|
||||
log2.SetLogLevel(log2.Trace)
|
||||
}
|
||||
ci.TraceIfNot()
|
||||
|
||||
t1, t2 := New(), New()
|
||||
nao := time.Now()
|
||||
|
||||
@@ -5,9 +5,10 @@ import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"git.indra-labs.org/dev/ind"
|
||||
"git.indra-labs.org/dev/ind/pkg/util/ci"
|
||||
"math/rand"
|
||||
"testing"
|
||||
|
||||
|
||||
"git.indra-labs.org/dev/ind/pkg/crypto/sha256"
|
||||
)
|
||||
|
||||
@@ -17,7 +18,7 @@ const (
|
||||
)
|
||||
|
||||
func TestCodec(t *testing.T) {
|
||||
|
||||
|
||||
// Generate 10 pseudorandom 64 bit values. We do this here rather than
|
||||
// pre-generating this separately as ultimately it is the same thing, the
|
||||
// same seed produces the same series of pseudorandom values, and the hashes
|
||||
@@ -25,38 +26,36 @@ func TestCodec(t *testing.T) {
|
||||
rand.Seed(seed)
|
||||
seeds := make([]uint64, numKeys)
|
||||
for i := range seeds {
|
||||
|
||||
|
||||
seeds[i] = rand.Uint64()
|
||||
}
|
||||
|
||||
|
||||
// Convert the uint64 values to 8 byte long slices for the hash function.
|
||||
seedBytes := make([][]byte, numKeys)
|
||||
for i := range seedBytes {
|
||||
|
||||
|
||||
seedBytes[i] = make([]byte, 8)
|
||||
binary.LittleEndian.PutUint64(seedBytes[i], seeds[i])
|
||||
}
|
||||
|
||||
|
||||
// Generate hashes from the seeds
|
||||
hashedSeeds := make([][]byte, numKeys)
|
||||
|
||||
|
||||
// Uncomment lines relating to this variable to regenerate expected data
|
||||
// that will log to console during test run.
|
||||
generated := "\nexpected := []string{\n"
|
||||
|
||||
|
||||
for i := range hashedSeeds {
|
||||
|
||||
|
||||
hashed := sha256.Single(seedBytes[i])
|
||||
hashedSeeds[i] = hashed[:]
|
||||
|
||||
|
||||
generated += fmt.Sprintf("\t\"%x\",\n", hashedSeeds[i])
|
||||
}
|
||||
|
||||
|
||||
generated += "}\n"
|
||||
if indra.CI == "false" {
|
||||
t.Log(generated)
|
||||
}
|
||||
|
||||
ci.TraceIfNot()
|
||||
|
||||
expected := []string{
|
||||
"ee94d6cef460b180c995b2f8672e53006aced15fe4d5cc0da332d041feaa1514",
|
||||
"0f92907a4d76ece96b042e2cbd60e2378039cc92c95ac99f73e8eacbdd38a7d3",
|
||||
@@ -91,11 +90,11 @@ func TestCodec(t *testing.T) {
|
||||
"12b40270e989ddc550f74a2a66f6092903fe0ec075df2826148fa9080aa933b3",
|
||||
"4db6259bb154e007bfe5be06a641bb3a797b4deaa9447d2f6d4deeed3f6ad07a",
|
||||
}
|
||||
|
||||
|
||||
for i := range hashedSeeds {
|
||||
|
||||
|
||||
if expected[i] != hex.EncodeToString(hashedSeeds[i]) {
|
||||
|
||||
|
||||
t.Log("failed", i, "expected", expected[1], "found", hashedSeeds)
|
||||
t.FailNow()
|
||||
}
|
||||
@@ -134,12 +133,12 @@ func TestCodec(t *testing.T) {
|
||||
"aijliatq6ge63rkq76fcuzxwbeuqh9qoyb267kbgcsh2scakvez3g3n",
|
||||
"ang3mjm3wfkoab694w9anjsbxm6hs72n6kuui9jpnvg763j9nlicwbv",
|
||||
}
|
||||
|
||||
|
||||
encoded := "\nencodedStr := []string{\n"
|
||||
|
||||
|
||||
// Convert hashes to our base32 encoding format
|
||||
for i := range hashedSeeds {
|
||||
|
||||
|
||||
// Note that we are slicing off a number of bytes at the end according
|
||||
// to the sequence number to get different check byte lengths from a
|
||||
// uniform original data. As such, this will be accounted for in the
|
||||
@@ -157,18 +156,18 @@ func TestCodec(t *testing.T) {
|
||||
}
|
||||
encoded += "\t\"" + encode + "\",\n"
|
||||
}
|
||||
|
||||
|
||||
encoded += "}\n"
|
||||
if indra.CI == "false" {
|
||||
t.Log(encoded)
|
||||
}
|
||||
|
||||
|
||||
// Next, decode the encodedStr above, which should be the output of the
|
||||
// original generated seeds, with the index mod 5 truncations performed on
|
||||
// each as was done to generate them.
|
||||
|
||||
|
||||
for i := range encodedStr {
|
||||
|
||||
|
||||
res, err := Codec.Decode(encodedStr[i])
|
||||
if err != nil {
|
||||
t.Fatalf("error: '%v'", err)
|
||||
|
||||
12
pkg/util/ci/trace.go
Normal file
12
pkg/util/ci/trace.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package ci
|
||||
|
||||
import (
|
||||
indra "git.indra-labs.org/dev/ind"
|
||||
log2 "git.indra-labs.org/dev/ind/pkg/proc/log"
|
||||
)
|
||||
|
||||
func TraceIfNot() {
|
||||
if indra.CI == "false" {
|
||||
log2.SetLogLevel(log2.Trace)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user