This file is indexed.

/usr/share/gocode/src/github.com/influxdata/influxdb/stress/v2/stress_client/reporting_test.go is in golang-github-influxdb-influxdb-dev 1.1.1+dfsg1-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package stressClient

import (
	"testing"
	"time"
)

func TestNewStressClientTags(t *testing.T) {
	pe, _, _ := newTestStressClient("localhost:8086")
	tags := pe.tags("foo_id")
	expected := fmtInt(len(pe.addresses))
	got := tags["number_targets"]
	if expected != got {
		t.Errorf("expected: %v\ngot: %v\n", expected, got)
	}
	expected = pe.precision
	got = tags["precision"]
	if expected != got {
		t.Errorf("expected: %v\ngot: %v\n", expected, got)
	}
	expected = pe.wdelay
	got = tags["write_interval"]
	if expected != got {
		t.Errorf("expected: %v\ngot: %v\n", expected, got)
	}
	expected = "foo_id"
	got = tags["statement_id"]
	if expected != got {
		t.Errorf("expected: %v\ngot: %v\n", expected, got)
	}
}

func TestNewStressTestTags(t *testing.T) {
	sf, _, _ := NewTestStressTest()
	tags := sf.tags()
	expected := sf.Precision
	got := tags["precision"]
	if expected != got {
		t.Errorf("expected: %v\ngot: %v\n", expected, got)
	}
	expected = fmtInt(sf.BatchSize)
	got = tags["batch_size"]
	if expected != got {
		t.Errorf("expected: %v\ngot: %v\n", expected, got)
	}
}

func TestWritePoint(t *testing.T) {
	pe, _, _ := newTestStressClient("localhost:8086")
	statementID := "foo_id"
	responseCode := 200
	responseTime := time.Duration(10 * time.Millisecond)
	addedTags := map[string]string{"foo_tag": "foo_tag_value"}
	writeBytes := 28051
	pt := pe.writePoint(1, statementID, responseCode, responseTime, addedTags, writeBytes)
	got := pt.Tags()["statement_id"]
	if statementID != got {
		t.Errorf("expected: %v\ngot: %v\n", statementID, got)
	}
	got2 := int(pt.Fields()["status_code"].(int64))
	if responseCode != got2 {
		t.Errorf("expected: %v\ngot: %v\n", responseCode, got2)
	}
	expected := "write"
	got = pt.Name()
	if expected != got {
		t.Errorf("expected: %v\ngot: %v\n", expected, got)
	}
}

func TestQueryPoint(t *testing.T) {
	pe, _, _ := newTestStressClient("localhost:8086")
	statementID := "foo_id"
	responseCode := 200
	body := []byte{12}
	responseTime := time.Duration(10 * time.Millisecond)
	addedTags := map[string]string{"foo_tag": "foo_tag_value"}
	pt := pe.queryPoint(statementID, body, responseCode, responseTime, addedTags)
	got := pt.Tags()["statement_id"]
	if statementID != got {
		t.Errorf("expected: %v\ngot: %v\n", statementID, got)
	}
	got2 := int(pt.Fields()["status_code"].(int64))
	if responseCode != got2 {
		t.Errorf("expected: %v\ngot: %v\n", responseCode, got2)
	}
	expected := "query"
	got = pt.Name()
	if expected != got {
		t.Errorf("expected: %v\ngot: %v\n", expected, got)
	}
}