package runtime import ( "encoding/json" "strings" "testing" "git.novox.be/novox/mesh-sdk/go/buscalls" "git.novox.be/novox/mesh-sdk/go/stateobjects" ) // Design 47 G §69, §62, §407: only a bundle's runtime channel holds the cap, so the runtime call refuses a sent object over // it before the bus is asked, where the console (which reads through the bus) reads it whole. func TestARuntimeCallRefusesASentObjectOverTheBundleChannel(t *testing.T) { params, _ := json.Marshal(buscalls.ObjectsSentGetRequest{Store: "m_sent-objects", Object: "o", Size: int64(stateobjects.BundleObjectMost) + 1, Digest: strings.Repeat("a", 64)}) _, err := (&moduleBus{all: &consumers{}}).BusState(buscalls.ObjectsSentGet, params) if err == nil || !strings.Contains(err.Error(), "not read through a bundle") { t.Fatalf("a sent object over the channel was answered %v", err) } }