Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripttest: Pass testing.TB to newEngine #21

Merged
merged 1 commit into from
Oct 21, 2024

Commits on Oct 11, 2024

  1. scripttest: Pass testing.TB to newEngine

    To allow cleaning up resources after the test terminates,
    pass the testing.TB to the newEngine function.
    
    This is needed to be able to stop the hive in a test:
    
      scripttest.Test(...,
        func(t testing.TB) *script.Engine {
          h := hive.New(Thing)
          require.NoError(t, h.Start(...))
          t.Cleanup(func() {
           assert.NoError(t, h.Stop(...))
          })
          return &script.Engine{...}
        }, ...)
    
    Signed-off-by: Jussi Maki <[email protected]>
    joamaki committed Oct 11, 2024
    Configuration menu
    Copy the full SHA
    86563d6 View commit details
    Browse the repository at this point in the history