carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1package host
2
3import (
4 "github.com/carlosframework/platform/internal/hostclaim"
5 "testing"
6)
7
8func TestPlan11RootLaunchRequiresThisBoxAdmittedAsWriter(t *testing.T) {
9 for _, kind := range []string{hostclaim.KindLanding, hostclaim.KindRelocating} {
10 t.Run(kind, func(t *testing.T) {
11 f := newLaunchFixture(t, hostclaim.Op{ID: "operation", Kind: kind, Phase: "probing", Exec: "box-1", Journal: map[string]string{"install_stamp": "11"}})
12 f.claims.set(func(c *hostclaim.Claim) { c.Holder.WriterBox = "source-box" })
13 if _, err := f.root.Serve(t.Context(), f.peer, f.req); err == nil {
14 t.Fatal("root launched before the executor admitted its writer session")
15 }
16 if starts, _ := f.units.counts(); starts != 0 {
17 t.Fatal("refused writer caused a unit start")
18 }
19 f.claims.set(func(c *hostclaim.Claim) { c.Holder.WriterBox = "box-1" })
20 if _, err := f.root.Serve(t.Context(), f.peer, f.req); err != nil {
21 t.Fatalf("admitted executor refused: %v", err)
22 }
23 })
24 }
25}
26