Skip to content

Commit

Permalink
Stop log stream in PreStop container hook
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszcl committed Nov 20, 2024
1 parent 062097e commit e6edf4a
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions integration-tests/docker/test_env/cl_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ func NewClNode(networks []string, imageName, imageVersion string, nodeConfig *ch
PostgresDb: pgDb,
l: log.Logger,
}
n.SetDefaultHooks()
for _, opt := range opts {
opt(n)
}
Expand Down Expand Up @@ -493,7 +492,22 @@ func (n *ClNode) getContainerRequest(secrets string) (
},
LifecycleHooks: []tc.ContainerLifecycleHooks{
{
PostStarts: n.PostStartsHooks,
PostStarts: []tc.ContainerHook{
func(ctx context.Context, c tc.Container) error {
if n.LogStream != nil {
return n.LogStream.ConnectContainer(ctx, c, "")
}
return nil
},
},
PreStops: []tc.ContainerHook{
func(ctx context.Context, c tc.Container) error {
if n.LogStream != nil {
return n.LogStream.DisconnectContainer(c)
}
return nil
},
},
PostStops: n.PostStopsHooks,
PreTerminates: n.PreTerminatesHooks,
},
Expand Down

0 comments on commit e6edf4a

Please sign in to comment.