Fix powerdns input test (#4554)

This commit is contained in:
dupondje 2018-08-14 22:35:39 +02:00 committed by Greg
parent 3268937c47
commit 763dc6990c
1 changed files with 2 additions and 5 deletions

View File

@ -1,8 +1,6 @@
package powerdns package powerdns
import ( import (
"crypto/rand"
"encoding/binary"
"fmt" "fmt"
"net" "net"
"testing" "testing"
@ -70,10 +68,9 @@ func (s statServer) serverSocket(l net.Listener) {
} }
} }
func TestMemcachedGeneratesMetrics(t *testing.T) { func TestPowerdnsGeneratesMetrics(t *testing.T) {
// We create a fake server to return test data // We create a fake server to return test data
var randomNumber int64 randomNumber := int64(5239846799706671610)
binary.Read(rand.Reader, binary.LittleEndian, &randomNumber)
socket, err := net.Listen("unix", fmt.Sprintf("/tmp/pdns%d.controlsocket", randomNumber)) socket, err := net.Listen("unix", fmt.Sprintf("/tmp/pdns%d.controlsocket", randomNumber))
if err != nil { if err != nil {
t.Fatal("Cannot initialize server on port ") t.Fatal("Cannot initialize server on port ")