Skip to content

Commit

Permalink
Merge pull request #529 from iamemilio/cleanup_3.17.0
Browse files Browse the repository at this point in the history
clean up some style issues and exported functions that should be private
  • Loading branch information
iamemilio committed Jun 29, 2022
2 parents ea1dcf9 + 0fd76e6 commit b136918
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions v3/internal/integrationsupport/integrationsupport.go
Expand Up @@ -93,6 +93,7 @@ var DTEnabledCfgFn = func(cfg *newrelic.Config) {
cfg.DistributedTracer.Enabled = true
}

// AppLogEnabledCfgFn enables application logging features
var AppLogEnabledCfgFn = func(cfg *newrelic.Config) {
cfg.Enabled = false
cfg.ApplicationLogging.Enabled = true
Expand Down
1 change: 1 addition & 0 deletions v3/internal/jsonx/encode.go
Expand Up @@ -118,6 +118,7 @@ func AppendFloat(buf *bytes.Buffer, x float64) error {
return nil
}

// AppendFloat32 appends a numeric literal representingthe value to buf.
func AppendFloat32(buf *bytes.Buffer, x float32) error {
var scratch [64]byte
x64 := float64(x)
Expand Down
20 changes: 10 additions & 10 deletions v3/newrelic/internal_app_test.go
Expand Up @@ -78,14 +78,14 @@ const (
SampleAppName = "my app"
)

// ExpectApp combines Application and Expect, for use in validating data in test apps
type ExpectApp struct {
// expectApp combines Application and Expect, for use in validating data in test apps
type expectApplication struct {
internal.Expect
*Application
}

// NewTestApp creates an ExpectApp with the given ConnectReply function and Config function
func NewTestApp(replyfn func(*internal.ConnectReply), cfgFn ...ConfigOption) ExpectApp {
// newTestApp creates an ExpectApp with the given ConnectReply function and Config function
func newTestApp(replyfn func(*internal.ConnectReply), cfgFn ...ConfigOption) expectApplication {
cfgFn = append(cfgFn,
func(cfg *Config) {
// Prevent spawning app goroutines in tests.
Expand All @@ -104,27 +104,27 @@ func NewTestApp(replyfn func(*internal.ConnectReply), cfgFn ...ConfigOption) Exp

internal.HarvestTesting(app.Private, replyfn)

return ExpectApp{
return expectApplication{
Expect: app.Private.(internal.Expect),
Application: app,
}
}

var SampleEverythingReplyFn = func(reply *internal.ConnectReply) {
var sampleEverythingReplyFn = func(reply *internal.ConnectReply) {
reply.SetSampleEverything()
}

var ConfigTestAppLogFn = func(cfg *Config) {
var configTestAppLogFn = func(cfg *Config) {
cfg.Enabled = false
cfg.ApplicationLogging.Enabled = true
cfg.ApplicationLogging.Forwarding.Enabled = true
cfg.ApplicationLogging.Metrics.Enabled = true
}

func TestRecordLog(t *testing.T) {
testApp := NewTestApp(
SampleEverythingReplyFn,
ConfigTestAppLogFn,
testApp := newTestApp(
sampleEverythingReplyFn,
configTestAppLogFn,
)

time := int64(timeToUnixMilliseconds(time.Now()))
Expand Down

0 comments on commit b136918

Please sign in to comment.