File: helpers_test.go

package info (click to toggle)
prometheus-squid-exporter 1.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 348 kB
  • sloc: makefile: 51; sh: 43
file content (27 lines) | stat: -rw-r--r-- 593 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package main

import (
	"testing"

	"github.com/stretchr/testify/assert"

	"github.com/boynux/squid-exporter/config"
)

func TestCreatProxyHelper(t *testing.T) {
	// createProxyHeader calls net.LookupIP, which will fail in a build env
	if testing.Short() {
		t.Skip("skipping testing in short mode")
	}

	cfg := &config.Config{
		ListenAddress: "192.0.2.1:3192",
		SquidHostname: "127.0.0.1",
		SquidPort:     3128,
	}

	expectedHProxyString := "PROXY TCP4 192.0.2.1 127.0.0.1 3192 3128"

	p := createProxyHeader(cfg)
	assert.Equal(t, expectedHProxyString, p, "Proxy headers do not match!")
}