This file is indexed.

/usr/share/gocode/src/github.com/influxdata/influxdb/stress/v2/statement/template_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
package statement

import (
	"testing"
)

func TestNewTagFunc(t *testing.T) {
	wtags := newTestTagsTemplate()
	wfunc := newTestFunctionTemplate()

	expected := wtags.Tags[0]
	got := wtags.NewTagFunc()()
	if got != expected {
		t.Errorf("expected: %v\ngot: %v\n", expected, got)
	}
	expected = "EMPTY TAGS"
	got = wfunc.NewTagFunc()()
	if got != expected {
		t.Errorf("expected: %v\ngot: %v\n", expected, got)
	}
}

func TestNumSeries(t *testing.T) {
	wtags := newTestTagsTemplate()
	wfunc := newTestFunctionTemplate()

	expected := len(wtags.Tags)
	got := wtags.numSeries()
	if got != expected {
		t.Errorf("expected: %v\ngot: %v\n", expected, got)
	}
	expected = wfunc.Function.Count
	got = wfunc.numSeries()
	if got != expected {
		t.Errorf("expected: %v\ngot: %v\n", expected, got)
	}
}

func TestTemplatesInit(t *testing.T) {
	tmpls := newTestTemplates()
	s := tmpls.Init(5)
	vals := s.Eval(spoofTime)
	expected := tmpls[0].Tags[0]
	got := vals[0]
	if got != expected {
		t.Errorf("expected: %v\ngot: %v\n", expected, got)
	}
	expected = "0i"
	got = vals[1]
	if got != expected {
		t.Errorf("expected: %v\ngot: %v\n", expected, got)
	}
}

func newTestTemplates() Templates {
	return []*Template{
		newTestTagsTemplate(),
		newTestFunctionTemplate(),
	}
}

func newTestTagsTemplate() *Template {
	return &Template{
		Tags: []string{"thing", "other_thing"},
	}
}

func newTestFunctionTemplate() *Template {
	return &Template{
		Function: newIntIncFunction(),
	}
}