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
|
//go:build !gitaly_test_sha256
package praefect
import (
"context"
"fmt"
"gitlab.com/gitlab-org/gitaly/v16/internal/praefect/config"
"gitlab.com/gitlab-org/gitaly/v16/internal/praefect/nodes"
)
// generates a praefect configuration with the specified number of backend
// nodes
func testConfig(backends int) config.Config {
var nodes []*config.Node
for i := 0; i < backends; i++ {
n := &config.Node{
Storage: fmt.Sprintf("praefect-internal-%d", i),
Token: fmt.Sprintf("%d", i),
}
nodes = append(nodes, n)
}
cfg := config.Config{
VirtualStorages: []*config.VirtualStorage{
{
Name: "praefect",
Nodes: nodes,
},
},
}
return cfg
}
type nullNodeMgr struct{}
func (nullNodeMgr) GetShard(ctx context.Context, virtualStorageName string) (nodes.Shard, error) {
return nodes.Shard{Primary: &nodes.MockNode{}}, nil
}
func (nullNodeMgr) GetSyncedNode(ctx context.Context, virtualStorageName, repoPath string) (nodes.Node, error) {
return nil, nil
}
func (nullNodeMgr) HealthyNodes() map[string][]string {
return nil
}
func (nullNodeMgr) Nodes() map[string][]nodes.Node {
return nil
}
|