mirror of https://github.com/databricks/cli.git
20 lines
514 B
Go
20 lines
514 B
Go
package root
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/databricks/cli/libs/command"
|
|
"github.com/databricks/databricks-sdk-go/useragent"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestWithCommandExecIdInUserAgent(t *testing.T) {
|
|
ctx := command.GenerateExecId(context.Background())
|
|
ctx = withCommandExecIdInUserAgent(ctx)
|
|
|
|
// user agent should contain cmd-exec-id/<UUID>
|
|
ua := useragent.FromContext(ctx)
|
|
assert.Regexp(t, `cmd-exec-id/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}`, ua)
|
|
}
|