package release import ( "context" "encoding/json" "testing" ) func TestSidecarWakeCarriesExactIdentity(t *testing.T) { ctx := context.Background() s := NewDirStore(t.TempDir()) id := SidecarWakeIdentity{AppID: "app-id", Incarnation: "old-incarnation", RequestID: "wake-request"} if err := TouchSidecarWake(ctx, s, "acct", "app", "bot", "operator", "wake", id); err != nil { t.Fatal(err) } raw, _, err := s.Get(ctx, SidecarWakeKey("acct", "app", "bot")) if err != nil { t.Fatal(err) } var got SidecarWake if err = json.Unmarshal(raw, &got); err != nil { t.Fatal(err) } if got.AppID != id.AppID || got.Incarnation != id.Incarnation || got.RequestID != id.RequestID { t.Fatalf("identity lost: %+v", got) } if err = TouchSidecarWake(ctx, s, "acct", "app", "bot", "operator", "wake", SidecarWakeIdentity{AppID: "incomplete"}); err == nil { t.Fatal("accepted partial identity") } }