mirror of
https://github.com/hanzo-fi/go-libs.git
synced 2026-10-30 20:53:44 +00:00
26 lines
630 B
Go
26 lines
630 B
Go
package testservice
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/hanzo-fi/go-libs/v5/pkg/messaging/publish"
|
|
"github.com/hanzo-fi/go-libs/v5/pkg/testing/deferred"
|
|
)
|
|
|
|
func NatsInstrumentation(url *deferred.Deferred[string]) Instrumentation {
|
|
return InstrumentationFunc(func(ctx context.Context, runConfiguration *RunConfiguration) error {
|
|
url, err := url.Wait(ctx)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
runConfiguration.AppendArgs(
|
|
"--"+publish.PublisherNatsEnabledFlag,
|
|
"--"+publish.PublisherNatsURLFlag, url,
|
|
"--"+publish.PublisherTopicMappingFlag, fmt.Sprintf("*:%s", runConfiguration.GetID()),
|
|
)
|
|
|
|
return nil
|
|
})
|
|
}
|