|
@@ -9,6 +9,7 @@ import (
|
|
|
"testing"
|
|
"testing"
|
|
|
"time"
|
|
"time"
|
|
|
|
|
|
|
|
|
|
+ "gitp78su.ipnodns.ru/svi/kern/v4/lev0/defs"
|
|
|
. "gitp78su.ipnodns.ru/svi/kern/v4/lev1"
|
|
. "gitp78su.ipnodns.ru/svi/kern/v4/lev1"
|
|
|
"gitp78su.ipnodns.ru/svi/kern/v4/lev2/kctx"
|
|
"gitp78su.ipnodns.ru/svi/kern/v4/lev2/kctx"
|
|
|
"gitp78su.ipnodns.ru/svi/kern/v4/lev2/kserv_http"
|
|
"gitp78su.ipnodns.ru/svi/kern/v4/lev2/kserv_http"
|
|
@@ -41,7 +42,7 @@ func TestKernelBusHttp(t *testing.T) {
|
|
|
handServ: mock_hand_serve.NewMockHandlerServe(qNameServ, "name_serv"),
|
|
handServ: mock_hand_serve.NewMockHandlerServe(qNameServ, "name_serv"),
|
|
|
}
|
|
}
|
|
|
ctx := kctx.GetKernelCtx()
|
|
ctx := kctx.GetKernelCtx()
|
|
|
- ctx.Set("monolitName", "test_monolit", "comment")
|
|
|
|
|
|
|
+ ctx.Set(defs.Txt("monolitName"), "test_monolit", "comment")
|
|
|
sf.get()
|
|
sf.get()
|
|
|
sf.req()
|
|
sf.req()
|
|
|
sf.sub()
|
|
sf.sub()
|
|
@@ -67,7 +68,7 @@ func (sf *tester) unsubGood2() {
|
|
|
}
|
|
}
|
|
|
req := &dot.UnsubReq{
|
|
req := &dot.UnsubReq{
|
|
|
HandlerName_: sf.handSub.Name().Get(),
|
|
HandlerName_: sf.handSub.Name().Get(),
|
|
|
- Uuid_: test_uuid,
|
|
|
|
|
|
|
+ Uuid_: defs.Txt(test_uuid),
|
|
|
}
|
|
}
|
|
|
binReq, _ := json.MarshalIndent(req, "", " ")
|
|
binReq, _ := json.MarshalIndent(req, "", " ")
|
|
|
body := strings.NewReader(string(binReq))
|
|
body := strings.NewReader(string(binReq))
|
|
@@ -95,7 +96,7 @@ func (sf *tester) unsubGood2() {
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
sf.t.Fatalf("unsubGood2(): err=%v", err)
|
|
sf.t.Fatalf("unsubGood2(): err=%v", err)
|
|
|
}
|
|
}
|
|
|
- if resp.Status_ != "ok" {
|
|
|
|
|
|
|
+ if resp.Status_.Get() != "ok" {
|
|
|
sf.t.Fatalf("unsubGood2(): resp(%v)!='ok'", resp.Status_)
|
|
sf.t.Fatalf("unsubGood2(): resp(%v)!='ok'", resp.Status_)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -138,10 +139,10 @@ func (sf *tester) unsubGood1() {
|
|
|
}
|
|
}
|
|
|
req := &dot.UnsubReq{
|
|
req := &dot.UnsubReq{
|
|
|
HandlerName_: sf.handSub.Name().Get(),
|
|
HandlerName_: sf.handSub.Name().Get(),
|
|
|
- Uuid_: test_uuid,
|
|
|
|
|
|
|
+ Uuid_: defs.Txt(test_uuid),
|
|
|
}
|
|
}
|
|
|
resp := Bus_.processUnsubRequest(req)
|
|
resp := Bus_.processUnsubRequest(req)
|
|
|
- if resp.Status_ != "ok" {
|
|
|
|
|
|
|
+ if resp.Status_.Get() != "ok" {
|
|
|
sf.t.Fatalf("unsubGood1(): status(%v)!='ok'", resp.Status_)
|
|
sf.t.Fatalf("unsubGood1(): status(%v)!='ok'", resp.Status_)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -157,10 +158,10 @@ func (sf *tester) unsubBad2() {
|
|
|
}
|
|
}
|
|
|
req := &dot.UnsubReq{
|
|
req := &dot.UnsubReq{
|
|
|
HandlerName_: sf.handSub.Name().Get(),
|
|
HandlerName_: sf.handSub.Name().Get(),
|
|
|
- Uuid_: test_uuid,
|
|
|
|
|
|
|
+ Uuid_: defs.Txt(test_uuid),
|
|
|
}
|
|
}
|
|
|
resp := Bus_.processUnsubRequest(req)
|
|
resp := Bus_.processUnsubRequest(req)
|
|
|
- if resp.Status_ == "ok" {
|
|
|
|
|
|
|
+ if resp.Status_.Get() == "ok" {
|
|
|
sf.t.Fatalf("unsubBad2(): status(%v)=='ok'", resp.Status_)
|
|
sf.t.Fatalf("unsubBad2(): status(%v)=='ok'", resp.Status_)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -450,7 +451,7 @@ func (sf *tester) reqBad4() {
|
|
|
defer sf.handServ.IsBad_.Reset()
|
|
defer sf.handServ.IsBad_.Reset()
|
|
|
req := &dot.ServeReq{
|
|
req := &dot.ServeReq{
|
|
|
Topic_: sf.handServ.Topic().Get(),
|
|
Topic_: sf.handServ.Topic().Get(),
|
|
|
- Uuid_: test_uuid,
|
|
|
|
|
|
|
+ Uuid_: defs.Txt(test_uuid),
|
|
|
BinReq_: []byte("test_msg"),
|
|
BinReq_: []byte("test_msg"),
|
|
|
}
|
|
}
|
|
|
binReq, _ := json.MarshalIndent(req, "", " ")
|
|
binReq, _ := json.MarshalIndent(req, "", " ")
|
|
@@ -478,7 +479,7 @@ func (sf *tester) reqBad4() {
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
sf.t.Fatalf("reqBad4(): err=%v", err)
|
|
sf.t.Fatalf("reqBad4(): err=%v", err)
|
|
|
}
|
|
}
|
|
|
- if resp.Status_ == "ok" {
|
|
|
|
|
|
|
+ if resp.Status_.Get() == "ok" {
|
|
|
sf.t.Fatalf("reqBad4(): status(%v)=='ok'", resp.Status_)
|
|
sf.t.Fatalf("reqBad4(): status(%v)=='ok'", resp.Status_)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -487,7 +488,7 @@ func (sf *tester) reqGood1() {
|
|
|
sf.t.Log("reqGood1")
|
|
sf.t.Log("reqGood1")
|
|
|
req := &dot.ServeReq{
|
|
req := &dot.ServeReq{
|
|
|
Topic_: sf.handServ.Topic().Get(),
|
|
Topic_: sf.handServ.Topic().Get(),
|
|
|
- Uuid_: test_uuid,
|
|
|
|
|
|
|
+ Uuid_: defs.Txt(test_uuid),
|
|
|
BinReq_: []byte("test_msg"),
|
|
BinReq_: []byte("test_msg"),
|
|
|
}
|
|
}
|
|
|
binReq, _ := json.MarshalIndent(req, "", " ")
|
|
binReq, _ := json.MarshalIndent(req, "", " ")
|
|
@@ -529,7 +530,7 @@ func (sf *tester) reqBad3() {
|
|
|
sf.t.Log("reqBad3")
|
|
sf.t.Log("reqBad3")
|
|
|
req := &dot.ServeReq{
|
|
req := &dot.ServeReq{
|
|
|
Topic_: qNameBad.Get(),
|
|
Topic_: qNameBad.Get(),
|
|
|
- Uuid_: test_uuid,
|
|
|
|
|
|
|
+ Uuid_: defs.Txt(test_uuid),
|
|
|
BinReq_: []byte("test_msg"),
|
|
BinReq_: []byte("test_msg"),
|
|
|
}
|
|
}
|
|
|
binReq, _ := json.MarshalIndent(req, "", " ")
|
|
binReq, _ := json.MarshalIndent(req, "", " ")
|
|
@@ -596,5 +597,5 @@ func (sf *tester) get() {
|
|
|
sf.t.Fatalf("get(): bus==nil")
|
|
sf.t.Fatalf("get(): bus==nil")
|
|
|
}
|
|
}
|
|
|
_ = GetKernelBusHttp()
|
|
_ = GetKernelBusHttp()
|
|
|
- Bus_.RegisterServe(sf.handServ).Hassert("get()")
|
|
|
|
|
|
|
+ Bus_.RegisterServe(sf.handServ).Hassert(defs.Txt("get()"))
|
|
|
}
|
|
}
|