This file is indexed.

/usr/share/gocode/src/github.com/influxdata/influxdb/coordinator/points_writer_internal_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
package coordinator

import (
	"testing"
	"time"
)

func TestSgList_ShardGroupAt(t *testing.T) {
	base := time.Date(2016, 10, 19, 0, 0, 0, 0, time.UTC)
	day := func(n int) time.Time {
		return base.Add(time.Duration(24*n) * time.Hour)
	}

	list := sgList{
		{ID: 1, StartTime: day(0), EndTime: day(1)},
		{ID: 2, StartTime: day(1), EndTime: day(2)},
		{ID: 3, StartTime: day(2), EndTime: day(3)},
		// SG day 3 to day 4 missing...
		{ID: 4, StartTime: day(4), EndTime: day(5)},
		{ID: 5, StartTime: day(5), EndTime: day(6)},
	}

	examples := []struct {
		T            time.Time
		ShardGroupID uint64 // 0 will indicate we don't expect a shard group
	}{
		{T: base.Add(-time.Minute), ShardGroupID: 0}, // Before any SG
		{T: day(0), ShardGroupID: 1},
		{T: day(0).Add(time.Minute), ShardGroupID: 1},
		{T: day(1), ShardGroupID: 2},
		{T: day(3).Add(time.Minute), ShardGroupID: 0}, // No matching SG
		{T: day(5).Add(time.Hour), ShardGroupID: 5},
	}

	for i, example := range examples {
		sg := list.ShardGroupAt(example.T)
		var id uint64
		if sg != nil {
			id = sg.ID
		}

		if got, exp := id, example.ShardGroupID; got != exp {
			t.Errorf("[Example %d] got %v, expected %v", i+1, got, exp)
		}
	}
}