Skip to content

Commit 19cf028

Browse files
committed
Fix test engine root component constraint
1 parent ea21b9b commit 19cf028

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

chasm/chasmtest/test_engine.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ import (
1818
)
1919

2020
type (
21-
Option[T chasm.Component] func(*Engine[T])
21+
Option[T chasm.RootComponent] func(*Engine[T])
2222

23-
Engine[T chasm.Component] struct {
23+
Engine[T chasm.RootComponent] struct {
2424
t *testing.T
2525
registry *chasm.Registry
2626
logger log.Logger
@@ -46,7 +46,7 @@ type (
4646
}
4747
)
4848

49-
func NewEngine[T chasm.Component](
49+
func NewEngine[T chasm.RootComponent](
5050
t *testing.T,
5151
registry *chasm.Registry,
5252
opts ...Option[T],
@@ -73,7 +73,7 @@ func NewEngine[T chasm.Component](
7373
return e
7474
}
7575

76-
func WithRoot[T chasm.Component](
76+
func WithRoot[T chasm.RootComponent](
7777
factory func(chasm.MutableContext) T,
7878
) Option[T] {
7979
return func(e *Engine[T]) {
@@ -90,7 +90,7 @@ func WithRoot[T chasm.Component](
9090
}
9191
}
9292

93-
func WithExecutionKey[T chasm.Component](key chasm.ExecutionKey) Option[T] {
93+
func WithExecutionKey[T chasm.RootComponent](key chasm.ExecutionKey) Option[T] {
9494
return func(e *Engine[T]) {
9595
e.rootExecutionKey = key
9696
}

chasm/lib/callback/tasks_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,17 @@ func (m *mockNexusCompletionGetterComponent) LifecycleState(_ chasm.Context) cha
5555
return chasm.LifecycleStateRunning
5656
}
5757

58+
func (m *mockNexusCompletionGetterComponent) ContextMetadata(chasm.Context) map[string]string {
59+
return nil
60+
}
61+
62+
func (m *mockNexusCompletionGetterComponent) Terminate(
63+
chasm.MutableContext,
64+
chasm.TerminateComponentRequest,
65+
) (chasm.TerminateComponentResponse, error) {
66+
return chasm.TerminateComponentResponse{}, nil
67+
}
68+
5869
type mockNexusCompletionGetterLibrary struct {
5970
chasm.UnimplementedLibrary
6071
}

0 commit comments

Comments
 (0)