github.com/ethereumproject/go-ethereum@v5.5.2+incompatible/common/version_test.go (about) 1 package common 2 3 import ( 4 "testing" 5 ) 6 7 func TestClientSessionIdentityIsNotNilOnInit(t *testing.T) { 8 if v := GetClientSessionIdentity(); v == nil { 9 t.Error("Expected not-nil client session identity") 10 } else { 11 t.Log(v) 12 } 13 14 } 15 16 func TestSessionIDIsExpected(t *testing.T) { 17 if v := SessionID; v == "" || len(v) != 4 { 18 t.Errorf("got: %v, want: randomstring", v) 19 } 20 } 21 22 func TestSessionVersionInformation(t *testing.T) { 23 v := GetClientSessionIdentity() 24 if v == nil { 25 t.Error("Expected not-nil client session identity") 26 } 27 28 if v.Version != "unknown" { 29 t.Errorf("Version: expected 'unknown', got '%v'", v.Version) 30 } 31 32 version := "9.8.7-test" 33 SetClientVersion(version) 34 v = GetClientSessionIdentity() 35 36 if v.Version != version { 37 t.Errorf("Version: expected '%s', got '%s'", version, v.Version) 38 } 39 }