Skip to content

Commit

Permalink
Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Whelan committed Nov 24, 2020
1 parent a33231d commit f3e213c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions telemetry/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ func (c *Client) SendTelemetry(invokedFunctionARN string, telemetry [][]byte) er
logEvents = append(logEvents, logEvent)
}

if len(c.functionName) == 0 {
if len(c.functionName) == 0 {
nameStart := strings.Index(invokedFunctionARN, ":function:") + len(":function:")
nameLen := strings.Index(invokedFunctionARN[nameStart:], ":")
if nameLen < 0 {
nameLen = len(invokedFunctionARN) - nameStart
}
c.functionName = invokedFunctionARN[nameStart:nameStart+nameLen]
c.functionName = invokedFunctionARN[nameStart : nameStart+nameLen]
util.Debugf("Recovered missing function name: %s", c.functionName)
}

Expand Down
2 changes: 1 addition & 1 deletion telemetry/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestClientSend(t *testing.T) {
client := NewWithHTTPClient(srv.Client(), "", "a mock license key", &srv.URL)

bytes := []byte("foobar")
err := client.SendTelemetry("fakeArn", [][]byte{bytes})
err := client.SendTelemetry("arn:aws:lambda:us-east-1:1234:function:newrelic-example-go", [][]byte{bytes})

assert.NoError(t, err)
}

0 comments on commit f3e213c

Please sign in to comment.