github.com/newrelic/go-agent@v3.26.0+incompatible/internal_app_test.go (about)

     1  // Copyright 2020 New Relic Corporation. All rights reserved.
     2  // SPDX-License-Identifier: Apache-2.0
     3  
     4  package newrelic
     5  
     6  import (
     7  	"fmt"
     8  	"testing"
     9  )
    10  
    11  func TestConnectBackoff(t *testing.T) {
    12  	attempts := map[int]int{
    13  		0:   15,
    14  		2:   30,
    15  		5:   300,
    16  		6:   300,
    17  		100: 300,
    18  		-5:  300,
    19  	}
    20  
    21  	for k, v := range attempts {
    22  		if b := getConnectBackoffTime(k); b != v {
    23  			t.Error(fmt.Sprintf("Invalid connect backoff for attempt #%d:", k), v)
    24  		}
    25  	}
    26  }