Initial project snapshot
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package relay
|
||||
|
||||
import "errors"
|
||||
|
||||
var ErrProductionForwardingDisabled = errors.New("relay skeleton does not forward production payloads before an approved production mesh stage")
|
||||
|
||||
type Skeleton struct {
|
||||
ClusterID string
|
||||
NodeID string
|
||||
}
|
||||
|
||||
func (s Skeleton) AcceptControlConnection() bool {
|
||||
return s.ClusterID != "" && s.NodeID != ""
|
||||
}
|
||||
|
||||
func (s Skeleton) ForwardProductionPayload([]byte) error {
|
||||
return ErrProductionForwardingDisabled
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package relay
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRelaySkeletonAcceptsControlButNotPayloadForwarding(t *testing.T) {
|
||||
relay := Skeleton{ClusterID: "cluster-1", NodeID: "node-relay"}
|
||||
if !relay.AcceptControlConnection() {
|
||||
t.Fatal("relay skeleton should accept control connection metadata")
|
||||
}
|
||||
if err := relay.ForwardProductionPayload([]byte("rdp")); !errors.Is(err, ErrProductionForwardingDisabled) {
|
||||
t.Fatalf("err = %v, want ErrProductionForwardingDisabled", err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user