func TestSharedDBEvent(t *testing.T) {
	bld := libhoney.NewBuilder()
	query := "this is sql really promise"
	var ev *libhoney.Event
	func() { ev = sharedDBEvent(bld, query) }()
	assert.Equal(t, "db", ev.Fields()["name"], "being called with a non-database call returns default 'db'")
	assert.Equal(t, "", ev.Fields()["db.call"], "being called with a non-database call does not set db.call")
	assert.Equal(t, "TestSharedDBEvent", ev.Fields()["db.caller"], "caller should still be TestSharedDBEvent even if no DB call was found")
	o := objForDBCalls{}
	ev = o.ExecContext(bld, query)
	assert.Equal(t, "ExecContext", ev.Fields()["name"], "being called with a db-specific call returns that string")
	assert.Equal(t, "ExecContext", ev.Fields()["db.call"], "being called with a db-specific call returns that string")
	assert.Equal(t, "TestSharedDBEvent", ev.Fields()["db.caller"], "caller should be this test function")
}
TestSharedDBEvent verifies that the name field is set to something
package common
import (
	"context"
	"database/sql"
	"io"
	"net/http"
	"net/http/httptest"
	"net/url"
	"testing"
	libhoney "github.com/honeycombio/libhoney-go"
	"github.com/stretchr/testify/assert"
)
func TestHostHeader(t *testing.T) {
	req := httptest.NewRequest("GET", "/", nil)
	req.Host = "beecom.com"
	props := GetRequestProps(req)
	assert.Equal(t, "beecom.com", props["request.host"])
}
func TestNoHostHeader(t *testing.T) {
	req := httptest.NewRequest("GET", "/", nil)
	props := GetRequestProps(req)
	assert.Equal(t, "example.com", props["request.host"])
}
func TestURLHostHeader(t *testing.T) {
	req := httptest.NewRequest("GET", "https://doorcom.com/", nil)
	props := GetRequestProps(req)
	assert.Equal(t, "doorcom.com", props["request.host"])
}
func TestClientReqHostAfterRedirect(t *testing.T) {
	u, err := url.Parse("http://example.com/")
	assert.NoError(t, err)
	req := &http.Request{
		Method: "GET",
		URL:    u,
		Header: make(http.Header),
	}
	assert.Equal(t, "", req.Host)
	props := GetRequestProps(req)
	assert.Equal(t, "example.com", props["request.host"])
}
func TestUserAgentHeader(t *testing.T) {
	userAgent := "Lynx"
	req := httptest.NewRequest("GET", "https://unused.com/", nil)
	req.Header.Set("User-Agent", userAgent)
	props := GetRequestProps(req)
	assert.Equal(t, userAgent, props["request.header.user_agent"])
}
func TestXForwardedForHeader(t *testing.T) {
	xForwardedFor := "1.2.3.4"
	req := httptest.NewRequest("GET", "https://unused.com/", nil)
	req.Header.Set("X-Forwarded-For", xForwardedFor)
	props := GetRequestProps(req)
	assert.Equal(t, xForwardedFor, props["request.header.x_forwarded_for"])
}
func TestXForwardedProtoHeader(t *testing.T) {
	xForwardedProto := "https"
	req := httptest.NewRequest("GET", "https://unused.com/", nil)
	req.Header.Set("X-Forwarded-Proto", xForwardedProto)
	props := GetRequestProps(req)
	assert.Equal(t, xForwardedProto, props["request.header.x_forwarded_proto"])
}
type objForDBCalls struct{}
func (objForDBCalls) ExecContext(bld *libhoney.Builder, query string) *libhoney.Event {
	return sharedDBEvent(bld, query)
}